[SCSI] libfc: add some generic NPIV support routines to libfc
Adds a function to create a new VN_Port instances, which share the EM list with the N_Port, VN_Port lookup by fabric ID when responding to a new request (otherwise the exchange lookup from the N_Ports EM list is trusted to return an exchange with a cached lport value for the correct VN_Port), a pointer to a fc_vport structure for VN_Ports, and flags to indicate if an N_Port supports NPIV and if the switch/fabric allows it. Signed-off-by: Chris Leech <christopher.leech@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:

committed by
James Bottomley

parent
86221969e2
commit
174e1ebffd
@@ -1134,6 +1134,15 @@ static void fc_exch_recv_req(struct fc_lport *lp, struct fc_exch_mgr *mp,
|
||||
u32 f_ctl;
|
||||
enum fc_pf_rjt_reason reject;
|
||||
|
||||
/* We can have the wrong fc_lport at this point with NPIV, which is a
|
||||
* problem now that we know a new exchange needs to be allocated
|
||||
*/
|
||||
lp = fc_vport_id_lookup(lp, ntoh24(fh->fh_d_id));
|
||||
if (!lp) {
|
||||
fc_frame_free(fp);
|
||||
return;
|
||||
}
|
||||
|
||||
fr_seq(fp) = NULL;
|
||||
reject = fc_seq_lookup_recip(lp, mp, fp);
|
||||
if (reject == FC_RJT_NONE) {
|
||||
@@ -1900,6 +1909,26 @@ void fc_exch_mgr_del(struct fc_exch_mgr_anchor *ema)
|
||||
}
|
||||
EXPORT_SYMBOL(fc_exch_mgr_del);
|
||||
|
||||
/**
|
||||
* fc_exch_mgr_list_clone() - share all exchange manager objects
|
||||
* @src: source lport to clone exchange managers from
|
||||
* @dst: new lport that takes references to all the exchange managers
|
||||
*/
|
||||
int fc_exch_mgr_list_clone(struct fc_lport *src, struct fc_lport *dst)
|
||||
{
|
||||
struct fc_exch_mgr_anchor *ema, *tmp;
|
||||
|
||||
list_for_each_entry(ema, &src->ema_list, ema_list) {
|
||||
if (!fc_exch_mgr_add(dst, ema->mp, ema->match))
|
||||
goto err;
|
||||
}
|
||||
return 0;
|
||||
err:
|
||||
list_for_each_entry_safe(ema, tmp, &dst->ema_list, ema_list)
|
||||
fc_exch_mgr_del(ema);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lp,
|
||||
enum fc_class class,
|
||||
u16 min_xid, u16 max_xid,
|
||||
|
Reference in New Issue
Block a user