diff options
author | Chris Leech <christopher.leech@intel.com> | 2009-11-03 14:46:34 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:00:59 -0500 |
commit | e9084bb8b4414dc1cfb840ac5a86fac23fccd013 (patch) | |
tree | 7d94b7f51242ef8f18b0d21d21df3b2d0dbce20b /drivers | |
parent | 11b561886643d4e23d0fd58c205d830a448dd0a2 (diff) |
[SCSI] fcoe: add a separate scsi transport template for NPIV vports
Right now it's exactly the same as the physical port template,
and there is no way to create a port on anything other than the
netdev. When the vport_create entry point gets hooked up it will
create lports on top of vport devices, which will use this.
Rename scsi_transport_fcoe_sw to fcoe_transport_template to be more
clear with naming now that there are two templates.
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 'drivers')
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index a64c398c981e..d37d5739799c 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -90,7 +90,8 @@ static struct notifier_block fcoe_notifier = { | |||
90 | .notifier_call = fcoe_device_notification, | 90 | .notifier_call = fcoe_device_notification, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | static struct scsi_transport_template *scsi_transport_fcoe_sw; | 93 | static struct scsi_transport_template *fcoe_transport_template; |
94 | static struct scsi_transport_template *fcoe_vport_transport_template; | ||
94 | 95 | ||
95 | struct fc_function_template fcoe_transport_function = { | 96 | struct fc_function_template fcoe_transport_function = { |
96 | .show_host_node_name = 1, | 97 | .show_host_node_name = 1, |
@@ -125,6 +126,39 @@ struct fc_function_template fcoe_transport_function = { | |||
125 | .terminate_rport_io = fc_rport_terminate_io, | 126 | .terminate_rport_io = fc_rport_terminate_io, |
126 | }; | 127 | }; |
127 | 128 | ||
129 | struct fc_function_template fcoe_vport_transport_function = { | ||
130 | .show_host_node_name = 1, | ||
131 | .show_host_port_name = 1, | ||
132 | .show_host_supported_classes = 1, | ||
133 | .show_host_supported_fc4s = 1, | ||
134 | .show_host_active_fc4s = 1, | ||
135 | .show_host_maxframe_size = 1, | ||
136 | |||
137 | .show_host_port_id = 1, | ||
138 | .show_host_supported_speeds = 1, | ||
139 | .get_host_speed = fc_get_host_speed, | ||
140 | .show_host_speed = 1, | ||
141 | .show_host_port_type = 1, | ||
142 | .get_host_port_state = fc_get_host_port_state, | ||
143 | .show_host_port_state = 1, | ||
144 | .show_host_symbolic_name = 1, | ||
145 | |||
146 | .dd_fcrport_size = sizeof(struct fc_rport_libfc_priv), | ||
147 | .show_rport_maxframe_size = 1, | ||
148 | .show_rport_supported_classes = 1, | ||
149 | |||
150 | .show_host_fabric_name = 1, | ||
151 | .show_starget_node_name = 1, | ||
152 | .show_starget_port_name = 1, | ||
153 | .show_starget_port_id = 1, | ||
154 | .set_rport_dev_loss_tmo = fc_set_rport_loss_tmo, | ||
155 | .show_rport_dev_loss_tmo = 1, | ||
156 | .get_fc_host_stats = fc_get_host_stats, | ||
157 | .issue_fc_host_lip = fcoe_reset, | ||
158 | |||
159 | .terminate_rport_io = fc_rport_terminate_io, | ||
160 | }; | ||
161 | |||
128 | static struct scsi_host_template fcoe_shost_template = { | 162 | static struct scsi_host_template fcoe_shost_template = { |
129 | .module = THIS_MODULE, | 163 | .module = THIS_MODULE, |
130 | .name = "FCoE Driver", | 164 | .name = "FCoE Driver", |
@@ -530,7 +564,10 @@ static int fcoe_shost_config(struct fc_lport *lp, struct Scsi_Host *shost, | |||
530 | lp->host->max_lun = FCOE_MAX_LUN; | 564 | lp->host->max_lun = FCOE_MAX_LUN; |
531 | lp->host->max_id = FCOE_MAX_FCP_TARGET; | 565 | lp->host->max_id = FCOE_MAX_FCP_TARGET; |
532 | lp->host->max_channel = 0; | 566 | lp->host->max_channel = 0; |
533 | lp->host->transportt = scsi_transport_fcoe_sw; | 567 | if (lp->vport) |
568 | lp->host->transportt = fcoe_vport_transport_template; | ||
569 | else | ||
570 | lp->host->transportt = fcoe_transport_template; | ||
534 | 571 | ||
535 | /* add the new host to the SCSI-ml */ | 572 | /* add the new host to the SCSI-ml */ |
536 | rc = scsi_add_host(lp->host, dev); | 573 | rc = scsi_add_host(lp->host, dev); |
@@ -836,10 +873,11 @@ out: | |||
836 | static int __init fcoe_if_init(void) | 873 | static int __init fcoe_if_init(void) |
837 | { | 874 | { |
838 | /* attach to scsi transport */ | 875 | /* attach to scsi transport */ |
839 | scsi_transport_fcoe_sw = | 876 | fcoe_transport_template = fc_attach_transport(&fcoe_transport_function); |
840 | fc_attach_transport(&fcoe_transport_function); | 877 | fcoe_vport_transport_template = |
878 | fc_attach_transport(&fcoe_vport_transport_function); | ||
841 | 879 | ||
842 | if (!scsi_transport_fcoe_sw) { | 880 | if (!fcoe_transport_template) { |
843 | printk(KERN_ERR "fcoe: Failed to attach to the FC transport\n"); | 881 | printk(KERN_ERR "fcoe: Failed to attach to the FC transport\n"); |
844 | return -ENODEV; | 882 | return -ENODEV; |
845 | } | 883 | } |
@@ -854,8 +892,10 @@ static int __init fcoe_if_init(void) | |||
854 | */ | 892 | */ |
855 | int __exit fcoe_if_exit(void) | 893 | int __exit fcoe_if_exit(void) |
856 | { | 894 | { |
857 | fc_release_transport(scsi_transport_fcoe_sw); | 895 | fc_release_transport(fcoe_transport_template); |
858 | scsi_transport_fcoe_sw = NULL; | 896 | fc_release_transport(fcoe_vport_transport_template); |
897 | fcoe_transport_template = NULL; | ||
898 | fcoe_vport_transport_template = NULL; | ||
859 | return 0; | 899 | return 0; |
860 | } | 900 | } |
861 | 901 | ||