aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_attr.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2008-12-04 22:39:13 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-12-29 12:24:26 -0500
commiteada272dfc32ba3dcd33e7ca5875337defb13c54 (patch)
tree89e52427d2458a59db3a1aca0fdc01453bf1f748 /drivers/scsi/lpfc/lpfc_attr.c
parent109f6ed05aadb7dd1cc9671a63603658d3ba518e (diff)
[SCSI] lpfc 8.3.0 : Fix multiple NPIV issues
- Fix lock up on rmmod with vports defined by having lpfc_pci_remove_one() invoke fc_vport_terminate() to remove all the vports before invoking fc_remove_host() for the physical port - Fix echotest failure when NPIV is enabled - Add the vport_disable function to the physical port's transport template to make the vport disable attribute visible - Set the vport state to DISABLE on create if the disable flag is true - Call lpfc_alloc_sysfs_attr() for vports so that statistical data collection works on them - Support setting a vport's symbolic name via sysfs by writing to /sys/class/fc_vport/vportX/symbolic_name - Fix create vport fails when link is down or in loop mode. Should be able to be create vports any time NPIV is enabled - Fix slow vport deletes when deleting multiple vports at once Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c47
1 files changed, 39 insertions, 8 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index aa3d6277581d..7c015982b40f 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -3282,25 +3282,28 @@ lpfc_alloc_sysfs_attr(struct lpfc_vport *vport)
3282 int error; 3282 int error;
3283 3283
3284 error = sysfs_create_bin_file(&shost->shost_dev.kobj, 3284 error = sysfs_create_bin_file(&shost->shost_dev.kobj,
3285 &sysfs_ctlreg_attr); 3285 &sysfs_drvr_stat_data_attr);
3286 if (error) 3286
3287 /* Virtual ports do not need ctrl_reg and mbox */
3288 if (error || vport->port_type == LPFC_NPIV_PORT)
3287 goto out; 3289 goto out;
3288 3290
3289 error = sysfs_create_bin_file(&shost->shost_dev.kobj, 3291 error = sysfs_create_bin_file(&shost->shost_dev.kobj,
3290 &sysfs_mbox_attr); 3292 &sysfs_ctlreg_attr);
3291 if (error) 3293 if (error)
3292 goto out_remove_ctlreg_attr; 3294 goto out_remove_stat_attr;
3293 3295
3294 error = sysfs_create_bin_file(&shost->shost_dev.kobj, 3296 error = sysfs_create_bin_file(&shost->shost_dev.kobj,
3295 &sysfs_drvr_stat_data_attr); 3297 &sysfs_mbox_attr);
3296 if (error) 3298 if (error)
3297 goto out_remove_mbox_attr; 3299 goto out_remove_ctlreg_attr;
3298 3300
3299 return 0; 3301 return 0;
3300out_remove_mbox_attr:
3301 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr);
3302out_remove_ctlreg_attr: 3302out_remove_ctlreg_attr:
3303 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); 3303 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr);
3304out_remove_stat_attr:
3305 sysfs_remove_bin_file(&shost->shost_dev.kobj,
3306 &sysfs_drvr_stat_data_attr);
3304out: 3307out:
3305 return error; 3308 return error;
3306} 3309}
@@ -3315,6 +3318,9 @@ lpfc_free_sysfs_attr(struct lpfc_vport *vport)
3315 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 3318 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
3316 sysfs_remove_bin_file(&shost->shost_dev.kobj, 3319 sysfs_remove_bin_file(&shost->shost_dev.kobj,
3317 &sysfs_drvr_stat_data_attr); 3320 &sysfs_drvr_stat_data_attr);
3321 /* Virtual ports do not need ctrl_reg and mbox */
3322 if (vport->port_type == LPFC_NPIV_PORT)
3323 return;
3318 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr); 3324 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr);
3319 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); 3325 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr);
3320} 3326}
@@ -3792,6 +3798,23 @@ lpfc_show_rport_##field (struct device *dev, \
3792 lpfc_rport_show_function(field, format_string, sz, ) \ 3798 lpfc_rport_show_function(field, format_string, sz, ) \
3793static FC_RPORT_ATTR(field, S_IRUGO, lpfc_show_rport_##field, NULL) 3799static FC_RPORT_ATTR(field, S_IRUGO, lpfc_show_rport_##field, NULL)
3794 3800
3801/**
3802 * lpfc_set_vport_symbolic_name: Set the vport's symbolic name.
3803 * @fc_vport: The fc_vport who's symbolic name has been changed.
3804 *
3805 * Description:
3806 * This function is called by the transport after the @fc_vport's symbolic name
3807 * has been changed. This function re-registers the symbolic name with the
3808 * switch to propogate the change into the fabric if the vport is active.
3809 **/
3810static void
3811lpfc_set_vport_symbolic_name(struct fc_vport *fc_vport)
3812{
3813 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data;
3814
3815 if (vport->port_state == LPFC_VPORT_READY)
3816 lpfc_ns_cmd(vport, SLI_CTNS_RSPN_ID, 0, 0);
3817}
3795 3818
3796struct fc_function_template lpfc_transport_functions = { 3819struct fc_function_template lpfc_transport_functions = {
3797 /* fixed attributes the driver supports */ 3820 /* fixed attributes the driver supports */
@@ -3801,6 +3824,7 @@ struct fc_function_template lpfc_transport_functions = {
3801 .show_host_supported_fc4s = 1, 3824 .show_host_supported_fc4s = 1,
3802 .show_host_supported_speeds = 1, 3825 .show_host_supported_speeds = 1,
3803 .show_host_maxframe_size = 1, 3826 .show_host_maxframe_size = 1,
3827 .show_host_symbolic_name = 1,
3804 3828
3805 /* dynamic attributes the driver supports */ 3829 /* dynamic attributes the driver supports */
3806 .get_host_port_id = lpfc_get_host_port_id, 3830 .get_host_port_id = lpfc_get_host_port_id,
@@ -3850,6 +3874,10 @@ struct fc_function_template lpfc_transport_functions = {
3850 .terminate_rport_io = lpfc_terminate_rport_io, 3874 .terminate_rport_io = lpfc_terminate_rport_io,
3851 3875
3852 .dd_fcvport_size = sizeof(struct lpfc_vport *), 3876 .dd_fcvport_size = sizeof(struct lpfc_vport *),
3877
3878 .vport_disable = lpfc_vport_disable,
3879
3880 .set_vport_symbolic_name = lpfc_set_vport_symbolic_name,
3853}; 3881};
3854 3882
3855struct fc_function_template lpfc_vport_transport_functions = { 3883struct fc_function_template lpfc_vport_transport_functions = {
@@ -3860,6 +3888,7 @@ struct fc_function_template lpfc_vport_transport_functions = {
3860 .show_host_supported_fc4s = 1, 3888 .show_host_supported_fc4s = 1,
3861 .show_host_supported_speeds = 1, 3889 .show_host_supported_speeds = 1,
3862 .show_host_maxframe_size = 1, 3890 .show_host_maxframe_size = 1,
3891 .show_host_symbolic_name = 1,
3863 3892
3864 /* dynamic attributes the driver supports */ 3893 /* dynamic attributes the driver supports */
3865 .get_host_port_id = lpfc_get_host_port_id, 3894 .get_host_port_id = lpfc_get_host_port_id,
@@ -3908,6 +3937,8 @@ struct fc_function_template lpfc_vport_transport_functions = {
3908 .terminate_rport_io = lpfc_terminate_rport_io, 3937 .terminate_rport_io = lpfc_terminate_rport_io,
3909 3938
3910 .vport_disable = lpfc_vport_disable, 3939 .vport_disable = lpfc_vport_disable,
3940
3941 .set_vport_symbolic_name = lpfc_set_vport_symbolic_name,
3911}; 3942};
3912 3943
3913/** 3944/**