diff options
author | Chris Leech <christopher.leech@intel.com> | 2009-11-03 14:46:14 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:00:56 -0500 |
commit | 174e1ebffd30a7599b889900089f7acef944cc6b (patch) | |
tree | 69b5d4e22f1b997128789eddcd1ec61a33d5903e /include | |
parent | 86221969e20a2f60ce104160dc836a964974673b (diff) |
[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>
Diffstat (limited to 'include')
-rw-r--r-- | include/scsi/libfc.h | 20 |
1 files changed, 20 insertions, 0 deletions
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 { | |||
640 | /* Associations */ | 640 | /* Associations */ |
641 | struct Scsi_Host *host; | 641 | struct Scsi_Host *host; |
642 | struct list_head ema_list; | 642 | struct list_head ema_list; |
643 | struct list_head vports; /* child vports if N_Port */ | ||
644 | struct fc_vport *vport; /* parent vport if VN_Port */ | ||
643 | struct fc_rport_priv *dns_rp; | 645 | struct fc_rport_priv *dns_rp; |
644 | struct fc_rport_priv *ptp_rp; | 646 | struct fc_rport_priv *ptp_rp; |
645 | void *scsi_priv; | 647 | void *scsi_priv; |
@@ -664,6 +666,8 @@ struct fc_lport { | |||
664 | u32 seq_offload:1; /* seq offload supported */ | 666 | u32 seq_offload:1; /* seq offload supported */ |
665 | u32 crc_offload:1; /* crc offload supported */ | 667 | u32 crc_offload:1; /* crc offload supported */ |
666 | u32 lro_enabled:1; /* large receive offload */ | 668 | u32 lro_enabled:1; /* large receive offload */ |
669 | u32 does_npiv:1; /* supports multiple vports */ | ||
670 | u32 npiv_enabled:1; /* switch/fabric allows NPIV */ | ||
667 | u32 mfs; /* max FC payload size */ | 671 | u32 mfs; /* max FC payload size */ |
668 | unsigned int service_params; | 672 | unsigned int service_params; |
669 | unsigned int e_d_tov; | 673 | unsigned int e_d_tov; |
@@ -753,6 +757,7 @@ libfc_host_alloc(struct scsi_host_template *sht, int priv_size) | |||
753 | lport = shost_priv(shost); | 757 | lport = shost_priv(shost); |
754 | lport->host = shost; | 758 | lport->host = shost; |
755 | INIT_LIST_HEAD(&lport->ema_list); | 759 | INIT_LIST_HEAD(&lport->ema_list); |
760 | INIT_LIST_HEAD(&lport->vports); | ||
756 | return lport; | 761 | return lport; |
757 | } | 762 | } |
758 | 763 | ||
@@ -805,6 +810,15 @@ int fc_lport_reset(struct fc_lport *); | |||
805 | */ | 810 | */ |
806 | int fc_set_mfs(struct fc_lport *lp, u32 mfs); | 811 | int fc_set_mfs(struct fc_lport *lp, u32 mfs); |
807 | 812 | ||
813 | /* | ||
814 | * Allocate a new lport struct for an NPIV VN_Port | ||
815 | */ | ||
816 | struct fc_lport *libfc_vport_create(struct fc_vport *vport, int privsize); | ||
817 | |||
818 | /* | ||
819 | * Find an NPIV VN_Port by port ID | ||
820 | */ | ||
821 | struct fc_lport *fc_vport_id_lookup(struct fc_lport *n_port, u32 port_id); | ||
808 | 822 | ||
809 | /* | 823 | /* |
810 | * REMOTE PORT LAYER | 824 | * REMOTE PORT LAYER |
@@ -912,6 +926,12 @@ struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *lport, | |||
912 | void fc_exch_mgr_del(struct fc_exch_mgr_anchor *ema); | 926 | void fc_exch_mgr_del(struct fc_exch_mgr_anchor *ema); |
913 | 927 | ||
914 | /* | 928 | /* |
929 | * Clone an exchange manager list, getting reference holds for each EM. | ||
930 | * This is for use with NPIV and sharing the X_ID space between VN_Ports. | ||
931 | */ | ||
932 | int fc_exch_mgr_list_clone(struct fc_lport *src, struct fc_lport *dst); | ||
933 | |||
934 | /* | ||
915 | * Allocates an Exchange Manager (EM). | 935 | * Allocates an Exchange Manager (EM). |
916 | * | 936 | * |
917 | * The EM manages exchanges for their allocation and | 937 | * The EM manages exchanges for their allocation and |