diff options
author | James Smart <James.Smart@Emulex.Com> | 2007-08-02 11:09:59 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-08-01 13:19:24 -0400 |
commit | 3de2a653a127c468284c48e233719dc39769e354 (patch) | |
tree | c57fd1c8b8ce28d2e2e87ddbff0ecb10ac1524f9 /drivers | |
parent | 549e55cd2a1b83ea45ac17fb6c309654a3d371a4 (diff) |
[SCSI] lpfc 8.2.2 : Attribute and Parameter splits for vport and physical port
- Split attributes up into vport and non-vport attributes.
- Move vport specific cfg params to vport
Many of the vport-specific behaviors were still global attributes
on the physical port. Move them to the vport itself.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/lpfc/lpfc.h | 34 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 354 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 5 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_ct.c | 6 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_els.c | 10 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 4 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 22 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_nportdisc.c | 13 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 49 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_vport.c | 6 |
10 files changed, 354 insertions, 149 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 6127635e6275..fb56ff9d5da2 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -338,6 +338,20 @@ struct lpfc_vport { | |||
338 | struct lpfc_debugfs_trc *disc_trc; | 338 | struct lpfc_debugfs_trc *disc_trc; |
339 | atomic_t disc_trc_cnt; | 339 | atomic_t disc_trc_cnt; |
340 | #endif | 340 | #endif |
341 | /* Vport Config Parameters */ | ||
342 | uint32_t cfg_scan_down; | ||
343 | uint32_t cfg_lun_queue_depth; | ||
344 | uint32_t cfg_nodev_tmo; | ||
345 | uint32_t cfg_devloss_tmo; | ||
346 | uint32_t cfg_restrict_login; | ||
347 | uint32_t cfg_peer_port_login; | ||
348 | uint32_t cfg_fcp_class; | ||
349 | uint32_t cfg_use_adisc; | ||
350 | uint32_t cfg_fdmi_on; | ||
351 | uint32_t cfg_discovery_threads; | ||
352 | uint32_t cfg_max_luns; | ||
353 | |||
354 | uint32_t dev_loss_tmo_changed; | ||
341 | }; | 355 | }; |
342 | 356 | ||
343 | struct hbq_s { | 357 | struct hbq_s { |
@@ -413,28 +427,16 @@ struct lpfc_hba { | |||
413 | uint8_t wwpn[8]; | 427 | uint8_t wwpn[8]; |
414 | uint32_t RandomData[7]; | 428 | uint32_t RandomData[7]; |
415 | 429 | ||
416 | uint32_t cfg_log_verbose; | 430 | /* HBA Config Parameters */ |
417 | uint32_t cfg_lun_queue_depth; | ||
418 | uint32_t cfg_nodev_tmo; | ||
419 | uint32_t cfg_devloss_tmo; | ||
420 | uint32_t cfg_hba_queue_depth; | ||
421 | uint32_t cfg_peer_port_login; | ||
422 | uint32_t cfg_vport_restrict_login; | ||
423 | uint32_t cfg_npiv_enable; | ||
424 | uint32_t cfg_fcp_class; | ||
425 | uint32_t cfg_use_adisc; | ||
426 | uint32_t cfg_ack0; | 431 | uint32_t cfg_ack0; |
432 | uint32_t cfg_npiv_enable; | ||
427 | uint32_t cfg_topology; | 433 | uint32_t cfg_topology; |
428 | uint32_t cfg_scan_down; | ||
429 | uint32_t cfg_link_speed; | 434 | uint32_t cfg_link_speed; |
430 | uint32_t cfg_cr_delay; | 435 | uint32_t cfg_cr_delay; |
431 | uint32_t cfg_cr_count; | 436 | uint32_t cfg_cr_count; |
432 | uint32_t cfg_multi_ring_support; | 437 | uint32_t cfg_multi_ring_support; |
433 | uint32_t cfg_multi_ring_rctl; | 438 | uint32_t cfg_multi_ring_rctl; |
434 | uint32_t cfg_multi_ring_type; | 439 | uint32_t cfg_multi_ring_type; |
435 | uint32_t cfg_fdmi_on; | ||
436 | uint32_t cfg_discovery_threads; | ||
437 | uint32_t cfg_max_luns; | ||
438 | uint32_t cfg_poll; | 440 | uint32_t cfg_poll; |
439 | uint32_t cfg_poll_tmo; | 441 | uint32_t cfg_poll_tmo; |
440 | uint32_t cfg_use_msi; | 442 | uint32_t cfg_use_msi; |
@@ -442,8 +444,10 @@ struct lpfc_hba { | |||
442 | uint32_t cfg_sg_dma_buf_size; | 444 | uint32_t cfg_sg_dma_buf_size; |
443 | uint64_t cfg_soft_wwnn; | 445 | uint64_t cfg_soft_wwnn; |
444 | uint64_t cfg_soft_wwpn; | 446 | uint64_t cfg_soft_wwpn; |
447 | uint32_t cfg_hba_queue_depth; | ||
445 | 448 | ||
446 | uint32_t dev_loss_tmo_changed; | 449 | /* Config paramters that should be in the vport */ |
450 | uint32_t cfg_log_verbose; | ||
447 | 451 | ||
448 | lpfc_vpd_t vpd; /* vital product data */ | 452 | lpfc_vpd_t vpd; /* vital product data */ |
449 | 453 | ||
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index dbced066a361..61d251b1b03b 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -734,6 +734,77 @@ lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ | |||
734 | return -EINVAL;\ | 734 | return -EINVAL;\ |
735 | } | 735 | } |
736 | 736 | ||
737 | #define lpfc_vport_param_show(attr) \ | ||
738 | static ssize_t \ | ||
739 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | ||
740 | { \ | ||
741 | struct Scsi_Host *shost = class_to_shost(cdev);\ | ||
742 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ | ||
743 | int val = 0;\ | ||
744 | val = vport->cfg_##attr;\ | ||
745 | return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\ | ||
746 | } | ||
747 | |||
748 | #define lpfc_vport_param_hex_show(attr) \ | ||
749 | static ssize_t \ | ||
750 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | ||
751 | { \ | ||
752 | struct Scsi_Host *shost = class_to_shost(cdev);\ | ||
753 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ | ||
754 | int val = 0;\ | ||
755 | val = vport->cfg_##attr;\ | ||
756 | return snprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\ | ||
757 | } | ||
758 | |||
759 | #define lpfc_vport_param_init(attr, default, minval, maxval) \ | ||
760 | static int \ | ||
761 | lpfc_##attr##_init(struct lpfc_vport *vport, int val) \ | ||
762 | { \ | ||
763 | if (val >= minval && val <= maxval) {\ | ||
764 | vport->cfg_##attr = val;\ | ||
765 | return 0;\ | ||
766 | }\ | ||
767 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, \ | ||
768 | "%d:0449 lpfc_"#attr" attribute cannot be set to %d, "\ | ||
769 | "allowed range is ["#minval", "#maxval"]\n", \ | ||
770 | vport->phba->brd_no, val); \ | ||
771 | vport->cfg_##attr = default;\ | ||
772 | return -EINVAL;\ | ||
773 | } | ||
774 | |||
775 | #define lpfc_vport_param_set(attr, default, minval, maxval) \ | ||
776 | static int \ | ||
777 | lpfc_##attr##_set(struct lpfc_vport *vport, int val) \ | ||
778 | { \ | ||
779 | if (val >= minval && val <= maxval) {\ | ||
780 | vport->cfg_##attr = val;\ | ||
781 | return 0;\ | ||
782 | }\ | ||
783 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, \ | ||
784 | "%d:0450 lpfc_"#attr" attribute cannot be set to %d, "\ | ||
785 | "allowed range is ["#minval", "#maxval"]\n", \ | ||
786 | vport->phba->brd_no, val); \ | ||
787 | return -EINVAL;\ | ||
788 | } | ||
789 | |||
790 | #define lpfc_vport_param_store(attr) \ | ||
791 | static ssize_t \ | ||
792 | lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ | ||
793 | { \ | ||
794 | struct Scsi_Host *shost = class_to_shost(cdev);\ | ||
795 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ | ||
796 | int val=0;\ | ||
797 | if (!isdigit(buf[0]))\ | ||
798 | return -EINVAL;\ | ||
799 | if (sscanf(buf, "%i", &val) != 1)\ | ||
800 | return -EINVAL;\ | ||
801 | if (lpfc_##attr##_set(vport, val) == 0) \ | ||
802 | return strlen(buf);\ | ||
803 | else \ | ||
804 | return -EINVAL;\ | ||
805 | } | ||
806 | |||
807 | |||
737 | #define LPFC_ATTR(name, defval, minval, maxval, desc) \ | 808 | #define LPFC_ATTR(name, defval, minval, maxval, desc) \ |
738 | static int lpfc_##name = defval;\ | 809 | static int lpfc_##name = defval;\ |
739 | module_param(lpfc_##name, int, 0);\ | 810 | module_param(lpfc_##name, int, 0);\ |
@@ -778,6 +849,50 @@ lpfc_param_store(name)\ | |||
778 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ | 849 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ |
779 | lpfc_##name##_show, lpfc_##name##_store) | 850 | lpfc_##name##_show, lpfc_##name##_store) |
780 | 851 | ||
852 | #define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \ | ||
853 | static int lpfc_##name = defval;\ | ||
854 | module_param(lpfc_##name, int, 0);\ | ||
855 | MODULE_PARM_DESC(lpfc_##name, desc);\ | ||
856 | lpfc_vport_param_init(name, defval, minval, maxval) | ||
857 | |||
858 | #define LPFC_VPORT_ATTR_R(name, defval, minval, maxval, desc) \ | ||
859 | static int lpfc_##name = defval;\ | ||
860 | module_param(lpfc_##name, int, 0);\ | ||
861 | MODULE_PARM_DESC(lpfc_##name, desc);\ | ||
862 | lpfc_vport_param_show(name)\ | ||
863 | lpfc_vport_param_init(name, defval, minval, maxval)\ | ||
864 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) | ||
865 | |||
866 | #define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \ | ||
867 | static int lpfc_##name = defval;\ | ||
868 | module_param(lpfc_##name, int, 0);\ | ||
869 | MODULE_PARM_DESC(lpfc_##name, desc);\ | ||
870 | lpfc_vport_param_show(name)\ | ||
871 | lpfc_vport_param_init(name, defval, minval, maxval)\ | ||
872 | lpfc_vport_param_set(name, defval, minval, maxval)\ | ||
873 | lpfc_vport_param_store(name)\ | ||
874 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ | ||
875 | lpfc_##name##_show, lpfc_##name##_store) | ||
876 | |||
877 | #define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \ | ||
878 | static int lpfc_##name = defval;\ | ||
879 | module_param(lpfc_##name, int, 0);\ | ||
880 | MODULE_PARM_DESC(lpfc_##name, desc);\ | ||
881 | lpfc_vport_param_hex_show(name)\ | ||
882 | lpfc_vport_param_init(name, defval, minval, maxval)\ | ||
883 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) | ||
884 | |||
885 | #define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \ | ||
886 | static int lpfc_##name = defval;\ | ||
887 | module_param(lpfc_##name, int, 0);\ | ||
888 | MODULE_PARM_DESC(lpfc_##name, desc);\ | ||
889 | lpfc_vport_param_hex_show(name)\ | ||
890 | lpfc_vport_param_init(name, defval, minval, maxval)\ | ||
891 | lpfc_vport_param_set(name, defval, minval, maxval)\ | ||
892 | lpfc_vport_param_store(name)\ | ||
893 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ | ||
894 | lpfc_##name##_show, lpfc_##name##_store) | ||
895 | |||
781 | static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); | 896 | static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); |
782 | static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); | 897 | static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); |
783 | static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); | 898 | static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); |
@@ -1019,53 +1134,48 @@ lpfc_nodev_tmo_show(struct class_device *cdev, char *buf) | |||
1019 | { | 1134 | { |
1020 | struct Scsi_Host *shost = class_to_shost(cdev); | 1135 | struct Scsi_Host *shost = class_to_shost(cdev); |
1021 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 1136 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1022 | struct lpfc_hba *phba = vport->phba; | ||
1023 | int val = 0; | 1137 | int val = 0; |
1024 | val = phba->cfg_devloss_tmo; | 1138 | val = vport->cfg_devloss_tmo; |
1025 | return snprintf(buf, PAGE_SIZE, "%d\n", | 1139 | return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); |
1026 | phba->cfg_devloss_tmo); | ||
1027 | } | 1140 | } |
1028 | 1141 | ||
1029 | static int | 1142 | static int |
1030 | lpfc_nodev_tmo_init(struct lpfc_hba *phba, int val) | 1143 | lpfc_nodev_tmo_init(struct lpfc_vport *vport, int val) |
1031 | { | 1144 | { |
1032 | static int warned; | 1145 | if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { |
1033 | if (phba->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { | 1146 | vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; |
1034 | phba->cfg_nodev_tmo = phba->cfg_devloss_tmo; | 1147 | if (val != LPFC_DEF_DEVLOSS_TMO) |
1035 | if (!warned && val != LPFC_DEF_DEVLOSS_TMO) { | 1148 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, |
1036 | warned = 1; | 1149 | "%d (%d):0402 Ignoring nodev_tmo module" |
1037 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1150 | " parameter because devloss_tmo is" |
1038 | "%d:0402 Ignoring nodev_tmo module " | ||
1039 | "parameter because devloss_tmo is" | ||
1040 | " set.\n", | 1151 | " set.\n", |
1041 | phba->brd_no); | 1152 | vport->phba->brd_no, vport->vpi); |
1042 | } | ||
1043 | return 0; | 1153 | return 0; |
1044 | } | 1154 | } |
1045 | 1155 | ||
1046 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { | 1156 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { |
1047 | phba->cfg_nodev_tmo = val; | 1157 | vport->cfg_nodev_tmo = val; |
1048 | phba->cfg_devloss_tmo = val; | 1158 | vport->cfg_devloss_tmo = val; |
1049 | return 0; | 1159 | return 0; |
1050 | } | 1160 | } |
1051 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1161 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, |
1052 | "%d:0400 lpfc_nodev_tmo attribute cannot be set to %d, " | 1162 | "%d (%d):0400 lpfc_nodev_tmo attribute cannot be set to" |
1053 | "allowed range is [%d, %d]\n", | 1163 | " %d, allowed range is [%d, %d]\n", |
1054 | phba->brd_no, val, | 1164 | vport->phba->brd_no, vport->vpi, val, |
1055 | LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); | 1165 | LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); |
1056 | phba->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; | 1166 | vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; |
1057 | return -EINVAL; | 1167 | return -EINVAL; |
1058 | } | 1168 | } |
1059 | 1169 | ||
1060 | static void | 1170 | static void |
1061 | lpfc_update_rport_devloss_tmo(struct lpfc_hba *phba) | 1171 | lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) |
1062 | { | 1172 | { |
1063 | struct lpfc_vport **vports; | 1173 | struct lpfc_vport **vports; |
1064 | struct Scsi_Host *shost; | 1174 | struct Scsi_Host *shost; |
1065 | struct lpfc_nodelist *ndlp; | 1175 | struct lpfc_nodelist *ndlp; |
1066 | int i; | 1176 | int i; |
1067 | 1177 | ||
1068 | vports = lpfc_create_vport_work_array(phba); | 1178 | vports = lpfc_create_vport_work_array(vport->phba); |
1069 | if (vports != NULL) | 1179 | if (vports != NULL) |
1070 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { | 1180 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { |
1071 | shost = lpfc_shost_from_vport(vports[i]); | 1181 | shost = lpfc_shost_from_vport(vports[i]); |
@@ -1074,40 +1184,38 @@ lpfc_update_rport_devloss_tmo(struct lpfc_hba *phba) | |||
1074 | nlp_listp) | 1184 | nlp_listp) |
1075 | if (ndlp->rport) | 1185 | if (ndlp->rport) |
1076 | ndlp->rport->dev_loss_tmo = | 1186 | ndlp->rport->dev_loss_tmo = |
1077 | phba->cfg_devloss_tmo; | 1187 | vport->cfg_devloss_tmo; |
1078 | spin_unlock_irq(shost->host_lock); | 1188 | spin_unlock_irq(shost->host_lock); |
1079 | } | 1189 | } |
1080 | lpfc_destroy_vport_work_array(vports); | 1190 | lpfc_destroy_vport_work_array(vports); |
1081 | } | 1191 | } |
1082 | 1192 | ||
1083 | static int | 1193 | static int |
1084 | lpfc_nodev_tmo_set(struct lpfc_hba *phba, int val) | 1194 | lpfc_nodev_tmo_set(struct lpfc_vport *vport, int val) |
1085 | { | 1195 | { |
1086 | if (phba->dev_loss_tmo_changed || | 1196 | if (vport->dev_loss_tmo_changed || |
1087 | (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) { | 1197 | (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) { |
1088 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1198 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, |
1089 | "%d:0401 Ignoring change to nodev_tmo " | 1199 | "%d (%d):0401 Ignoring change to nodev_tmo " |
1090 | "because devloss_tmo is set.\n", | 1200 | "because devloss_tmo is set.\n", |
1091 | phba->brd_no); | 1201 | vport->phba->brd_no, vport->vpi); |
1092 | return 0; | 1202 | return 0; |
1093 | } | 1203 | } |
1094 | |||
1095 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { | 1204 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { |
1096 | phba->cfg_nodev_tmo = val; | 1205 | vport->cfg_nodev_tmo = val; |
1097 | phba->cfg_devloss_tmo = val; | 1206 | vport->cfg_devloss_tmo = val; |
1098 | lpfc_update_rport_devloss_tmo(phba); | 1207 | lpfc_update_rport_devloss_tmo(vport); |
1099 | return 0; | 1208 | return 0; |
1100 | } | 1209 | } |
1101 | 1210 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, | |
1102 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1211 | "%d (%d):0403 lpfc_nodev_tmo attribute cannot be set to" |
1103 | "%d:0403 lpfc_nodev_tmo attribute cannot be set to %d, " | 1212 | "%d, allowed range is [%d, %d]\n", |
1104 | "allowed range is [%d, %d]\n", | 1213 | vport->phba->brd_no, vport->vpi, val, |
1105 | phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO, | 1214 | LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); |
1106 | LPFC_MAX_DEVLOSS_TMO); | ||
1107 | return -EINVAL; | 1215 | return -EINVAL; |
1108 | } | 1216 | } |
1109 | 1217 | ||
1110 | lpfc_param_store(nodev_tmo) | 1218 | lpfc_vport_param_store(nodev_tmo) |
1111 | 1219 | ||
1112 | static CLASS_DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR, | 1220 | static CLASS_DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR, |
1113 | lpfc_nodev_tmo_show, lpfc_nodev_tmo_store); | 1221 | lpfc_nodev_tmo_show, lpfc_nodev_tmo_store); |
@@ -1121,29 +1229,29 @@ module_param(lpfc_devloss_tmo, int, 0); | |||
1121 | MODULE_PARM_DESC(lpfc_devloss_tmo, | 1229 | MODULE_PARM_DESC(lpfc_devloss_tmo, |
1122 | "Seconds driver will hold I/O waiting " | 1230 | "Seconds driver will hold I/O waiting " |
1123 | "for a device to come back"); | 1231 | "for a device to come back"); |
1124 | lpfc_param_init(devloss_tmo, LPFC_DEF_DEVLOSS_TMO, | 1232 | lpfc_vport_param_init(devloss_tmo, LPFC_DEF_DEVLOSS_TMO, |
1125 | LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO) | 1233 | LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO) |
1126 | lpfc_param_show(devloss_tmo) | 1234 | lpfc_vport_param_show(devloss_tmo) |
1127 | static int | 1235 | static int |
1128 | lpfc_devloss_tmo_set(struct lpfc_hba *phba, int val) | 1236 | lpfc_devloss_tmo_set(struct lpfc_vport *vport, int val) |
1129 | { | 1237 | { |
1130 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { | 1238 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { |
1131 | phba->cfg_nodev_tmo = val; | 1239 | vport->cfg_nodev_tmo = val; |
1132 | phba->cfg_devloss_tmo = val; | 1240 | vport->cfg_devloss_tmo = val; |
1133 | phba->dev_loss_tmo_changed = 1; | 1241 | vport->dev_loss_tmo_changed = 1; |
1134 | lpfc_update_rport_devloss_tmo(phba); | 1242 | lpfc_update_rport_devloss_tmo(vport); |
1135 | return 0; | 1243 | return 0; |
1136 | } | 1244 | } |
1137 | 1245 | ||
1138 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1246 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, |
1139 | "%d:0404 lpfc_devloss_tmo attribute cannot be set to" | 1247 | "%d:0404 lpfc_devloss_tmo attribute cannot be set to" |
1140 | " %d, allowed range is [%d, %d]\n", | 1248 | " %d, allowed range is [%d, %d]\n", |
1141 | phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO, | 1249 | vport->phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO, |
1142 | LPFC_MAX_DEVLOSS_TMO); | 1250 | LPFC_MAX_DEVLOSS_TMO); |
1143 | return -EINVAL; | 1251 | return -EINVAL; |
1144 | } | 1252 | } |
1145 | 1253 | ||
1146 | lpfc_param_store(devloss_tmo) | 1254 | lpfc_vport_param_store(devloss_tmo) |
1147 | static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, | 1255 | static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, |
1148 | lpfc_devloss_tmo_show, lpfc_devloss_tmo_store); | 1256 | lpfc_devloss_tmo_show, lpfc_devloss_tmo_store); |
1149 | 1257 | ||
@@ -1171,8 +1279,8 @@ LPFC_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff, "Verbose logging bit-mask"); | |||
1171 | # lun_queue_depth: This parameter is used to limit the number of outstanding | 1279 | # lun_queue_depth: This parameter is used to limit the number of outstanding |
1172 | # commands per FCP LUN. Value range is [1,128]. Default value is 30. | 1280 | # commands per FCP LUN. Value range is [1,128]. Default value is 30. |
1173 | */ | 1281 | */ |
1174 | LPFC_ATTR_R(lun_queue_depth, 30, 1, 128, | 1282 | LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 128, |
1175 | "Max number of FCP commands we can queue to a specific LUN"); | 1283 | "Max number of FCP commands we can queue to a specific LUN"); |
1176 | 1284 | ||
1177 | /* | 1285 | /* |
1178 | # hba_queue_depth: This parameter is used to limit the number of outstanding | 1286 | # hba_queue_depth: This parameter is used to limit the number of outstanding |
@@ -1193,12 +1301,12 @@ LPFC_ATTR_R(hba_queue_depth, 8192, 32, 8192, | |||
1193 | # are allowed to login to each other. | 1301 | # are allowed to login to each other. |
1194 | # Default value of this parameter is 0. | 1302 | # Default value of this parameter is 0. |
1195 | */ | 1303 | */ |
1196 | LPFC_ATTR_R(peer_port_login, 0, 0, 1, | 1304 | LPFC_VPORT_ATTR_R(peer_port_login, 0, 0, 1, |
1197 | "Allow peer ports on the same physical port to login to each " | 1305 | "Allow peer ports on the same physical port to login to each " |
1198 | "other."); | 1306 | "other."); |
1199 | 1307 | ||
1200 | /* | 1308 | /* |
1201 | # vport_restrict_login: This parameter allows/prevents logins | 1309 | # restrict_login: This parameter allows/prevents logins |
1202 | # between Virtual Ports and remote initiators. | 1310 | # between Virtual Ports and remote initiators. |
1203 | # When this parameter is not set (0) Virtual Ports will accept PLOGIs from | 1311 | # When this parameter is not set (0) Virtual Ports will accept PLOGIs from |
1204 | # other initiators and will attempt to PLOGI all remote ports. | 1312 | # other initiators and will attempt to PLOGI all remote ports. |
@@ -1208,8 +1316,56 @@ LPFC_ATTR_R(peer_port_login, 0, 0, 1, | |||
1208 | # This parameter does not restrict logins to Fabric resident remote ports. | 1316 | # This parameter does not restrict logins to Fabric resident remote ports. |
1209 | # Default value of this parameter is 1. | 1317 | # Default value of this parameter is 1. |
1210 | */ | 1318 | */ |
1211 | LPFC_ATTR_RW(vport_restrict_login, 1, 0, 1, | 1319 | static int lpfc_restrict_login = 1; |
1212 | "Restrict virtual ports login to remote initiators."); | 1320 | module_param(lpfc_restrict_login, int, 0); |
1321 | MODULE_PARM_DESC(lpfc_restrict_login, | ||
1322 | "Restrict virtual ports login to remote initiators."); | ||
1323 | lpfc_vport_param_show(restrict_login); | ||
1324 | |||
1325 | static int | ||
1326 | lpfc_restrict_login_init(struct lpfc_vport *vport, int val) | ||
1327 | { | ||
1328 | if (val < 0 || val > 1) { | ||
1329 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, | ||
1330 | "%d:0449 lpfc_restrict_login attribute cannot " | ||
1331 | "be set to %d, allowed range is [0, 1]\n", | ||
1332 | vport->phba->brd_no, val); | ||
1333 | vport->cfg_restrict_login = 1; | ||
1334 | return -EINVAL; | ||
1335 | } | ||
1336 | if (vport->port_type == LPFC_PHYSICAL_PORT) { | ||
1337 | vport->cfg_restrict_login = 0; | ||
1338 | return 0; | ||
1339 | } | ||
1340 | vport->cfg_restrict_login = val; | ||
1341 | return 0; | ||
1342 | } | ||
1343 | |||
1344 | static int | ||
1345 | lpfc_restrict_login_set(struct lpfc_vport *vport, int val) | ||
1346 | { | ||
1347 | if (val < 0 || val > 1) { | ||
1348 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, | ||
1349 | "%d:0450 lpfc_restrict_login attribute cannot " | ||
1350 | "be set to %d, allowed range is [0, 1]\n", | ||
1351 | vport->phba->brd_no, val); | ||
1352 | vport->cfg_restrict_login = 1; | ||
1353 | return -EINVAL; | ||
1354 | } | ||
1355 | if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { | ||
1356 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, | ||
1357 | "%d:0468 lpfc_restrict_login must be 0 for " | ||
1358 | "Physical ports.\n", | ||
1359 | vport->phba->brd_no); | ||
1360 | vport->cfg_restrict_login = 0; | ||
1361 | return 0; | ||
1362 | } | ||
1363 | vport->cfg_restrict_login = val; | ||
1364 | return 0; | ||
1365 | } | ||
1366 | lpfc_vport_param_store(restrict_login); | ||
1367 | static CLASS_DEVICE_ATTR(lpfc_restrict_login, S_IRUGO | S_IWUSR, | ||
1368 | lpfc_restrict_login_show, lpfc_restrict_login_store); | ||
1213 | 1369 | ||
1214 | /* | 1370 | /* |
1215 | # Some disk devices have a "select ID" or "select Target" capability. | 1371 | # Some disk devices have a "select ID" or "select Target" capability. |
@@ -1228,8 +1384,8 @@ LPFC_ATTR_RW(vport_restrict_login, 1, 0, 1, | |||
1228 | # and will not work across a fabric. Also this parameter will take | 1384 | # and will not work across a fabric. Also this parameter will take |
1229 | # effect only in the case when ALPA map is not available.) | 1385 | # effect only in the case when ALPA map is not available.) |
1230 | */ | 1386 | */ |
1231 | LPFC_ATTR_R(scan_down, 1, 0, 1, | 1387 | LPFC_VPORT_ATTR_R(scan_down, 1, 0, 1, |
1232 | "Start scanning for devices from highest ALPA to lowest"); | 1388 | "Start scanning for devices from highest ALPA to lowest"); |
1233 | 1389 | ||
1234 | /* | 1390 | /* |
1235 | # lpfc_topology: link topology for init link | 1391 | # lpfc_topology: link topology for init link |
@@ -1260,15 +1416,15 @@ LPFC_ATTR_R(link_speed, 0, 0, 8, "Select link speed"); | |||
1260 | # lpfc_fcp_class: Determines FC class to use for the FCP protocol. | 1416 | # lpfc_fcp_class: Determines FC class to use for the FCP protocol. |
1261 | # Value range is [2,3]. Default value is 3. | 1417 | # Value range is [2,3]. Default value is 3. |
1262 | */ | 1418 | */ |
1263 | LPFC_ATTR_R(fcp_class, 3, 2, 3, | 1419 | LPFC_VPORT_ATTR_R(fcp_class, 3, 2, 3, |
1264 | "Select Fibre Channel class of service for FCP sequences"); | 1420 | "Select Fibre Channel class of service for FCP sequences"); |
1265 | 1421 | ||
1266 | /* | 1422 | /* |
1267 | # lpfc_use_adisc: Use ADISC for FCP rediscovery instead of PLOGI. Value range | 1423 | # lpfc_use_adisc: Use ADISC for FCP rediscovery instead of PLOGI. Value range |
1268 | # is [0,1]. Default value is 0. | 1424 | # is [0,1]. Default value is 0. |
1269 | */ | 1425 | */ |
1270 | LPFC_ATTR_RW(use_adisc, 0, 0, 1, | 1426 | LPFC_VPORT_ATTR_RW(use_adisc, 0, 0, 1, |
1271 | "Use ADISC on rediscovery to authenticate FCP devices"); | 1427 | "Use ADISC on rediscovery to authenticate FCP devices"); |
1272 | 1428 | ||
1273 | /* | 1429 | /* |
1274 | # lpfc_ack0: Use ACK0, instead of ACK1 for class 2 acknowledgement. Value | 1430 | # lpfc_ack0: Use ACK0, instead of ACK1 for class 2 acknowledgement. Value |
@@ -1320,13 +1476,13 @@ LPFC_ATTR_R(multi_ring_type, FC_LLC_SNAP, 1, | |||
1320 | # 2 = support FDMI with attribute of hostname | 1476 | # 2 = support FDMI with attribute of hostname |
1321 | # Value range [0,2]. Default value is 0. | 1477 | # Value range [0,2]. Default value is 0. |
1322 | */ | 1478 | */ |
1323 | LPFC_ATTR_RW(fdmi_on, 0, 0, 2, "Enable FDMI support"); | 1479 | LPFC_VPORT_ATTR_RW(fdmi_on, 0, 0, 2, "Enable FDMI support"); |
1324 | 1480 | ||
1325 | /* | 1481 | /* |
1326 | # Specifies the maximum number of ELS cmds we can have outstanding (for | 1482 | # Specifies the maximum number of ELS cmds we can have outstanding (for |
1327 | # discovery). Value range is [1,64]. Default value = 32. | 1483 | # discovery). Value range is [1,64]. Default value = 32. |
1328 | */ | 1484 | */ |
1329 | LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " | 1485 | LPFC_VPORT_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " |
1330 | "during discovery"); | 1486 | "during discovery"); |
1331 | 1487 | ||
1332 | /* | 1488 | /* |
@@ -1334,8 +1490,7 @@ LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " | |||
1334 | # Value range is [0,65535]. Default value is 255. | 1490 | # Value range is [0,65535]. Default value is 255. |
1335 | # NOTE: The SCSI layer might probe all allowed LUN on some old targets. | 1491 | # NOTE: The SCSI layer might probe all allowed LUN on some old targets. |
1336 | */ | 1492 | */ |
1337 | LPFC_ATTR_R(max_luns, 255, 0, 65535, | 1493 | LPFC_VPORT_ATTR_R(max_luns, 255, 0, 65535, "Maximum allowed LUN"); |
1338 | "Maximum allowed LUN"); | ||
1339 | 1494 | ||
1340 | /* | 1495 | /* |
1341 | # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. | 1496 | # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. |
@@ -1372,7 +1527,6 @@ struct class_device_attribute *lpfc_hba_attrs[] = { | |||
1372 | &class_device_attr_lpfc_lun_queue_depth, | 1527 | &class_device_attr_lpfc_lun_queue_depth, |
1373 | &class_device_attr_lpfc_hba_queue_depth, | 1528 | &class_device_attr_lpfc_hba_queue_depth, |
1374 | &class_device_attr_lpfc_peer_port_login, | 1529 | &class_device_attr_lpfc_peer_port_login, |
1375 | &class_device_attr_lpfc_vport_restrict_login, | ||
1376 | &class_device_attr_lpfc_nodev_tmo, | 1530 | &class_device_attr_lpfc_nodev_tmo, |
1377 | &class_device_attr_lpfc_devloss_tmo, | 1531 | &class_device_attr_lpfc_devloss_tmo, |
1378 | &class_device_attr_lpfc_fcp_class, | 1532 | &class_device_attr_lpfc_fcp_class, |
@@ -1409,6 +1563,29 @@ struct class_device_attribute *lpfc_hba_attrs[] = { | |||
1409 | NULL, | 1563 | NULL, |
1410 | }; | 1564 | }; |
1411 | 1565 | ||
1566 | struct class_device_attribute *lpfc_vport_attrs[] = { | ||
1567 | &class_device_attr_info, | ||
1568 | &class_device_attr_state, | ||
1569 | &class_device_attr_num_discovered_ports, | ||
1570 | &class_device_attr_lpfc_drvr_version, | ||
1571 | |||
1572 | &class_device_attr_lpfc_log_verbose, | ||
1573 | &class_device_attr_lpfc_lun_queue_depth, | ||
1574 | &class_device_attr_lpfc_nodev_tmo, | ||
1575 | &class_device_attr_lpfc_devloss_tmo, | ||
1576 | &class_device_attr_lpfc_hba_queue_depth, | ||
1577 | &class_device_attr_lpfc_peer_port_login, | ||
1578 | &class_device_attr_lpfc_restrict_login, | ||
1579 | &class_device_attr_lpfc_fcp_class, | ||
1580 | &class_device_attr_lpfc_use_adisc, | ||
1581 | &class_device_attr_lpfc_fdmi_on, | ||
1582 | &class_device_attr_lpfc_max_luns, | ||
1583 | &class_device_attr_nport_evt_cnt, | ||
1584 | &class_device_attr_management_version, | ||
1585 | &class_device_attr_npiv_info, | ||
1586 | NULL, | ||
1587 | }; | ||
1588 | |||
1412 | static ssize_t | 1589 | static ssize_t |
1413 | sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr, | 1590 | sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr, |
1414 | char *buf, loff_t off, size_t count) | 1591 | char *buf, loff_t off, size_t count) |
@@ -2264,33 +2441,20 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) | |||
2264 | lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support); | 2441 | lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support); |
2265 | lpfc_multi_ring_rctl_init(phba, lpfc_multi_ring_rctl); | 2442 | lpfc_multi_ring_rctl_init(phba, lpfc_multi_ring_rctl); |
2266 | lpfc_multi_ring_type_init(phba, lpfc_multi_ring_type); | 2443 | lpfc_multi_ring_type_init(phba, lpfc_multi_ring_type); |
2267 | lpfc_lun_queue_depth_init(phba, lpfc_lun_queue_depth); | ||
2268 | lpfc_fcp_class_init(phba, lpfc_fcp_class); | ||
2269 | lpfc_use_adisc_init(phba, lpfc_use_adisc); | ||
2270 | lpfc_ack0_init(phba, lpfc_ack0); | 2444 | lpfc_ack0_init(phba, lpfc_ack0); |
2271 | lpfc_topology_init(phba, lpfc_topology); | 2445 | lpfc_topology_init(phba, lpfc_topology); |
2272 | lpfc_scan_down_init(phba, lpfc_scan_down); | ||
2273 | lpfc_link_speed_init(phba, lpfc_link_speed); | 2446 | lpfc_link_speed_init(phba, lpfc_link_speed); |
2274 | lpfc_fdmi_on_init(phba, lpfc_fdmi_on); | ||
2275 | lpfc_discovery_threads_init(phba, lpfc_discovery_threads); | ||
2276 | lpfc_max_luns_init(phba, lpfc_max_luns); | ||
2277 | lpfc_poll_tmo_init(phba, lpfc_poll_tmo); | 2447 | lpfc_poll_tmo_init(phba, lpfc_poll_tmo); |
2278 | lpfc_peer_port_login_init(phba, lpfc_peer_port_login); | ||
2279 | lpfc_npiv_enable_init(phba, lpfc_npiv_enable); | 2448 | lpfc_npiv_enable_init(phba, lpfc_npiv_enable); |
2280 | lpfc_vport_restrict_login_init(phba, lpfc_vport_restrict_login); | ||
2281 | lpfc_use_msi_init(phba, lpfc_use_msi); | 2449 | lpfc_use_msi_init(phba, lpfc_use_msi); |
2282 | lpfc_devloss_tmo_init(phba, lpfc_devloss_tmo); | ||
2283 | lpfc_nodev_tmo_init(phba, lpfc_nodev_tmo); | ||
2284 | phba->cfg_poll = lpfc_poll; | 2450 | phba->cfg_poll = lpfc_poll; |
2285 | phba->cfg_soft_wwnn = 0L; | 2451 | phba->cfg_soft_wwnn = 0L; |
2286 | phba->cfg_soft_wwpn = 0L; | 2452 | phba->cfg_soft_wwpn = 0L; |
2287 | |||
2288 | /* | 2453 | /* |
2289 | * The total number of segments is the configuration value plus 2 | 2454 | * The total number of segments is the configuration value plus 2 |
2290 | * since the IOCB need a command and response bde. | 2455 | * since the IOCB need a command and response bde. |
2291 | */ | 2456 | */ |
2292 | phba->cfg_sg_seg_cnt = LPFC_SG_SEG_CNT + 2; | 2457 | phba->cfg_sg_seg_cnt = LPFC_SG_SEG_CNT + 2; |
2293 | |||
2294 | /* | 2458 | /* |
2295 | * Since the sg_tablesize is module parameter, the sg_dma_buf_size | 2459 | * Since the sg_tablesize is module parameter, the sg_dma_buf_size |
2296 | * used to create the sg_dma_buf_pool must be dynamically calculated | 2460 | * used to create the sg_dma_buf_pool must be dynamically calculated |
@@ -2298,9 +2462,23 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) | |||
2298 | phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + | 2462 | phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + |
2299 | sizeof(struct fcp_rsp) + | 2463 | sizeof(struct fcp_rsp) + |
2300 | (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64)); | 2464 | (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64)); |
2301 | |||
2302 | |||
2303 | lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); | 2465 | lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); |
2466 | return; | ||
2467 | } | ||
2304 | 2468 | ||
2469 | void | ||
2470 | lpfc_get_vport_cfgparam(struct lpfc_vport *vport) | ||
2471 | { | ||
2472 | lpfc_lun_queue_depth_init(vport, lpfc_lun_queue_depth); | ||
2473 | lpfc_devloss_tmo_init(vport, lpfc_devloss_tmo); | ||
2474 | lpfc_nodev_tmo_init(vport, lpfc_nodev_tmo); | ||
2475 | lpfc_peer_port_login_init(vport, lpfc_peer_port_login); | ||
2476 | lpfc_restrict_login_init(vport, lpfc_restrict_login); | ||
2477 | lpfc_fcp_class_init(vport, lpfc_fcp_class); | ||
2478 | lpfc_use_adisc_init(vport, lpfc_use_adisc); | ||
2479 | lpfc_fdmi_on_init(vport, lpfc_fdmi_on); | ||
2480 | lpfc_discovery_threads_init(vport, lpfc_discovery_threads); | ||
2481 | lpfc_max_luns_init(vport, lpfc_max_luns); | ||
2482 | lpfc_scan_down_init(vport, lpfc_scan_down); | ||
2305 | return; | 2483 | return; |
2306 | } | 2484 | } |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 6689d6f85adc..ef86345ced6e 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -250,10 +250,13 @@ const char* lpfc_info(struct Scsi_Host *); | |||
250 | int lpfc_scan_finished(struct Scsi_Host *, unsigned long); | 250 | int lpfc_scan_finished(struct Scsi_Host *, unsigned long); |
251 | 251 | ||
252 | void lpfc_get_cfgparam(struct lpfc_hba *); | 252 | void lpfc_get_cfgparam(struct lpfc_hba *); |
253 | void lpfc_get_vport_cfgparam(struct lpfc_vport *); | ||
253 | int lpfc_alloc_sysfs_attr(struct lpfc_vport *); | 254 | int lpfc_alloc_sysfs_attr(struct lpfc_vport *); |
254 | void lpfc_free_sysfs_attr(struct lpfc_vport *); | 255 | void lpfc_free_sysfs_attr(struct lpfc_vport *); |
255 | extern struct class_device_attribute *lpfc_hba_attrs[]; | 256 | extern struct class_device_attribute *lpfc_hba_attrs[]; |
257 | extern struct class_device_attribute *lpfc_vport_attrs[]; | ||
256 | extern struct scsi_host_template lpfc_template; | 258 | extern struct scsi_host_template lpfc_template; |
259 | extern struct scsi_host_template lpfc_vport_template; | ||
257 | extern struct fc_function_template lpfc_transport_functions; | 260 | extern struct fc_function_template lpfc_transport_functions; |
258 | extern struct fc_function_template lpfc_vport_transport_functions; | 261 | extern struct fc_function_template lpfc_vport_transport_functions; |
259 | extern int lpfc_sli_mode; | 262 | extern int lpfc_sli_mode; |
@@ -262,7 +265,7 @@ int lpfc_vport_symbolic_node_name(struct lpfc_vport *, char *, size_t); | |||
262 | void lpfc_terminate_rport_io(struct fc_rport *); | 265 | void lpfc_terminate_rport_io(struct fc_rport *); |
263 | void lpfc_dev_loss_tmo_callbk(struct fc_rport *rport); | 266 | void lpfc_dev_loss_tmo_callbk(struct fc_rport *rport); |
264 | 267 | ||
265 | struct lpfc_vport *lpfc_create_port(struct lpfc_hba *, int, struct fc_vport *); | 268 | struct lpfc_vport *lpfc_create_port(struct lpfc_hba *, int, struct device *); |
266 | int lpfc_vport_disable(struct fc_vport *fc_vport, bool disable); | 269 | int lpfc_vport_disable(struct fc_vport *fc_vport, bool disable); |
267 | void lpfc_mbx_unreg_vpi(struct lpfc_vport *); | 270 | void lpfc_mbx_unreg_vpi(struct lpfc_vport *); |
268 | void destroy_port(struct lpfc_vport *); | 271 | void destroy_port(struct lpfc_vport *); |
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 43e2e33f9a07..8b7e90eac5c3 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c | |||
@@ -451,10 +451,10 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
451 | */ | 451 | */ |
452 | if ((Did != vport->fc_myDID) && | 452 | if ((Did != vport->fc_myDID) && |
453 | ((lpfc_find_vport_by_did(phba, Did) == NULL) || | 453 | ((lpfc_find_vport_by_did(phba, Did) == NULL) || |
454 | phba->cfg_peer_port_login)) { | 454 | vport->cfg_peer_port_login)) { |
455 | if ((vport->port_type != LPFC_NPIV_PORT) || | 455 | if ((vport->port_type != LPFC_NPIV_PORT) || |
456 | (vport->fc_flag & FC_RFF_NOT_SUPPORTED) || | 456 | (vport->fc_flag & FC_RFF_NOT_SUPPORTED) || |
457 | (!phba->cfg_vport_restrict_login)) { | 457 | (!vport->cfg_restrict_login)) { |
458 | ndlp = lpfc_setup_disc_node(vport, Did); | 458 | ndlp = lpfc_setup_disc_node(vport, Did); |
459 | if (ndlp) { | 459 | if (ndlp) { |
460 | lpfc_debugfs_disc_trc(vport, | 460 | lpfc_debugfs_disc_trc(vport, |
@@ -1471,7 +1471,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) | |||
1471 | pab->ab.EntryCnt++; | 1471 | pab->ab.EntryCnt++; |
1472 | size += FOURBYTES + len; | 1472 | size += FOURBYTES + len; |
1473 | 1473 | ||
1474 | if (phba->cfg_fdmi_on == 2) { | 1474 | if (vport->cfg_fdmi_on == 2) { |
1475 | /* #6 Port attribute entry */ | 1475 | /* #6 Port attribute entry */ |
1476 | ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) pab + | 1476 | ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) pab + |
1477 | size); | 1477 | size); |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index b8e048a467d2..4aed0cffe92f 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -518,7 +518,7 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
518 | * alpa map would take too long otherwise. | 518 | * alpa map would take too long otherwise. |
519 | */ | 519 | */ |
520 | if (phba->alpa_map[0] == 0) { | 520 | if (phba->alpa_map[0] == 0) { |
521 | phba->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; | 521 | vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; |
522 | } | 522 | } |
523 | 523 | ||
524 | /* FLOGI failure */ | 524 | /* FLOGI failure */ |
@@ -2640,7 +2640,7 @@ lpfc_els_disc_adisc(struct lpfc_vport *vport) | |||
2640 | sentadisc++; | 2640 | sentadisc++; |
2641 | vport->num_disc_nodes++; | 2641 | vport->num_disc_nodes++; |
2642 | if (vport->num_disc_nodes >= | 2642 | if (vport->num_disc_nodes >= |
2643 | vport->phba->cfg_discovery_threads) { | 2643 | vport->cfg_discovery_threads) { |
2644 | spin_lock_irq(shost->host_lock); | 2644 | spin_lock_irq(shost->host_lock); |
2645 | vport->fc_flag |= FC_NLP_MORE; | 2645 | vport->fc_flag |= FC_NLP_MORE; |
2646 | spin_unlock_irq(shost->host_lock); | 2646 | spin_unlock_irq(shost->host_lock); |
@@ -2675,7 +2675,7 @@ lpfc_els_disc_plogi(struct lpfc_vport *vport) | |||
2675 | sentplogi++; | 2675 | sentplogi++; |
2676 | vport->num_disc_nodes++; | 2676 | vport->num_disc_nodes++; |
2677 | if (vport->num_disc_nodes >= | 2677 | if (vport->num_disc_nodes >= |
2678 | vport->phba->cfg_discovery_threads) { | 2678 | vport->cfg_discovery_threads) { |
2679 | spin_lock_irq(shost->host_lock); | 2679 | spin_lock_irq(shost->host_lock); |
2680 | vport->fc_flag |= FC_NLP_MORE; | 2680 | vport->fc_flag |= FC_NLP_MORE; |
2681 | spin_unlock_irq(shost->host_lock); | 2681 | spin_unlock_irq(shost->host_lock); |
@@ -2841,7 +2841,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
2841 | * just ACC and ignore it. | 2841 | * just ACC and ignore it. |
2842 | */ | 2842 | */ |
2843 | if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && | 2843 | if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && |
2844 | !(phba->cfg_peer_port_login)) { | 2844 | !(vport->cfg_peer_port_login)) { |
2845 | i = payload_len; | 2845 | i = payload_len; |
2846 | datap = lp; | 2846 | datap = lp; |
2847 | while (i > 0) { | 2847 | while (i > 0) { |
@@ -4170,7 +4170,7 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport) | |||
4170 | return; | 4170 | return; |
4171 | } | 4171 | } |
4172 | 4172 | ||
4173 | if (phba->cfg_fdmi_on) { | 4173 | if (vport->cfg_fdmi_on) { |
4174 | ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool, | 4174 | ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool, |
4175 | GFP_KERNEL); | 4175 | GFP_KERNEL); |
4176 | if (ndlp_fdmi) { | 4176 | if (ndlp_fdmi) { |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 556d55fc9456..914e74ac11e5 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -2200,7 +2200,7 @@ lpfc_disc_list_loopmap(struct lpfc_vport *vport) | |||
2200 | /* If cfg_scan_down is set, start from highest | 2200 | /* If cfg_scan_down is set, start from highest |
2201 | * ALPA (0xef) to lowest (0x1). | 2201 | * ALPA (0xef) to lowest (0x1). |
2202 | */ | 2202 | */ |
2203 | if (phba->cfg_scan_down) | 2203 | if (vport->cfg_scan_down) |
2204 | index = j; | 2204 | index = j; |
2205 | else | 2205 | else |
2206 | index = FC_MAXLOOP - j - 1; | 2206 | index = FC_MAXLOOP - j - 1; |
@@ -2749,7 +2749,7 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
2749 | * fdmi-on=2 (supporting RPA/hostnmae) | 2749 | * fdmi-on=2 (supporting RPA/hostnmae) |
2750 | */ | 2750 | */ |
2751 | 2751 | ||
2752 | if (phba->cfg_fdmi_on == 1) | 2752 | if (vport->cfg_fdmi_on == 1) |
2753 | lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA); | 2753 | lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA); |
2754 | else | 2754 | else |
2755 | mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60); | 2755 | mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60); |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 484070c82974..83855a5a1826 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -1524,13 +1524,18 @@ lpfc_scsi_free(struct lpfc_hba *phba) | |||
1524 | } | 1524 | } |
1525 | 1525 | ||
1526 | struct lpfc_vport * | 1526 | struct lpfc_vport * |
1527 | lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) | 1527 | lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) |
1528 | { | 1528 | { |
1529 | struct lpfc_vport *vport; | 1529 | struct lpfc_vport *vport; |
1530 | struct Scsi_Host *shost; | 1530 | struct Scsi_Host *shost; |
1531 | int error = 0; | 1531 | int error = 0; |
1532 | 1532 | ||
1533 | shost = scsi_host_alloc(&lpfc_template, sizeof(struct lpfc_vport)); | 1533 | if (dev != &phba->pcidev->dev) |
1534 | shost = scsi_host_alloc(&lpfc_vport_template, | ||
1535 | sizeof(struct lpfc_vport)); | ||
1536 | else | ||
1537 | shost = scsi_host_alloc(&lpfc_template, | ||
1538 | sizeof(struct lpfc_vport)); | ||
1534 | if (!shost) | 1539 | if (!shost) |
1535 | goto out; | 1540 | goto out; |
1536 | 1541 | ||
@@ -1540,9 +1545,10 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) | |||
1540 | vport->load_flag |= FC_LOADING; | 1545 | vport->load_flag |= FC_LOADING; |
1541 | vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; | 1546 | vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; |
1542 | 1547 | ||
1548 | lpfc_get_vport_cfgparam(vport); | ||
1543 | shost->unique_id = instance; | 1549 | shost->unique_id = instance; |
1544 | shost->max_id = LPFC_MAX_TARGET; | 1550 | shost->max_id = LPFC_MAX_TARGET; |
1545 | shost->max_lun = phba->cfg_max_luns; | 1551 | shost->max_lun = vport->cfg_max_luns; |
1546 | shost->this_id = -1; | 1552 | shost->this_id = -1; |
1547 | shost->max_cmd_len = 16; | 1553 | shost->max_cmd_len = 16; |
1548 | /* | 1554 | /* |
@@ -1551,7 +1557,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) | |||
1551 | * max xri value determined in hba setup. | 1557 | * max xri value determined in hba setup. |
1552 | */ | 1558 | */ |
1553 | shost->can_queue = phba->cfg_hba_queue_depth - 10; | 1559 | shost->can_queue = phba->cfg_hba_queue_depth - 10; |
1554 | if (fc_vport != NULL) { | 1560 | if (dev != &phba->pcidev->dev) { |
1555 | shost->transportt = lpfc_vport_transport_template; | 1561 | shost->transportt = lpfc_vport_transport_template; |
1556 | vport->port_type = LPFC_NPIV_PORT; | 1562 | vport->port_type = LPFC_NPIV_PORT; |
1557 | } else { | 1563 | } else { |
@@ -1575,11 +1581,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) | |||
1575 | vport->els_tmofunc.function = lpfc_els_timeout; | 1581 | vport->els_tmofunc.function = lpfc_els_timeout; |
1576 | vport->els_tmofunc.data = (unsigned long)vport; | 1582 | vport->els_tmofunc.data = (unsigned long)vport; |
1577 | 1583 | ||
1578 | if (fc_vport != NULL) { | 1584 | error = scsi_add_host(shost, dev); |
1579 | error = scsi_add_host(shost, &fc_vport->dev); | ||
1580 | } else { | ||
1581 | error = scsi_add_host(shost, &phba->pcidev->dev); | ||
1582 | } | ||
1583 | if (error) | 1585 | if (error) |
1584 | goto out_put_shost; | 1586 | goto out_put_shost; |
1585 | 1587 | ||
@@ -1895,7 +1897,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1895 | /* Initialize list of fabric iocbs */ | 1897 | /* Initialize list of fabric iocbs */ |
1896 | INIT_LIST_HEAD(&phba->fabric_iocb_list); | 1898 | INIT_LIST_HEAD(&phba->fabric_iocb_list); |
1897 | 1899 | ||
1898 | vport = lpfc_create_port(phba, phba->brd_no, NULL); | 1900 | vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); |
1899 | if (!vport) | 1901 | if (!vport) |
1900 | goto out_kthread_stop; | 1902 | goto out_kthread_stop; |
1901 | 1903 | ||
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index bca2f5c9b4ba..9c159a8e6e8c 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c | |||
@@ -304,7 +304,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
304 | ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, | 304 | ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, |
305 | ndlp->nlp_rpi); | 305 | ndlp->nlp_rpi); |
306 | 306 | ||
307 | if (phba->cfg_fcp_class == 2 && sp->cls2.classValid) | 307 | if (vport->cfg_fcp_class == 2 && sp->cls2.classValid) |
308 | ndlp->nlp_fcp_info |= CLASS2; | 308 | ndlp->nlp_fcp_info |= CLASS2; |
309 | else | 309 | else |
310 | ndlp->nlp_fcp_info |= CLASS3; | 310 | ndlp->nlp_fcp_info |= CLASS3; |
@@ -392,7 +392,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
392 | } | 392 | } |
393 | 393 | ||
394 | if ((vport->port_type == LPFC_NPIV_PORT && | 394 | if ((vport->port_type == LPFC_NPIV_PORT && |
395 | phba->cfg_vport_restrict_login)) { | 395 | vport->cfg_restrict_login)) { |
396 | 396 | ||
397 | /* In order to preserve RPIs, we want to cleanup | 397 | /* In order to preserve RPIs, we want to cleanup |
398 | * the default RPI the firmware created to rcv | 398 | * the default RPI the firmware created to rcv |
@@ -564,10 +564,9 @@ static uint32_t | |||
564 | lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | 564 | lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
565 | { | 565 | { |
566 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 566 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
567 | struct lpfc_hba *phba = vport->phba; | ||
568 | 567 | ||
569 | /* Check config parameter use-adisc or FCP-2 */ | 568 | /* Check config parameter use-adisc or FCP-2 */ |
570 | if ((phba->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) || | 569 | if ((vport->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) || |
571 | ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) { | 570 | ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) { |
572 | spin_lock_irq(shost->host_lock); | 571 | spin_lock_irq(shost->host_lock); |
573 | ndlp->nlp_flag |= NLP_NPR_ADISC; | 572 | ndlp->nlp_flag |= NLP_NPR_ADISC; |
@@ -787,7 +786,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, | |||
787 | ndlp->nlp_DID, ndlp->nlp_state, | 786 | ndlp->nlp_DID, ndlp->nlp_state, |
788 | ndlp->nlp_flag, ndlp->nlp_rpi); | 787 | ndlp->nlp_flag, ndlp->nlp_rpi); |
789 | 788 | ||
790 | if (phba->cfg_fcp_class == 2 && (sp->cls2.classValid)) | 789 | if (vport->cfg_fcp_class == 2 && (sp->cls2.classValid)) |
791 | ndlp->nlp_fcp_info |= CLASS2; | 790 | ndlp->nlp_fcp_info |= CLASS2; |
792 | else | 791 | else |
793 | ndlp->nlp_fcp_info |= CLASS3; | 792 | ndlp->nlp_fcp_info |= CLASS3; |
@@ -1358,7 +1357,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1358 | irsp = &rspiocb->iocb; | 1357 | irsp = &rspiocb->iocb; |
1359 | if (irsp->ulpStatus) { | 1358 | if (irsp->ulpStatus) { |
1360 | if ((vport->port_type == LPFC_NPIV_PORT) && | 1359 | if ((vport->port_type == LPFC_NPIV_PORT) && |
1361 | phba->cfg_vport_restrict_login) { | 1360 | vport->cfg_restrict_login) { |
1362 | goto out; | 1361 | goto out; |
1363 | } | 1362 | } |
1364 | ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; | 1363 | ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; |
@@ -1380,7 +1379,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1380 | } | 1379 | } |
1381 | if (!(ndlp->nlp_type & NLP_FCP_TARGET) && | 1380 | if (!(ndlp->nlp_type & NLP_FCP_TARGET) && |
1382 | (vport->port_type == LPFC_NPIV_PORT) && | 1381 | (vport->port_type == LPFC_NPIV_PORT) && |
1383 | phba->cfg_vport_restrict_login) { | 1382 | vport->cfg_restrict_login) { |
1384 | out: | 1383 | out: |
1385 | spin_lock_irq(shost->host_lock); | 1384 | spin_lock_irq(shost->host_lock); |
1386 | ndlp->nlp_flag |= NLP_TARGET_REMOVE; | 1385 | ndlp->nlp_flag |= NLP_TARGET_REMOVE; |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 0284ded96bad..78666c62330e 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -84,22 +84,21 @@ lpfc_adjust_queue_depth(struct lpfc_hba *phba) | |||
84 | * SCSI command completion. | 84 | * SCSI command completion. |
85 | */ | 85 | */ |
86 | static inline void | 86 | static inline void |
87 | lpfc_rampup_queue_depth(struct lpfc_hba *phba, | 87 | lpfc_rampup_queue_depth(struct lpfc_vport *vport, |
88 | struct scsi_device *sdev) | 88 | struct scsi_device *sdev) |
89 | { | 89 | { |
90 | unsigned long flags; | 90 | unsigned long flags; |
91 | struct lpfc_hba *phba = vport->phba; | ||
91 | atomic_inc(&phba->num_cmd_success); | 92 | atomic_inc(&phba->num_cmd_success); |
92 | 93 | ||
93 | if (phba->cfg_lun_queue_depth <= sdev->queue_depth) | 94 | if (vport->cfg_lun_queue_depth <= sdev->queue_depth) |
94 | return; | 95 | return; |
95 | |||
96 | spin_lock_irqsave(&phba->hbalock, flags); | 96 | spin_lock_irqsave(&phba->hbalock, flags); |
97 | if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) || | 97 | if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) || |
98 | ((phba->last_rsrc_error_time + QUEUE_RAMP_UP_INTERVAL ) > jiffies)) { | 98 | ((phba->last_rsrc_error_time + QUEUE_RAMP_UP_INTERVAL ) > jiffies)) { |
99 | spin_unlock_irqrestore(&phba->hbalock, flags); | 99 | spin_unlock_irqrestore(&phba->hbalock, flags); |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | |||
103 | phba->last_ramp_up_time = jiffies; | 102 | phba->last_ramp_up_time = jiffies; |
104 | spin_unlock_irqrestore(&phba->hbalock, flags); | 103 | spin_unlock_irqrestore(&phba->hbalock, flags); |
105 | 104 | ||
@@ -627,16 +626,16 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
627 | 626 | ||
628 | 627 | ||
629 | if (!result) | 628 | if (!result) |
630 | lpfc_rampup_queue_depth(phba, sdev); | 629 | lpfc_rampup_queue_depth(vport, sdev); |
631 | 630 | ||
632 | if (!result && pnode != NULL && | 631 | if (!result && pnode != NULL && |
633 | ((jiffies - pnode->last_ramp_up_time) > | 632 | ((jiffies - pnode->last_ramp_up_time) > |
634 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && | 633 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && |
635 | ((jiffies - pnode->last_q_full_time) > | 634 | ((jiffies - pnode->last_q_full_time) > |
636 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && | 635 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && |
637 | (phba->cfg_lun_queue_depth > sdev->queue_depth)) { | 636 | (vport->cfg_lun_queue_depth > sdev->queue_depth)) { |
638 | shost_for_each_device(tmp_sdev, sdev->host) { | 637 | shost_for_each_device(tmp_sdev, sdev->host) { |
639 | if (phba->cfg_lun_queue_depth > tmp_sdev->queue_depth) { | 638 | if (vport->cfg_lun_queue_depth > tmp_sdev->queue_depth){ |
640 | if (tmp_sdev->id != sdev->id) | 639 | if (tmp_sdev->id != sdev->id) |
641 | continue; | 640 | continue; |
642 | if (tmp_sdev->ordered_tags) | 641 | if (tmp_sdev->ordered_tags) |
@@ -1099,7 +1098,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
1099 | 1098 | ||
1100 | schedule_timeout_uninterruptible(LPFC_ABORT_WAIT * HZ); | 1099 | schedule_timeout_uninterruptible(LPFC_ABORT_WAIT * HZ); |
1101 | if (++loop_count | 1100 | if (++loop_count |
1102 | > (2 * phba->cfg_devloss_tmo)/LPFC_ABORT_WAIT) | 1101 | > (2 * vport->cfg_devloss_tmo)/LPFC_ABORT_WAIT) |
1103 | break; | 1102 | break; |
1104 | } | 1103 | } |
1105 | 1104 | ||
@@ -1154,7 +1153,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) | |||
1154 | loopcnt++; | 1153 | loopcnt++; |
1155 | rdata = cmnd->device->hostdata; | 1154 | rdata = cmnd->device->hostdata; |
1156 | if (!rdata || | 1155 | if (!rdata || |
1157 | (loopcnt > ((phba->cfg_devloss_tmo * 2) + 1))) { | 1156 | (loopcnt > ((vport->cfg_devloss_tmo * 2) + 1))){ |
1158 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1157 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, |
1159 | "%d (%d):0721 LUN Reset rport " | 1158 | "%d (%d):0721 LUN Reset rport " |
1160 | "failure: cnt x%x rdata x%p\n", | 1159 | "failure: cnt x%x rdata x%p\n", |
@@ -1230,7 +1229,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) | |||
1230 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); | 1229 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); |
1231 | 1230 | ||
1232 | if (++loopcnt | 1231 | if (++loopcnt |
1233 | > (2 * phba->cfg_devloss_tmo)/LPFC_RESET_WAIT) | 1232 | > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT) |
1234 | break; | 1233 | break; |
1235 | 1234 | ||
1236 | cnt = lpfc_sli_sum_iocb(phba, | 1235 | cnt = lpfc_sli_sum_iocb(phba, |
@@ -1339,7 +1338,7 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) | |||
1339 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); | 1338 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); |
1340 | 1339 | ||
1341 | if (++loopcnt | 1340 | if (++loopcnt |
1342 | > (2 * phba->cfg_devloss_tmo)/LPFC_RESET_WAIT) | 1341 | > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT) |
1343 | break; | 1342 | break; |
1344 | 1343 | ||
1345 | cnt = lpfc_sli_sum_iocb(phba, | 1344 | cnt = lpfc_sli_sum_iocb(phba, |
@@ -1386,7 +1385,7 @@ lpfc_slave_alloc(struct scsi_device *sdev) | |||
1386 | * extra. This list of scsi bufs exists for the lifetime of the driver. | 1385 | * extra. This list of scsi bufs exists for the lifetime of the driver. |
1387 | */ | 1386 | */ |
1388 | total = phba->total_scsi_bufs; | 1387 | total = phba->total_scsi_bufs; |
1389 | num_to_alloc = phba->cfg_lun_queue_depth + 2; | 1388 | num_to_alloc = vport->cfg_lun_queue_depth + 2; |
1390 | 1389 | ||
1391 | /* Allow some exchanges to be available always to complete discovery */ | 1390 | /* Allow some exchanges to be available always to complete discovery */ |
1392 | if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { | 1391 | if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { |
@@ -1435,9 +1434,9 @@ lpfc_slave_configure(struct scsi_device *sdev) | |||
1435 | struct fc_rport *rport = starget_to_rport(sdev->sdev_target); | 1434 | struct fc_rport *rport = starget_to_rport(sdev->sdev_target); |
1436 | 1435 | ||
1437 | if (sdev->tagged_supported) | 1436 | if (sdev->tagged_supported) |
1438 | scsi_activate_tcq(sdev, phba->cfg_lun_queue_depth); | 1437 | scsi_activate_tcq(sdev, vport->cfg_lun_queue_depth); |
1439 | else | 1438 | else |
1440 | scsi_deactivate_tcq(sdev, phba->cfg_lun_queue_depth); | 1439 | scsi_deactivate_tcq(sdev, vport->cfg_lun_queue_depth); |
1441 | 1440 | ||
1442 | /* | 1441 | /* |
1443 | * Initialize the fc transport attributes for the target | 1442 | * Initialize the fc transport attributes for the target |
@@ -1445,7 +1444,7 @@ lpfc_slave_configure(struct scsi_device *sdev) | |||
1445 | * target pointer is stored in the starget_data for the | 1444 | * target pointer is stored in the starget_data for the |
1446 | * driver's sysfs entry point functions. | 1445 | * driver's sysfs entry point functions. |
1447 | */ | 1446 | */ |
1448 | rport->dev_loss_tmo = phba->cfg_devloss_tmo; | 1447 | rport->dev_loss_tmo = vport->cfg_devloss_tmo; |
1449 | 1448 | ||
1450 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { | 1449 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { |
1451 | lpfc_sli_poll_fcp_ring(phba); | 1450 | lpfc_sli_poll_fcp_ring(phba); |
@@ -1483,3 +1482,23 @@ struct scsi_host_template lpfc_template = { | |||
1483 | .shost_attrs = lpfc_hba_attrs, | 1482 | .shost_attrs = lpfc_hba_attrs, |
1484 | .max_sectors = 0xFFFF, | 1483 | .max_sectors = 0xFFFF, |
1485 | }; | 1484 | }; |
1485 | |||
1486 | struct scsi_host_template lpfc_vport_template = { | ||
1487 | .module = THIS_MODULE, | ||
1488 | .name = LPFC_DRIVER_NAME, | ||
1489 | .info = lpfc_info, | ||
1490 | .queuecommand = lpfc_queuecommand, | ||
1491 | .eh_abort_handler = lpfc_abort_handler, | ||
1492 | .eh_device_reset_handler= lpfc_device_reset_handler, | ||
1493 | .eh_bus_reset_handler = lpfc_bus_reset_handler, | ||
1494 | .slave_alloc = lpfc_slave_alloc, | ||
1495 | .slave_configure = lpfc_slave_configure, | ||
1496 | .slave_destroy = lpfc_slave_destroy, | ||
1497 | .scan_finished = lpfc_scan_finished, | ||
1498 | .this_id = -1, | ||
1499 | .sg_tablesize = LPFC_SG_SEG_CNT, | ||
1500 | .cmd_per_lun = LPFC_CMD_PER_LUN, | ||
1501 | .use_clustering = ENABLE_CLUSTERING, | ||
1502 | .shost_attrs = lpfc_vport_attrs, | ||
1503 | .max_sectors = 0xFFFF, | ||
1504 | }; | ||
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index e066855b0783..70e1bc34fd48 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c | |||
@@ -198,8 +198,8 @@ int | |||
198 | lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | 198 | lpfc_vport_create(struct fc_vport *fc_vport, bool disable) |
199 | { | 199 | { |
200 | struct lpfc_nodelist *ndlp; | 200 | struct lpfc_nodelist *ndlp; |
201 | struct lpfc_vport *pport = | 201 | struct Scsi_Host *shost = fc_vport->shost; |
202 | (struct lpfc_vport *) fc_vport->shost->hostdata; | 202 | struct lpfc_vport *pport = (struct lpfc_vport *) shost->hostdata; |
203 | struct lpfc_hba *phba = pport->phba; | 203 | struct lpfc_hba *phba = pport->phba; |
204 | struct lpfc_vport *vport = NULL; | 204 | struct lpfc_vport *vport = NULL; |
205 | int instance; | 205 | int instance; |
@@ -237,7 +237,7 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
237 | goto error_out; | 237 | goto error_out; |
238 | } | 238 | } |
239 | 239 | ||
240 | vport = lpfc_create_port(phba, instance, fc_vport); | 240 | vport = lpfc_create_port(phba, instance, &fc_vport->dev); |
241 | if (!vport) { | 241 | if (!vport) { |
242 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 242 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
243 | "%d:1811 Create VPORT failed: vpi x%x\n", | 243 | "%d:1811 Create VPORT failed: vpi x%x\n", |