[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:
Chris Leech
2009-11-03 11:46:14 -08:00
committed by James Bottomley
parent 86221969e2
commit 174e1ebffd
4 changed files with 137 additions and 1 deletions

View File

@@ -640,6 +640,8 @@ struct fc_lport {
/* Associations */
struct Scsi_Host *host;
struct list_head ema_list;
struct list_head vports; /* child vports if N_Port */
struct fc_vport *vport; /* parent vport if VN_Port */
struct fc_rport_priv *dns_rp;
struct fc_rport_priv *ptp_rp;
void *scsi_priv;
@@ -664,6 +666,8 @@ struct fc_lport {
u32 seq_offload:1; /* seq offload supported */
u32 crc_offload:1; /* crc offload supported */
u32 lro_enabled:1; /* large receive offload */
u32 does_npiv:1; /* supports multiple vports */
u32 npiv_enabled:1; /* switch/fabric allows NPIV */
u32 mfs; /* max FC payload size */
unsigned int service_params;
unsigned int e_d_tov;
@@ -753,6 +757,7 @@ libfc_host_alloc(struct scsi_host_template *sht, int priv_size)
lport = shost_priv(shost);
lport->host = shost;
INIT_LIST_HEAD(&lport->ema_list);
INIT_LIST_HEAD(&lport->vports);
return lport;
}
@@ -805,6 +810,15 @@ int fc_lport_reset(struct fc_lport *);
*/
int fc_set_mfs(struct fc_lport *lp, u32 mfs);
/*
* Allocate a new lport struct for an NPIV VN_Port
*/
struct fc_lport *libfc_vport_create(struct fc_vport *vport, int privsize);
/*
* Find an NPIV VN_Port by port ID
*/
struct fc_lport *fc_vport_id_lookup(struct fc_lport *n_port, u32 port_id);
/*
* REMOTE PORT LAYER
@@ -911,6 +925,12 @@ struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *lport,
*/
void fc_exch_mgr_del(struct fc_exch_mgr_anchor *ema);
/*
* Clone an exchange manager list, getting reference holds for each EM.
* This is for use with NPIV and sharing the X_ID space between VN_Ports.
*/
int fc_exch_mgr_list_clone(struct fc_lport *src, struct fc_lport *dst);
/*
* Allocates an Exchange Manager (EM).
*