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/scsi/lpfc/lpfc_attr.c | |
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/scsi/lpfc/lpfc_attr.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 354 |
1 files changed, 266 insertions, 88 deletions
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 | } |