aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_attr.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2007-08-02 11:10:09 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-08-01 13:21:26 -0400
commite8b62011d88d6fdba585fb2bb77c9274a63cadab (patch)
tree838c3abee73ec571456ae3ae83e51ecbed8e4a64 /drivers/scsi/lpfc/lpfc_attr.c
parent3de2a653a127c468284c48e233719dc39769e354 (diff)
[SCSI] lpfc 8.2.2 : Rework the lpfc_printf_log() macro
Rework the lpfc_printf_log() macro so that logging is enabled on a per-vport basis. Used to be on a physical-port basis, thus logging with large numbers of vports became a mess. Required redefinition of the macro, and an update of every use. 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.c110
1 files changed, 49 insertions, 61 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 61d251b1b03b..c1cedc3d1b70 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -319,9 +319,8 @@ lpfc_do_offline(struct lpfc_hba *phba, uint32_t type)
319 if (cnt++ > 3000) { 319 if (cnt++ > 3000) {
320 lpfc_printf_log(phba, 320 lpfc_printf_log(phba,
321 KERN_WARNING, LOG_INIT, 321 KERN_WARNING, LOG_INIT,
322 "%d:0466 Outstanding IO when " 322 "0466 Outstanding IO when "
323 "bringing Adapter offline\n", 323 "bringing Adapter offline\n");
324 phba->brd_no);
325 break; 324 break;
326 } 325 }
327 } 326 }
@@ -694,9 +693,8 @@ lpfc_##attr##_init(struct lpfc_hba *phba, int val) \
694 return 0;\ 693 return 0;\
695 }\ 694 }\
696 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ 695 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \
697 "%d:0449 lpfc_"#attr" attribute cannot be set to %d, "\ 696 "0449 lpfc_"#attr" attribute cannot be set to %d, "\
698 "allowed range is ["#minval", "#maxval"]\n", \ 697 "allowed range is ["#minval", "#maxval"]\n", val); \
699 phba->brd_no, val); \
700 phba->cfg_##attr = default;\ 698 phba->cfg_##attr = default;\
701 return -EINVAL;\ 699 return -EINVAL;\
702} 700}
@@ -710,9 +708,8 @@ lpfc_##attr##_set(struct lpfc_hba *phba, int val) \
710 return 0;\ 708 return 0;\
711 }\ 709 }\
712 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ 710 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \
713 "%d:0450 lpfc_"#attr" attribute cannot be set to %d, "\ 711 "0450 lpfc_"#attr" attribute cannot be set to %d, "\
714 "allowed range is ["#minval", "#maxval"]\n", \ 712 "allowed range is ["#minval", "#maxval"]\n", val); \
715 phba->brd_no, val); \
716 return -EINVAL;\ 713 return -EINVAL;\
717} 714}
718 715
@@ -764,10 +761,9 @@ lpfc_##attr##_init(struct lpfc_vport *vport, int val) \
764 vport->cfg_##attr = val;\ 761 vport->cfg_##attr = val;\
765 return 0;\ 762 return 0;\
766 }\ 763 }\
767 lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, \ 764 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \
768 "%d:0449 lpfc_"#attr" attribute cannot be set to %d, "\ 765 "0449 lpfc_"#attr" attribute cannot be set to %d, "\
769 "allowed range is ["#minval", "#maxval"]\n", \ 766 "allowed range is ["#minval", "#maxval"]\n", val); \
770 vport->phba->brd_no, val); \
771 vport->cfg_##attr = default;\ 767 vport->cfg_##attr = default;\
772 return -EINVAL;\ 768 return -EINVAL;\
773} 769}
@@ -780,10 +776,9 @@ lpfc_##attr##_set(struct lpfc_vport *vport, int val) \
780 vport->cfg_##attr = val;\ 776 vport->cfg_##attr = val;\
781 return 0;\ 777 return 0;\
782 }\ 778 }\
783 lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, \ 779 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \
784 "%d:0450 lpfc_"#attr" attribute cannot be set to %d, "\ 780 "0450 lpfc_"#attr" attribute cannot be set to %d, "\
785 "allowed range is ["#minval", "#maxval"]\n", \ 781 "allowed range is ["#minval", "#maxval"]\n", val); \
786 vport->phba->brd_no, val); \
787 return -EINVAL;\ 782 return -EINVAL;\
788} 783}
789 784
@@ -1023,17 +1018,15 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count)
1023 stat1 = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); 1018 stat1 = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
1024 if (stat1) 1019 if (stat1)
1025 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1020 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1026 "%d:0463 lpfc_soft_wwpn attribute set failed to reinit " 1021 "0463 lpfc_soft_wwpn attribute set failed to "
1027 "adapter - %d\n", phba->brd_no, stat1); 1022 "reinit adapter - %d\n", stat1);
1028
1029 init_completion(&online_compl); 1023 init_completion(&online_compl);
1030 lpfc_workq_post_event(phba, &stat2, &online_compl, LPFC_EVT_ONLINE); 1024 lpfc_workq_post_event(phba, &stat2, &online_compl, LPFC_EVT_ONLINE);
1031 wait_for_completion(&online_compl); 1025 wait_for_completion(&online_compl);
1032 if (stat2) 1026 if (stat2)
1033 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1027 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1034 "%d:0464 lpfc_soft_wwpn attribute set failed to reinit " 1028 "0464 lpfc_soft_wwpn attribute set failed to "
1035 "adapter - %d\n", phba->brd_no, stat2); 1029 "reinit adapter - %d\n", stat2);
1036
1037 return (stat1 || stat2) ? -EIO : count; 1030 return (stat1 || stat2) ? -EIO : count;
1038} 1031}
1039static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ 1032static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\
@@ -1145,11 +1138,10 @@ lpfc_nodev_tmo_init(struct lpfc_vport *vport, int val)
1145 if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { 1138 if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) {
1146 vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; 1139 vport->cfg_nodev_tmo = vport->cfg_devloss_tmo;
1147 if (val != LPFC_DEF_DEVLOSS_TMO) 1140 if (val != LPFC_DEF_DEVLOSS_TMO)
1148 lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, 1141 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1149 "%d (%d):0402 Ignoring nodev_tmo module" 1142 "0402 Ignoring nodev_tmo module "
1150 " parameter because devloss_tmo is" 1143 "parameter because devloss_tmo is "
1151 " set.\n", 1144 "set.\n");
1152 vport->phba->brd_no, vport->vpi);
1153 return 0; 1145 return 0;
1154 } 1146 }
1155 1147
@@ -1158,11 +1150,10 @@ lpfc_nodev_tmo_init(struct lpfc_vport *vport, int val)
1158 vport->cfg_devloss_tmo = val; 1150 vport->cfg_devloss_tmo = val;
1159 return 0; 1151 return 0;
1160 } 1152 }
1161 lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, 1153 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1162 "%d (%d):0400 lpfc_nodev_tmo attribute cannot be set to" 1154 "0400 lpfc_nodev_tmo attribute cannot be set to"
1163 " %d, allowed range is [%d, %d]\n", 1155 " %d, allowed range is [%d, %d]\n",
1164 vport->phba->brd_no, vport->vpi, val, 1156 val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO);
1165 LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO);
1166 vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; 1157 vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO;
1167 return -EINVAL; 1158 return -EINVAL;
1168} 1159}
@@ -1195,10 +1186,9 @@ lpfc_nodev_tmo_set(struct lpfc_vport *vport, int val)
1195{ 1186{
1196 if (vport->dev_loss_tmo_changed || 1187 if (vport->dev_loss_tmo_changed ||
1197 (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) { 1188 (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) {
1198 lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, 1189 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1199 "%d (%d):0401 Ignoring change to nodev_tmo " 1190 "0401 Ignoring change to nodev_tmo "
1200 "because devloss_tmo is set.\n", 1191 "because devloss_tmo is set.\n");
1201 vport->phba->brd_no, vport->vpi);
1202 return 0; 1192 return 0;
1203 } 1193 }
1204 if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { 1194 if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) {
@@ -1207,11 +1197,10 @@ lpfc_nodev_tmo_set(struct lpfc_vport *vport, int val)
1207 lpfc_update_rport_devloss_tmo(vport); 1197 lpfc_update_rport_devloss_tmo(vport);
1208 return 0; 1198 return 0;
1209 } 1199 }
1210 lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, 1200 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1211 "%d (%d):0403 lpfc_nodev_tmo attribute cannot be set to" 1201 "0403 lpfc_nodev_tmo attribute cannot be set to"
1212 "%d, allowed range is [%d, %d]\n", 1202 "%d, allowed range is [%d, %d]\n",
1213 vport->phba->brd_no, vport->vpi, val, 1203 val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO);
1214 LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO);
1215 return -EINVAL; 1204 return -EINVAL;
1216} 1205}
1217 1206
@@ -1243,11 +1232,10 @@ lpfc_devloss_tmo_set(struct lpfc_vport *vport, int val)
1243 return 0; 1232 return 0;
1244 } 1233 }
1245 1234
1246 lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, 1235 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1247 "%d:0404 lpfc_devloss_tmo attribute cannot be set to" 1236 "0404 lpfc_devloss_tmo attribute cannot be set to"
1248 " %d, allowed range is [%d, %d]\n", 1237 " %d, allowed range is [%d, %d]\n",
1249 vport->phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO, 1238 val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO);
1250 LPFC_MAX_DEVLOSS_TMO);
1251 return -EINVAL; 1239 return -EINVAL;
1252} 1240}
1253 1241
@@ -1273,7 +1261,8 @@ static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR,
1273# LOG_LIBDFC 0x2000 LIBDFC events 1261# LOG_LIBDFC 0x2000 LIBDFC events
1274# LOG_ALL_MSG 0xffff LOG all messages 1262# LOG_ALL_MSG 0xffff LOG all messages
1275*/ 1263*/
1276LPFC_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff, "Verbose logging bit-mask"); 1264LPFC_VPORT_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff,
1265 "Verbose logging bit-mask");
1277 1266
1278/* 1267/*
1279# lun_queue_depth: This parameter is used to limit the number of outstanding 1268# lun_queue_depth: This parameter is used to limit the number of outstanding
@@ -1326,10 +1315,10 @@ static int
1326lpfc_restrict_login_init(struct lpfc_vport *vport, int val) 1315lpfc_restrict_login_init(struct lpfc_vport *vport, int val)
1327{ 1316{
1328 if (val < 0 || val > 1) { 1317 if (val < 0 || val > 1) {
1329 lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, 1318 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1330 "%d:0449 lpfc_restrict_login attribute cannot " 1319 "0449 lpfc_restrict_login attribute cannot "
1331 "be set to %d, allowed range is [0, 1]\n", 1320 "be set to %d, allowed range is [0, 1]\n",
1332 vport->phba->brd_no, val); 1321 val);
1333 vport->cfg_restrict_login = 1; 1322 vport->cfg_restrict_login = 1;
1334 return -EINVAL; 1323 return -EINVAL;
1335 } 1324 }
@@ -1345,18 +1334,17 @@ static int
1345lpfc_restrict_login_set(struct lpfc_vport *vport, int val) 1334lpfc_restrict_login_set(struct lpfc_vport *vport, int val)
1346{ 1335{
1347 if (val < 0 || val > 1) { 1336 if (val < 0 || val > 1) {
1348 lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, 1337 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1349 "%d:0450 lpfc_restrict_login attribute cannot " 1338 "0450 lpfc_restrict_login attribute cannot "
1350 "be set to %d, allowed range is [0, 1]\n", 1339 "be set to %d, allowed range is [0, 1]\n",
1351 vport->phba->brd_no, val); 1340 val);
1352 vport->cfg_restrict_login = 1; 1341 vport->cfg_restrict_login = 1;
1353 return -EINVAL; 1342 return -EINVAL;
1354 } 1343 }
1355 if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { 1344 if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) {
1356 lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, 1345 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1357 "%d:0468 lpfc_restrict_login must be 0 for " 1346 "0468 lpfc_restrict_login must be 0 for "
1358 "Physical ports.\n", 1347 "Physical ports.\n");
1359 vport->phba->brd_no);
1360 vport->cfg_restrict_login = 0; 1348 vport->cfg_restrict_login = 0;
1361 return 0; 1349 return 0;
1362 } 1350 }
@@ -2435,7 +2423,6 @@ struct fc_function_template lpfc_vport_transport_functions = {
2435void 2423void
2436lpfc_get_cfgparam(struct lpfc_hba *phba) 2424lpfc_get_cfgparam(struct lpfc_hba *phba)
2437{ 2425{
2438 lpfc_log_verbose_init(phba, lpfc_log_verbose);
2439 lpfc_cr_delay_init(phba, lpfc_cr_delay); 2426 lpfc_cr_delay_init(phba, lpfc_cr_delay);
2440 lpfc_cr_count_init(phba, lpfc_cr_count); 2427 lpfc_cr_count_init(phba, lpfc_cr_count);
2441 lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support); 2428 lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support);
@@ -2469,6 +2456,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
2469void 2456void
2470lpfc_get_vport_cfgparam(struct lpfc_vport *vport) 2457lpfc_get_vport_cfgparam(struct lpfc_vport *vport)
2471{ 2458{
2459 lpfc_log_verbose_init(vport, lpfc_log_verbose);
2472 lpfc_lun_queue_depth_init(vport, lpfc_lun_queue_depth); 2460 lpfc_lun_queue_depth_init(vport, lpfc_lun_queue_depth);
2473 lpfc_devloss_tmo_init(vport, lpfc_devloss_tmo); 2461 lpfc_devloss_tmo_init(vport, lpfc_devloss_tmo);
2474 lpfc_nodev_tmo_init(vport, lpfc_nodev_tmo); 2462 lpfc_nodev_tmo_init(vport, lpfc_nodev_tmo);