From 174e1ebffd30a7599b889900089f7acef944cc6b Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Tue, 3 Nov 2009 11:46:14 -0800 Subject: [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 Signed-off-by: Robert Love Signed-off-by: James Bottomley --- include/scsi/libfc.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include/scsi') diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index ed3057b4e78d..2c6d55de8ccd 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h @@ -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). * -- cgit v1.2.3-59-g8ed1b