From 549e55cd2a1b83ea45ac17fb6c309654a3d371a4 Mon Sep 17 00:00:00 2001 From: James Smart Date: Thu, 2 Aug 2007 11:09:51 -0400 Subject: [SCSI] lpfc 8.2.2 : Fix locking around HBA's port_list Cleans up a lot of bad behaviors that have been in this area a while Signed-off-by: James Smart Signed-off-by: James Bottomley --- drivers/scsi/lpfc/lpfc_attr.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'drivers/scsi/lpfc/lpfc_attr.c') diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 860a52c090f4..dbced066a361 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -1060,19 +1060,24 @@ lpfc_nodev_tmo_init(struct lpfc_hba *phba, int val) static void lpfc_update_rport_devloss_tmo(struct lpfc_hba *phba) { - struct lpfc_vport *vport; + struct lpfc_vport **vports; struct Scsi_Host *shost; struct lpfc_nodelist *ndlp; + int i; - list_for_each_entry(vport, &phba->port_list, listentry) { - shost = lpfc_shost_from_vport(vport); - spin_lock_irq(shost->host_lock); - list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) + vports = lpfc_create_vport_work_array(phba); + if (vports != NULL) + for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { + shost = lpfc_shost_from_vport(vports[i]); + spin_lock_irq(shost->host_lock); + list_for_each_entry(ndlp, &vports[i]->fc_nodes, + nlp_listp) if (ndlp->rport) ndlp->rport->dev_loss_tmo = - phba->cfg_devloss_tmo; - spin_unlock_irq(shost->host_lock); - } + phba->cfg_devloss_tmo; + spin_unlock_irq(shost->host_lock); + } + lpfc_destroy_vport_work_array(vports); } static int -- cgit v1.2.3 From 3de2a653a127c468284c48e233719dc39769e354 Mon Sep 17 00:00:00 2001 From: James Smart Date: Thu, 2 Aug 2007 11:09:59 -0400 Subject: [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 Signed-off-by: James Bottomley --- drivers/scsi/lpfc/lpfc.h | 34 ++-- drivers/scsi/lpfc/lpfc_attr.c | 354 ++++++++++++++++++++++++++++--------- drivers/scsi/lpfc/lpfc_crtn.h | 5 +- drivers/scsi/lpfc/lpfc_ct.c | 6 +- drivers/scsi/lpfc/lpfc_els.c | 10 +- drivers/scsi/lpfc/lpfc_hbadisc.c | 4 +- drivers/scsi/lpfc/lpfc_init.c | 22 +-- drivers/scsi/lpfc/lpfc_nportdisc.c | 13 +- drivers/scsi/lpfc/lpfc_scsi.c | 49 +++-- drivers/scsi/lpfc/lpfc_vport.c | 6 +- 10 files changed, 354 insertions(+), 149 deletions(-) (limited to 'drivers/scsi/lpfc/lpfc_attr.c') 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 { struct lpfc_debugfs_trc *disc_trc; atomic_t disc_trc_cnt; #endif + /* Vport Config Parameters */ + uint32_t cfg_scan_down; + uint32_t cfg_lun_queue_depth; + uint32_t cfg_nodev_tmo; + uint32_t cfg_devloss_tmo; + uint32_t cfg_restrict_login; + uint32_t cfg_peer_port_login; + uint32_t cfg_fcp_class; + uint32_t cfg_use_adisc; + uint32_t cfg_fdmi_on; + uint32_t cfg_discovery_threads; + uint32_t cfg_max_luns; + + uint32_t dev_loss_tmo_changed; }; struct hbq_s { @@ -413,28 +427,16 @@ struct lpfc_hba { uint8_t wwpn[8]; uint32_t RandomData[7]; - uint32_t cfg_log_verbose; - uint32_t cfg_lun_queue_depth; - uint32_t cfg_nodev_tmo; - uint32_t cfg_devloss_tmo; - uint32_t cfg_hba_queue_depth; - uint32_t cfg_peer_port_login; - uint32_t cfg_vport_restrict_login; - uint32_t cfg_npiv_enable; - uint32_t cfg_fcp_class; - uint32_t cfg_use_adisc; + /* HBA Config Parameters */ uint32_t cfg_ack0; + uint32_t cfg_npiv_enable; uint32_t cfg_topology; - uint32_t cfg_scan_down; uint32_t cfg_link_speed; uint32_t cfg_cr_delay; uint32_t cfg_cr_count; uint32_t cfg_multi_ring_support; uint32_t cfg_multi_ring_rctl; uint32_t cfg_multi_ring_type; - uint32_t cfg_fdmi_on; - uint32_t cfg_discovery_threads; - uint32_t cfg_max_luns; uint32_t cfg_poll; uint32_t cfg_poll_tmo; uint32_t cfg_use_msi; @@ -442,8 +444,10 @@ struct lpfc_hba { uint32_t cfg_sg_dma_buf_size; uint64_t cfg_soft_wwnn; uint64_t cfg_soft_wwpn; + uint32_t cfg_hba_queue_depth; - uint32_t dev_loss_tmo_changed; + /* Config paramters that should be in the vport */ + uint32_t cfg_log_verbose; lpfc_vpd_t vpd; /* vital product data */ 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) \ return -EINVAL;\ } +#define lpfc_vport_param_show(attr) \ +static ssize_t \ +lpfc_##attr##_show(struct class_device *cdev, char *buf) \ +{ \ + struct Scsi_Host *shost = class_to_shost(cdev);\ + struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ + int val = 0;\ + val = vport->cfg_##attr;\ + return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\ +} + +#define lpfc_vport_param_hex_show(attr) \ +static ssize_t \ +lpfc_##attr##_show(struct class_device *cdev, char *buf) \ +{ \ + struct Scsi_Host *shost = class_to_shost(cdev);\ + struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ + int val = 0;\ + val = vport->cfg_##attr;\ + return snprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\ +} + +#define lpfc_vport_param_init(attr, default, minval, maxval) \ +static int \ +lpfc_##attr##_init(struct lpfc_vport *vport, int val) \ +{ \ + if (val >= minval && val <= maxval) {\ + vport->cfg_##attr = val;\ + return 0;\ + }\ + lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, \ + "%d:0449 lpfc_"#attr" attribute cannot be set to %d, "\ + "allowed range is ["#minval", "#maxval"]\n", \ + vport->phba->brd_no, val); \ + vport->cfg_##attr = default;\ + return -EINVAL;\ +} + +#define lpfc_vport_param_set(attr, default, minval, maxval) \ +static int \ +lpfc_##attr##_set(struct lpfc_vport *vport, int val) \ +{ \ + if (val >= minval && val <= maxval) {\ + vport->cfg_##attr = val;\ + return 0;\ + }\ + lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, \ + "%d:0450 lpfc_"#attr" attribute cannot be set to %d, "\ + "allowed range is ["#minval", "#maxval"]\n", \ + vport->phba->brd_no, val); \ + return -EINVAL;\ +} + +#define lpfc_vport_param_store(attr) \ +static ssize_t \ +lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ +{ \ + struct Scsi_Host *shost = class_to_shost(cdev);\ + struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ + int val=0;\ + if (!isdigit(buf[0]))\ + return -EINVAL;\ + if (sscanf(buf, "%i", &val) != 1)\ + return -EINVAL;\ + if (lpfc_##attr##_set(vport, val) == 0) \ + return strlen(buf);\ + else \ + return -EINVAL;\ +} + + #define LPFC_ATTR(name, defval, minval, maxval, desc) \ static int lpfc_##name = defval;\ module_param(lpfc_##name, int, 0);\ @@ -778,6 +849,50 @@ lpfc_param_store(name)\ static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ lpfc_##name##_show, lpfc_##name##_store) +#define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \ +static int lpfc_##name = defval;\ +module_param(lpfc_##name, int, 0);\ +MODULE_PARM_DESC(lpfc_##name, desc);\ +lpfc_vport_param_init(name, defval, minval, maxval) + +#define LPFC_VPORT_ATTR_R(name, defval, minval, maxval, desc) \ +static int lpfc_##name = defval;\ +module_param(lpfc_##name, int, 0);\ +MODULE_PARM_DESC(lpfc_##name, desc);\ +lpfc_vport_param_show(name)\ +lpfc_vport_param_init(name, defval, minval, maxval)\ +static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) + +#define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \ +static int lpfc_##name = defval;\ +module_param(lpfc_##name, int, 0);\ +MODULE_PARM_DESC(lpfc_##name, desc);\ +lpfc_vport_param_show(name)\ +lpfc_vport_param_init(name, defval, minval, maxval)\ +lpfc_vport_param_set(name, defval, minval, maxval)\ +lpfc_vport_param_store(name)\ +static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ + lpfc_##name##_show, lpfc_##name##_store) + +#define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \ +static int lpfc_##name = defval;\ +module_param(lpfc_##name, int, 0);\ +MODULE_PARM_DESC(lpfc_##name, desc);\ +lpfc_vport_param_hex_show(name)\ +lpfc_vport_param_init(name, defval, minval, maxval)\ +static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) + +#define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \ +static int lpfc_##name = defval;\ +module_param(lpfc_##name, int, 0);\ +MODULE_PARM_DESC(lpfc_##name, desc);\ +lpfc_vport_param_hex_show(name)\ +lpfc_vport_param_init(name, defval, minval, maxval)\ +lpfc_vport_param_set(name, defval, minval, maxval)\ +lpfc_vport_param_store(name)\ +static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ + lpfc_##name##_show, lpfc_##name##_store) + static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); 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) { struct Scsi_Host *shost = class_to_shost(cdev); struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; - struct lpfc_hba *phba = vport->phba; int val = 0; - val = phba->cfg_devloss_tmo; - return snprintf(buf, PAGE_SIZE, "%d\n", - phba->cfg_devloss_tmo); + val = vport->cfg_devloss_tmo; + return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); } static int -lpfc_nodev_tmo_init(struct lpfc_hba *phba, int val) -{ - static int warned; - if (phba->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { - phba->cfg_nodev_tmo = phba->cfg_devloss_tmo; - if (!warned && val != LPFC_DEF_DEVLOSS_TMO) { - warned = 1; - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0402 Ignoring nodev_tmo module " - "parameter because devloss_tmo is" +lpfc_nodev_tmo_init(struct lpfc_vport *vport, int val) +{ + if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { + vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; + if (val != LPFC_DEF_DEVLOSS_TMO) + lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, + "%d (%d):0402 Ignoring nodev_tmo module" + " parameter because devloss_tmo is" " set.\n", - phba->brd_no); - } + vport->phba->brd_no, vport->vpi); return 0; } if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { - phba->cfg_nodev_tmo = val; - phba->cfg_devloss_tmo = val; + vport->cfg_nodev_tmo = val; + vport->cfg_devloss_tmo = val; return 0; } - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0400 lpfc_nodev_tmo attribute cannot be set to %d, " - "allowed range is [%d, %d]\n", - phba->brd_no, val, + lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, + "%d (%d):0400 lpfc_nodev_tmo attribute cannot be set to" + " %d, allowed range is [%d, %d]\n", + vport->phba->brd_no, vport->vpi, val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); - phba->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; + vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; return -EINVAL; } static void -lpfc_update_rport_devloss_tmo(struct lpfc_hba *phba) +lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) { struct lpfc_vport **vports; struct Scsi_Host *shost; struct lpfc_nodelist *ndlp; int i; - vports = lpfc_create_vport_work_array(phba); + vports = lpfc_create_vport_work_array(vport->phba); if (vports != NULL) for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { shost = lpfc_shost_from_vport(vports[i]); @@ -1074,40 +1184,38 @@ lpfc_update_rport_devloss_tmo(struct lpfc_hba *phba) nlp_listp) if (ndlp->rport) ndlp->rport->dev_loss_tmo = - phba->cfg_devloss_tmo; + vport->cfg_devloss_tmo; spin_unlock_irq(shost->host_lock); } lpfc_destroy_vport_work_array(vports); } static int -lpfc_nodev_tmo_set(struct lpfc_hba *phba, int val) +lpfc_nodev_tmo_set(struct lpfc_vport *vport, int val) { - if (phba->dev_loss_tmo_changed || - (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0401 Ignoring change to nodev_tmo " + if (vport->dev_loss_tmo_changed || + (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) { + lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, + "%d (%d):0401 Ignoring change to nodev_tmo " "because devloss_tmo is set.\n", - phba->brd_no); + vport->phba->brd_no, vport->vpi); return 0; } - if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { - phba->cfg_nodev_tmo = val; - phba->cfg_devloss_tmo = val; - lpfc_update_rport_devloss_tmo(phba); + vport->cfg_nodev_tmo = val; + vport->cfg_devloss_tmo = val; + lpfc_update_rport_devloss_tmo(vport); return 0; } - - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0403 lpfc_nodev_tmo attribute cannot be set to %d, " - "allowed range is [%d, %d]\n", - phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO, - LPFC_MAX_DEVLOSS_TMO); + lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, + "%d (%d):0403 lpfc_nodev_tmo attribute cannot be set to" + "%d, allowed range is [%d, %d]\n", + vport->phba->brd_no, vport->vpi, val, + LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); return -EINVAL; } -lpfc_param_store(nodev_tmo) +lpfc_vport_param_store(nodev_tmo) static CLASS_DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR, lpfc_nodev_tmo_show, lpfc_nodev_tmo_store); @@ -1121,29 +1229,29 @@ module_param(lpfc_devloss_tmo, int, 0); MODULE_PARM_DESC(lpfc_devloss_tmo, "Seconds driver will hold I/O waiting " "for a device to come back"); -lpfc_param_init(devloss_tmo, LPFC_DEF_DEVLOSS_TMO, - LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO) -lpfc_param_show(devloss_tmo) +lpfc_vport_param_init(devloss_tmo, LPFC_DEF_DEVLOSS_TMO, + LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO) +lpfc_vport_param_show(devloss_tmo) static int -lpfc_devloss_tmo_set(struct lpfc_hba *phba, int val) +lpfc_devloss_tmo_set(struct lpfc_vport *vport, int val) { if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { - phba->cfg_nodev_tmo = val; - phba->cfg_devloss_tmo = val; - phba->dev_loss_tmo_changed = 1; - lpfc_update_rport_devloss_tmo(phba); + vport->cfg_nodev_tmo = val; + vport->cfg_devloss_tmo = val; + vport->dev_loss_tmo_changed = 1; + lpfc_update_rport_devloss_tmo(vport); return 0; } - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, + lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, "%d:0404 lpfc_devloss_tmo attribute cannot be set to" " %d, allowed range is [%d, %d]\n", - phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO, + vport->phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); return -EINVAL; } -lpfc_param_store(devloss_tmo) +lpfc_vport_param_store(devloss_tmo) static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, lpfc_devloss_tmo_show, lpfc_devloss_tmo_store); @@ -1171,8 +1279,8 @@ LPFC_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff, "Verbose logging bit-mask"); # lun_queue_depth: This parameter is used to limit the number of outstanding # commands per FCP LUN. Value range is [1,128]. Default value is 30. */ -LPFC_ATTR_R(lun_queue_depth, 30, 1, 128, - "Max number of FCP commands we can queue to a specific LUN"); +LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 128, + "Max number of FCP commands we can queue to a specific LUN"); /* # 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, # are allowed to login to each other. # Default value of this parameter is 0. */ -LPFC_ATTR_R(peer_port_login, 0, 0, 1, - "Allow peer ports on the same physical port to login to each " - "other."); +LPFC_VPORT_ATTR_R(peer_port_login, 0, 0, 1, + "Allow peer ports on the same physical port to login to each " + "other."); /* -# vport_restrict_login: This parameter allows/prevents logins +# restrict_login: This parameter allows/prevents logins # between Virtual Ports and remote initiators. # When this parameter is not set (0) Virtual Ports will accept PLOGIs from # other initiators and will attempt to PLOGI all remote ports. @@ -1208,8 +1316,56 @@ LPFC_ATTR_R(peer_port_login, 0, 0, 1, # This parameter does not restrict logins to Fabric resident remote ports. # Default value of this parameter is 1. */ -LPFC_ATTR_RW(vport_restrict_login, 1, 0, 1, - "Restrict virtual ports login to remote initiators."); +static int lpfc_restrict_login = 1; +module_param(lpfc_restrict_login, int, 0); +MODULE_PARM_DESC(lpfc_restrict_login, + "Restrict virtual ports login to remote initiators."); +lpfc_vport_param_show(restrict_login); + +static int +lpfc_restrict_login_init(struct lpfc_vport *vport, int val) +{ + if (val < 0 || val > 1) { + lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, + "%d:0449 lpfc_restrict_login attribute cannot " + "be set to %d, allowed range is [0, 1]\n", + vport->phba->brd_no, val); + vport->cfg_restrict_login = 1; + return -EINVAL; + } + if (vport->port_type == LPFC_PHYSICAL_PORT) { + vport->cfg_restrict_login = 0; + return 0; + } + vport->cfg_restrict_login = val; + return 0; +} + +static int +lpfc_restrict_login_set(struct lpfc_vport *vport, int val) +{ + if (val < 0 || val > 1) { + lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, + "%d:0450 lpfc_restrict_login attribute cannot " + "be set to %d, allowed range is [0, 1]\n", + vport->phba->brd_no, val); + vport->cfg_restrict_login = 1; + return -EINVAL; + } + if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { + lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, + "%d:0468 lpfc_restrict_login must be 0 for " + "Physical ports.\n", + vport->phba->brd_no); + vport->cfg_restrict_login = 0; + return 0; + } + vport->cfg_restrict_login = val; + return 0; +} +lpfc_vport_param_store(restrict_login); +static CLASS_DEVICE_ATTR(lpfc_restrict_login, S_IRUGO | S_IWUSR, + lpfc_restrict_login_show, lpfc_restrict_login_store); /* # Some disk devices have a "select ID" or "select Target" capability. @@ -1228,8 +1384,8 @@ LPFC_ATTR_RW(vport_restrict_login, 1, 0, 1, # and will not work across a fabric. Also this parameter will take # effect only in the case when ALPA map is not available.) */ -LPFC_ATTR_R(scan_down, 1, 0, 1, - "Start scanning for devices from highest ALPA to lowest"); +LPFC_VPORT_ATTR_R(scan_down, 1, 0, 1, + "Start scanning for devices from highest ALPA to lowest"); /* # lpfc_topology: link topology for init link @@ -1260,15 +1416,15 @@ LPFC_ATTR_R(link_speed, 0, 0, 8, "Select link speed"); # lpfc_fcp_class: Determines FC class to use for the FCP protocol. # Value range is [2,3]. Default value is 3. */ -LPFC_ATTR_R(fcp_class, 3, 2, 3, - "Select Fibre Channel class of service for FCP sequences"); +LPFC_VPORT_ATTR_R(fcp_class, 3, 2, 3, + "Select Fibre Channel class of service for FCP sequences"); /* # lpfc_use_adisc: Use ADISC for FCP rediscovery instead of PLOGI. Value range # is [0,1]. Default value is 0. */ -LPFC_ATTR_RW(use_adisc, 0, 0, 1, - "Use ADISC on rediscovery to authenticate FCP devices"); +LPFC_VPORT_ATTR_RW(use_adisc, 0, 0, 1, + "Use ADISC on rediscovery to authenticate FCP devices"); /* # 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, # 2 = support FDMI with attribute of hostname # Value range [0,2]. Default value is 0. */ -LPFC_ATTR_RW(fdmi_on, 0, 0, 2, "Enable FDMI support"); +LPFC_VPORT_ATTR_RW(fdmi_on, 0, 0, 2, "Enable FDMI support"); /* # Specifies the maximum number of ELS cmds we can have outstanding (for # discovery). Value range is [1,64]. Default value = 32. */ -LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " +LPFC_VPORT_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " "during discovery"); /* @@ -1334,8 +1490,7 @@ LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " # Value range is [0,65535]. Default value is 255. # NOTE: The SCSI layer might probe all allowed LUN on some old targets. */ -LPFC_ATTR_R(max_luns, 255, 0, 65535, - "Maximum allowed LUN"); +LPFC_VPORT_ATTR_R(max_luns, 255, 0, 65535, "Maximum allowed LUN"); /* # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. @@ -1372,7 +1527,6 @@ struct class_device_attribute *lpfc_hba_attrs[] = { &class_device_attr_lpfc_lun_queue_depth, &class_device_attr_lpfc_hba_queue_depth, &class_device_attr_lpfc_peer_port_login, - &class_device_attr_lpfc_vport_restrict_login, &class_device_attr_lpfc_nodev_tmo, &class_device_attr_lpfc_devloss_tmo, &class_device_attr_lpfc_fcp_class, @@ -1409,6 +1563,29 @@ struct class_device_attribute *lpfc_hba_attrs[] = { NULL, }; +struct class_device_attribute *lpfc_vport_attrs[] = { + &class_device_attr_info, + &class_device_attr_state, + &class_device_attr_num_discovered_ports, + &class_device_attr_lpfc_drvr_version, + + &class_device_attr_lpfc_log_verbose, + &class_device_attr_lpfc_lun_queue_depth, + &class_device_attr_lpfc_nodev_tmo, + &class_device_attr_lpfc_devloss_tmo, + &class_device_attr_lpfc_hba_queue_depth, + &class_device_attr_lpfc_peer_port_login, + &class_device_attr_lpfc_restrict_login, + &class_device_attr_lpfc_fcp_class, + &class_device_attr_lpfc_use_adisc, + &class_device_attr_lpfc_fdmi_on, + &class_device_attr_lpfc_max_luns, + &class_device_attr_nport_evt_cnt, + &class_device_attr_management_version, + &class_device_attr_npiv_info, + NULL, +}; + static ssize_t sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) @@ -2264,33 +2441,20 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support); lpfc_multi_ring_rctl_init(phba, lpfc_multi_ring_rctl); lpfc_multi_ring_type_init(phba, lpfc_multi_ring_type); - lpfc_lun_queue_depth_init(phba, lpfc_lun_queue_depth); - lpfc_fcp_class_init(phba, lpfc_fcp_class); - lpfc_use_adisc_init(phba, lpfc_use_adisc); lpfc_ack0_init(phba, lpfc_ack0); lpfc_topology_init(phba, lpfc_topology); - lpfc_scan_down_init(phba, lpfc_scan_down); lpfc_link_speed_init(phba, lpfc_link_speed); - lpfc_fdmi_on_init(phba, lpfc_fdmi_on); - lpfc_discovery_threads_init(phba, lpfc_discovery_threads); - lpfc_max_luns_init(phba, lpfc_max_luns); lpfc_poll_tmo_init(phba, lpfc_poll_tmo); - lpfc_peer_port_login_init(phba, lpfc_peer_port_login); lpfc_npiv_enable_init(phba, lpfc_npiv_enable); - lpfc_vport_restrict_login_init(phba, lpfc_vport_restrict_login); lpfc_use_msi_init(phba, lpfc_use_msi); - lpfc_devloss_tmo_init(phba, lpfc_devloss_tmo); - lpfc_nodev_tmo_init(phba, lpfc_nodev_tmo); phba->cfg_poll = lpfc_poll; phba->cfg_soft_wwnn = 0L; phba->cfg_soft_wwpn = 0L; - /* * The total number of segments is the configuration value plus 2 * since the IOCB need a command and response bde. */ phba->cfg_sg_seg_cnt = LPFC_SG_SEG_CNT + 2; - /* * Since the sg_tablesize is module parameter, the sg_dma_buf_size * used to create the sg_dma_buf_pool must be dynamically calculated @@ -2298,9 +2462,23 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + sizeof(struct fcp_rsp) + (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64)); - - lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); + return; +} +void +lpfc_get_vport_cfgparam(struct lpfc_vport *vport) +{ + lpfc_lun_queue_depth_init(vport, lpfc_lun_queue_depth); + lpfc_devloss_tmo_init(vport, lpfc_devloss_tmo); + lpfc_nodev_tmo_init(vport, lpfc_nodev_tmo); + lpfc_peer_port_login_init(vport, lpfc_peer_port_login); + lpfc_restrict_login_init(vport, lpfc_restrict_login); + lpfc_fcp_class_init(vport, lpfc_fcp_class); + lpfc_use_adisc_init(vport, lpfc_use_adisc); + lpfc_fdmi_on_init(vport, lpfc_fdmi_on); + lpfc_discovery_threads_init(vport, lpfc_discovery_threads); + lpfc_max_luns_init(vport, lpfc_max_luns); + lpfc_scan_down_init(vport, lpfc_scan_down); return; } 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 *); int lpfc_scan_finished(struct Scsi_Host *, unsigned long); void lpfc_get_cfgparam(struct lpfc_hba *); +void lpfc_get_vport_cfgparam(struct lpfc_vport *); int lpfc_alloc_sysfs_attr(struct lpfc_vport *); void lpfc_free_sysfs_attr(struct lpfc_vport *); extern struct class_device_attribute *lpfc_hba_attrs[]; +extern struct class_device_attribute *lpfc_vport_attrs[]; extern struct scsi_host_template lpfc_template; +extern struct scsi_host_template lpfc_vport_template; extern struct fc_function_template lpfc_transport_functions; extern struct fc_function_template lpfc_vport_transport_functions; extern int lpfc_sli_mode; @@ -262,7 +265,7 @@ int lpfc_vport_symbolic_node_name(struct lpfc_vport *, char *, size_t); void lpfc_terminate_rport_io(struct fc_rport *); void lpfc_dev_loss_tmo_callbk(struct fc_rport *rport); -struct lpfc_vport *lpfc_create_port(struct lpfc_hba *, int, struct fc_vport *); +struct lpfc_vport *lpfc_create_port(struct lpfc_hba *, int, struct device *); int lpfc_vport_disable(struct fc_vport *fc_vport, bool disable); void lpfc_mbx_unreg_vpi(struct lpfc_vport *); 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) */ if ((Did != vport->fc_myDID) && ((lpfc_find_vport_by_did(phba, Did) == NULL) || - phba->cfg_peer_port_login)) { + vport->cfg_peer_port_login)) { if ((vport->port_type != LPFC_NPIV_PORT) || (vport->fc_flag & FC_RFF_NOT_SUPPORTED) || - (!phba->cfg_vport_restrict_login)) { + (!vport->cfg_restrict_login)) { ndlp = lpfc_setup_disc_node(vport, Did); if (ndlp) { lpfc_debugfs_disc_trc(vport, @@ -1471,7 +1471,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) pab->ab.EntryCnt++; size += FOURBYTES + len; - if (phba->cfg_fdmi_on == 2) { + if (vport->cfg_fdmi_on == 2) { /* #6 Port attribute entry */ ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) pab + 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, * alpa map would take too long otherwise. */ if (phba->alpa_map[0] == 0) { - phba->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; + vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; } /* FLOGI failure */ @@ -2640,7 +2640,7 @@ lpfc_els_disc_adisc(struct lpfc_vport *vport) sentadisc++; vport->num_disc_nodes++; if (vport->num_disc_nodes >= - vport->phba->cfg_discovery_threads) { + vport->cfg_discovery_threads) { spin_lock_irq(shost->host_lock); vport->fc_flag |= FC_NLP_MORE; spin_unlock_irq(shost->host_lock); @@ -2675,7 +2675,7 @@ lpfc_els_disc_plogi(struct lpfc_vport *vport) sentplogi++; vport->num_disc_nodes++; if (vport->num_disc_nodes >= - vport->phba->cfg_discovery_threads) { + vport->cfg_discovery_threads) { spin_lock_irq(shost->host_lock); vport->fc_flag |= FC_NLP_MORE; spin_unlock_irq(shost->host_lock); @@ -2841,7 +2841,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, * just ACC and ignore it. */ if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && - !(phba->cfg_peer_port_login)) { + !(vport->cfg_peer_port_login)) { i = payload_len; datap = lp; while (i > 0) { @@ -4170,7 +4170,7 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport) return; } - if (phba->cfg_fdmi_on) { + if (vport->cfg_fdmi_on) { ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); 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) /* If cfg_scan_down is set, start from highest * ALPA (0xef) to lowest (0x1). */ - if (phba->cfg_scan_down) + if (vport->cfg_scan_down) index = j; else index = FC_MAXLOOP - j - 1; @@ -2749,7 +2749,7 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) * fdmi-on=2 (supporting RPA/hostnmae) */ - if (phba->cfg_fdmi_on == 1) + if (vport->cfg_fdmi_on == 1) lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA); else 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) } struct lpfc_vport * -lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) +lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) { struct lpfc_vport *vport; struct Scsi_Host *shost; int error = 0; - shost = scsi_host_alloc(&lpfc_template, sizeof(struct lpfc_vport)); + if (dev != &phba->pcidev->dev) + shost = scsi_host_alloc(&lpfc_vport_template, + sizeof(struct lpfc_vport)); + else + shost = scsi_host_alloc(&lpfc_template, + sizeof(struct lpfc_vport)); if (!shost) goto out; @@ -1540,9 +1545,10 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) vport->load_flag |= FC_LOADING; vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; + lpfc_get_vport_cfgparam(vport); shost->unique_id = instance; shost->max_id = LPFC_MAX_TARGET; - shost->max_lun = phba->cfg_max_luns; + shost->max_lun = vport->cfg_max_luns; shost->this_id = -1; shost->max_cmd_len = 16; /* @@ -1551,7 +1557,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) * max xri value determined in hba setup. */ shost->can_queue = phba->cfg_hba_queue_depth - 10; - if (fc_vport != NULL) { + if (dev != &phba->pcidev->dev) { shost->transportt = lpfc_vport_transport_template; vport->port_type = LPFC_NPIV_PORT; } else { @@ -1575,11 +1581,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) vport->els_tmofunc.function = lpfc_els_timeout; vport->els_tmofunc.data = (unsigned long)vport; - if (fc_vport != NULL) { - error = scsi_add_host(shost, &fc_vport->dev); - } else { - error = scsi_add_host(shost, &phba->pcidev->dev); - } + error = scsi_add_host(shost, dev); if (error) goto out_put_shost; @@ -1895,7 +1897,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) /* Initialize list of fabric iocbs */ INIT_LIST_HEAD(&phba->fabric_iocb_list); - vport = lpfc_create_port(phba, phba->brd_no, NULL); + vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); if (!vport) goto out_kthread_stop; 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, ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, ndlp->nlp_rpi); - if (phba->cfg_fcp_class == 2 && sp->cls2.classValid) + if (vport->cfg_fcp_class == 2 && sp->cls2.classValid) ndlp->nlp_fcp_info |= CLASS2; else ndlp->nlp_fcp_info |= CLASS3; @@ -392,7 +392,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, } if ((vport->port_type == LPFC_NPIV_PORT && - phba->cfg_vport_restrict_login)) { + vport->cfg_restrict_login)) { /* In order to preserve RPIs, we want to cleanup * the default RPI the firmware created to rcv @@ -564,10 +564,9 @@ static uint32_t lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) { struct Scsi_Host *shost = lpfc_shost_from_vport(vport); - struct lpfc_hba *phba = vport->phba; /* Check config parameter use-adisc or FCP-2 */ - if ((phba->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) || + if ((vport->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) || ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) { spin_lock_irq(shost->host_lock); ndlp->nlp_flag |= NLP_NPR_ADISC; @@ -787,7 +786,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, ndlp->nlp_rpi); - if (phba->cfg_fcp_class == 2 && (sp->cls2.classValid)) + if (vport->cfg_fcp_class == 2 && (sp->cls2.classValid)) ndlp->nlp_fcp_info |= CLASS2; else ndlp->nlp_fcp_info |= CLASS3; @@ -1358,7 +1357,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, irsp = &rspiocb->iocb; if (irsp->ulpStatus) { if ((vport->port_type == LPFC_NPIV_PORT) && - phba->cfg_vport_restrict_login) { + vport->cfg_restrict_login) { goto out; } 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, } if (!(ndlp->nlp_type & NLP_FCP_TARGET) && (vport->port_type == LPFC_NPIV_PORT) && - phba->cfg_vport_restrict_login) { + vport->cfg_restrict_login) { out: spin_lock_irq(shost->host_lock); 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) * SCSI command completion. */ static inline void -lpfc_rampup_queue_depth(struct lpfc_hba *phba, +lpfc_rampup_queue_depth(struct lpfc_vport *vport, struct scsi_device *sdev) { unsigned long flags; + struct lpfc_hba *phba = vport->phba; atomic_inc(&phba->num_cmd_success); - if (phba->cfg_lun_queue_depth <= sdev->queue_depth) + if (vport->cfg_lun_queue_depth <= sdev->queue_depth) return; - spin_lock_irqsave(&phba->hbalock, flags); if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) || ((phba->last_rsrc_error_time + QUEUE_RAMP_UP_INTERVAL ) > jiffies)) { spin_unlock_irqrestore(&phba->hbalock, flags); return; } - phba->last_ramp_up_time = jiffies; spin_unlock_irqrestore(&phba->hbalock, flags); @@ -627,16 +626,16 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, if (!result) - lpfc_rampup_queue_depth(phba, sdev); + lpfc_rampup_queue_depth(vport, sdev); if (!result && pnode != NULL && ((jiffies - pnode->last_ramp_up_time) > LPFC_Q_RAMP_UP_INTERVAL * HZ) && ((jiffies - pnode->last_q_full_time) > LPFC_Q_RAMP_UP_INTERVAL * HZ) && - (phba->cfg_lun_queue_depth > sdev->queue_depth)) { + (vport->cfg_lun_queue_depth > sdev->queue_depth)) { shost_for_each_device(tmp_sdev, sdev->host) { - if (phba->cfg_lun_queue_depth > tmp_sdev->queue_depth) { + if (vport->cfg_lun_queue_depth > tmp_sdev->queue_depth){ if (tmp_sdev->id != sdev->id) continue; if (tmp_sdev->ordered_tags) @@ -1099,7 +1098,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) schedule_timeout_uninterruptible(LPFC_ABORT_WAIT * HZ); if (++loop_count - > (2 * phba->cfg_devloss_tmo)/LPFC_ABORT_WAIT) + > (2 * vport->cfg_devloss_tmo)/LPFC_ABORT_WAIT) break; } @@ -1154,7 +1153,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) loopcnt++; rdata = cmnd->device->hostdata; if (!rdata || - (loopcnt > ((phba->cfg_devloss_tmo * 2) + 1))) { + (loopcnt > ((vport->cfg_devloss_tmo * 2) + 1))){ lpfc_printf_log(phba, KERN_ERR, LOG_FCP, "%d (%d):0721 LUN Reset rport " "failure: cnt x%x rdata x%p\n", @@ -1230,7 +1229,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); if (++loopcnt - > (2 * phba->cfg_devloss_tmo)/LPFC_RESET_WAIT) + > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT) break; cnt = lpfc_sli_sum_iocb(phba, @@ -1339,7 +1338,7 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); if (++loopcnt - > (2 * phba->cfg_devloss_tmo)/LPFC_RESET_WAIT) + > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT) break; cnt = lpfc_sli_sum_iocb(phba, @@ -1386,7 +1385,7 @@ lpfc_slave_alloc(struct scsi_device *sdev) * extra. This list of scsi bufs exists for the lifetime of the driver. */ total = phba->total_scsi_bufs; - num_to_alloc = phba->cfg_lun_queue_depth + 2; + num_to_alloc = vport->cfg_lun_queue_depth + 2; /* Allow some exchanges to be available always to complete discovery */ if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { @@ -1435,9 +1434,9 @@ lpfc_slave_configure(struct scsi_device *sdev) struct fc_rport *rport = starget_to_rport(sdev->sdev_target); if (sdev->tagged_supported) - scsi_activate_tcq(sdev, phba->cfg_lun_queue_depth); + scsi_activate_tcq(sdev, vport->cfg_lun_queue_depth); else - scsi_deactivate_tcq(sdev, phba->cfg_lun_queue_depth); + scsi_deactivate_tcq(sdev, vport->cfg_lun_queue_depth); /* * Initialize the fc transport attributes for the target @@ -1445,7 +1444,7 @@ lpfc_slave_configure(struct scsi_device *sdev) * target pointer is stored in the starget_data for the * driver's sysfs entry point functions. */ - rport->dev_loss_tmo = phba->cfg_devloss_tmo; + rport->dev_loss_tmo = vport->cfg_devloss_tmo; if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { lpfc_sli_poll_fcp_ring(phba); @@ -1483,3 +1482,23 @@ struct scsi_host_template lpfc_template = { .shost_attrs = lpfc_hba_attrs, .max_sectors = 0xFFFF, }; + +struct scsi_host_template lpfc_vport_template = { + .module = THIS_MODULE, + .name = LPFC_DRIVER_NAME, + .info = lpfc_info, + .queuecommand = lpfc_queuecommand, + .eh_abort_handler = lpfc_abort_handler, + .eh_device_reset_handler= lpfc_device_reset_handler, + .eh_bus_reset_handler = lpfc_bus_reset_handler, + .slave_alloc = lpfc_slave_alloc, + .slave_configure = lpfc_slave_configure, + .slave_destroy = lpfc_slave_destroy, + .scan_finished = lpfc_scan_finished, + .this_id = -1, + .sg_tablesize = LPFC_SG_SEG_CNT, + .cmd_per_lun = LPFC_CMD_PER_LUN, + .use_clustering = ENABLE_CLUSTERING, + .shost_attrs = lpfc_vport_attrs, + .max_sectors = 0xFFFF, +}; 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 lpfc_vport_create(struct fc_vport *fc_vport, bool disable) { struct lpfc_nodelist *ndlp; - struct lpfc_vport *pport = - (struct lpfc_vport *) fc_vport->shost->hostdata; + struct Scsi_Host *shost = fc_vport->shost; + struct lpfc_vport *pport = (struct lpfc_vport *) shost->hostdata; struct lpfc_hba *phba = pport->phba; struct lpfc_vport *vport = NULL; int instance; @@ -237,7 +237,7 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) goto error_out; } - vport = lpfc_create_port(phba, instance, fc_vport); + vport = lpfc_create_port(phba, instance, &fc_vport->dev); if (!vport) { lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, "%d:1811 Create VPORT failed: vpi x%x\n", -- cgit v1.2.3 From e8b62011d88d6fdba585fb2bb77c9274a63cadab Mon Sep 17 00:00:00 2001 From: James Smart Date: Thu, 2 Aug 2007 11:10:09 -0400 Subject: [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 Signed-off-by: James Bottomley --- drivers/scsi/lpfc/lpfc.h | 3 +- drivers/scsi/lpfc/lpfc_attr.c | 110 ++++---- drivers/scsi/lpfc/lpfc_ct.c | 190 ++++++------- drivers/scsi/lpfc/lpfc_debugfs.c | 62 ++--- drivers/scsi/lpfc/lpfc_els.c | 533 +++++++++++++++---------------------- drivers/scsi/lpfc/lpfc_hbadisc.c | 310 ++++++++++----------- drivers/scsi/lpfc/lpfc_init.c | 74 ++--- drivers/scsi/lpfc/lpfc_logmsg.h | 10 +- drivers/scsi/lpfc/lpfc_mbox.c | 12 +- drivers/scsi/lpfc/lpfc_nportdisc.c | 118 ++++---- drivers/scsi/lpfc/lpfc_scsi.c | 246 ++++++++--------- drivers/scsi/lpfc/lpfc_sli.c | 248 +++++++---------- drivers/scsi/lpfc/lpfc_vport.c | 73 +++-- 13 files changed, 852 insertions(+), 1137 deletions(-) (limited to 'drivers/scsi/lpfc/lpfc_attr.c') diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index fb56ff9d5da2..5a76d2b4253b 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -349,6 +349,7 @@ struct lpfc_vport { uint32_t cfg_use_adisc; uint32_t cfg_fdmi_on; uint32_t cfg_discovery_threads; + uint32_t cfg_log_verbose; uint32_t cfg_max_luns; uint32_t dev_loss_tmo_changed; @@ -446,8 +447,6 @@ struct lpfc_hba { uint64_t cfg_soft_wwpn; uint32_t cfg_hba_queue_depth; - /* Config paramters that should be in the vport */ - uint32_t cfg_log_verbose; lpfc_vpd_t vpd; /* vital product data */ 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) if (cnt++ > 3000) { lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, - "%d:0466 Outstanding IO when " - "bringing Adapter offline\n", - phba->brd_no); + "0466 Outstanding IO when " + "bringing Adapter offline\n"); break; } } @@ -694,9 +693,8 @@ lpfc_##attr##_init(struct lpfc_hba *phba, int val) \ return 0;\ }\ lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ - "%d:0449 lpfc_"#attr" attribute cannot be set to %d, "\ - "allowed range is ["#minval", "#maxval"]\n", \ - phba->brd_no, val); \ + "0449 lpfc_"#attr" attribute cannot be set to %d, "\ + "allowed range is ["#minval", "#maxval"]\n", val); \ phba->cfg_##attr = default;\ return -EINVAL;\ } @@ -710,9 +708,8 @@ lpfc_##attr##_set(struct lpfc_hba *phba, int val) \ return 0;\ }\ lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ - "%d:0450 lpfc_"#attr" attribute cannot be set to %d, "\ - "allowed range is ["#minval", "#maxval"]\n", \ - phba->brd_no, val); \ + "0450 lpfc_"#attr" attribute cannot be set to %d, "\ + "allowed range is ["#minval", "#maxval"]\n", val); \ return -EINVAL;\ } @@ -764,10 +761,9 @@ lpfc_##attr##_init(struct lpfc_vport *vport, int val) \ vport->cfg_##attr = val;\ return 0;\ }\ - lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, \ - "%d:0449 lpfc_"#attr" attribute cannot be set to %d, "\ - "allowed range is ["#minval", "#maxval"]\n", \ - vport->phba->brd_no, val); \ + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \ + "0449 lpfc_"#attr" attribute cannot be set to %d, "\ + "allowed range is ["#minval", "#maxval"]\n", val); \ vport->cfg_##attr = default;\ return -EINVAL;\ } @@ -780,10 +776,9 @@ lpfc_##attr##_set(struct lpfc_vport *vport, int val) \ vport->cfg_##attr = val;\ return 0;\ }\ - lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, \ - "%d:0450 lpfc_"#attr" attribute cannot be set to %d, "\ - "allowed range is ["#minval", "#maxval"]\n", \ - vport->phba->brd_no, val); \ + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \ + "0450 lpfc_"#attr" attribute cannot be set to %d, "\ + "allowed range is ["#minval", "#maxval"]\n", val); \ return -EINVAL;\ } @@ -1023,17 +1018,15 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count) stat1 = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); if (stat1) lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0463 lpfc_soft_wwpn attribute set failed to reinit " - "adapter - %d\n", phba->brd_no, stat1); - + "0463 lpfc_soft_wwpn attribute set failed to " + "reinit adapter - %d\n", stat1); init_completion(&online_compl); lpfc_workq_post_event(phba, &stat2, &online_compl, LPFC_EVT_ONLINE); wait_for_completion(&online_compl); if (stat2) lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0464 lpfc_soft_wwpn attribute set failed to reinit " - "adapter - %d\n", phba->brd_no, stat2); - + "0464 lpfc_soft_wwpn attribute set failed to " + "reinit adapter - %d\n", stat2); return (stat1 || stat2) ? -EIO : count; } static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ @@ -1145,11 +1138,10 @@ lpfc_nodev_tmo_init(struct lpfc_vport *vport, int val) if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; if (val != LPFC_DEF_DEVLOSS_TMO) - lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, - "%d (%d):0402 Ignoring nodev_tmo module" - " parameter because devloss_tmo is" - " set.\n", - vport->phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0402 Ignoring nodev_tmo module " + "parameter because devloss_tmo is " + "set.\n"); return 0; } @@ -1158,11 +1150,10 @@ lpfc_nodev_tmo_init(struct lpfc_vport *vport, int val) vport->cfg_devloss_tmo = val; return 0; } - lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, - "%d (%d):0400 lpfc_nodev_tmo attribute cannot be set to" - " %d, allowed range is [%d, %d]\n", - vport->phba->brd_no, vport->vpi, val, - LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0400 lpfc_nodev_tmo attribute cannot be set to" + " %d, allowed range is [%d, %d]\n", + val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; return -EINVAL; } @@ -1195,10 +1186,9 @@ lpfc_nodev_tmo_set(struct lpfc_vport *vport, int val) { if (vport->dev_loss_tmo_changed || (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) { - lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, - "%d (%d):0401 Ignoring change to nodev_tmo " - "because devloss_tmo is set.\n", - vport->phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0401 Ignoring change to nodev_tmo " + "because devloss_tmo is set.\n"); return 0; } 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) lpfc_update_rport_devloss_tmo(vport); return 0; } - lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, - "%d (%d):0403 lpfc_nodev_tmo attribute cannot be set to" - "%d, allowed range is [%d, %d]\n", - vport->phba->brd_no, vport->vpi, val, - LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0403 lpfc_nodev_tmo attribute cannot be set to" + "%d, allowed range is [%d, %d]\n", + val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); return -EINVAL; } @@ -1243,11 +1232,10 @@ lpfc_devloss_tmo_set(struct lpfc_vport *vport, int val) return 0; } - lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, - "%d:0404 lpfc_devloss_tmo attribute cannot be set to" - " %d, allowed range is [%d, %d]\n", - vport->phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO, - LPFC_MAX_DEVLOSS_TMO); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0404 lpfc_devloss_tmo attribute cannot be set to" + " %d, allowed range is [%d, %d]\n", + val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); return -EINVAL; } @@ -1273,7 +1261,8 @@ static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, # LOG_LIBDFC 0x2000 LIBDFC events # LOG_ALL_MSG 0xffff LOG all messages */ -LPFC_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff, "Verbose logging bit-mask"); +LPFC_VPORT_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff, + "Verbose logging bit-mask"); /* # lun_queue_depth: This parameter is used to limit the number of outstanding @@ -1326,10 +1315,10 @@ static int lpfc_restrict_login_init(struct lpfc_vport *vport, int val) { if (val < 0 || val > 1) { - lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, - "%d:0449 lpfc_restrict_login attribute cannot " - "be set to %d, allowed range is [0, 1]\n", - vport->phba->brd_no, val); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0449 lpfc_restrict_login attribute cannot " + "be set to %d, allowed range is [0, 1]\n", + val); vport->cfg_restrict_login = 1; return -EINVAL; } @@ -1345,18 +1334,17 @@ static int lpfc_restrict_login_set(struct lpfc_vport *vport, int val) { if (val < 0 || val > 1) { - lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, - "%d:0450 lpfc_restrict_login attribute cannot " - "be set to %d, allowed range is [0, 1]\n", - vport->phba->brd_no, val); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0450 lpfc_restrict_login attribute cannot " + "be set to %d, allowed range is [0, 1]\n", + val); vport->cfg_restrict_login = 1; return -EINVAL; } if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { - lpfc_printf_log(vport->phba, KERN_ERR, LOG_INIT, - "%d:0468 lpfc_restrict_login must be 0 for " - "Physical ports.\n", - vport->phba->brd_no); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0468 lpfc_restrict_login must be 0 for " + "Physical ports.\n"); vport->cfg_restrict_login = 0; return 0; } @@ -2435,7 +2423,6 @@ struct fc_function_template lpfc_vport_transport_functions = { void lpfc_get_cfgparam(struct lpfc_hba *phba) { - lpfc_log_verbose_init(phba, lpfc_log_verbose); lpfc_cr_delay_init(phba, lpfc_cr_delay); lpfc_cr_count_init(phba, lpfc_cr_count); lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support); @@ -2469,6 +2456,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) void lpfc_get_vport_cfgparam(struct lpfc_vport *vport) { + lpfc_log_verbose_init(vport, lpfc_log_verbose); lpfc_lun_queue_depth_init(vport, lpfc_lun_queue_depth); lpfc_devloss_tmo_init(vport, lpfc_devloss_tmo); lpfc_nodev_tmo_init(vport, lpfc_nodev_tmo); diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 8b7e90eac5c3..ad7f33a31567 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -341,11 +341,11 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, } /* Issue GEN REQ IOCB for NPORT */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0119 Issue GEN REQ IOCB to NPORT x%x " - "Data: x%x x%x\n", phba->brd_no, vport->vpi, - ndlp->nlp_DID, icmd->ulpIoTag, - vport->port_state); + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0119 Issue GEN REQ IOCB to NPORT x%x " + "Data: x%x x%x\n", + ndlp->nlp_DID, icmd->ulpIoTag, + vport->port_state); geniocb->iocb_cmpl = cmpl; geniocb->drvrTimeout = icmd->ulpTimeout + LPFC_DRVR_TIMEOUT; geniocb->vport = vport; @@ -464,14 +464,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) Did, ndlp->nlp_flag, vport->fc_flag); - lpfc_printf_log(phba, KERN_INFO, + lpfc_printf_vlog(vport, + KERN_INFO, LOG_DISCOVERY, - "%d (%d):0238 Process " + "0238 Process " "x%x NameServer Rsp" "Data: x%x x%x x%x\n", - phba->brd_no, - vport->vpi, Did, - ndlp->nlp_flag, + Did, ndlp->nlp_flag, vport->fc_flag, vport->fc_rscn_id_cnt); } else { @@ -482,14 +481,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) Did, vport->fc_flag, vport->fc_rscn_id_cnt); - lpfc_printf_log(phba, KERN_INFO, + lpfc_printf_vlog(vport, + KERN_INFO, LOG_DISCOVERY, - "%d (%d):0239 Skip x%x " + "0239 Skip x%x " "NameServer Rsp Data: " "x%x x%x\n", - phba->brd_no, - vport->vpi, Did, - vport->fc_flag, + Did, vport->fc_flag, vport->fc_rscn_id_cnt); } @@ -516,14 +514,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) Did, vport->fc_flag, vport->fc_rscn_id_cnt); - lpfc_printf_log(phba, KERN_INFO, + lpfc_printf_vlog(vport, + KERN_INFO, LOG_DISCOVERY, - "%d (%d):0245 Skip x%x " + "0245 Skip x%x " "NameServer Rsp Data: " "x%x x%x\n", - phba->brd_no, - vport->vpi, Did, - vport->fc_flag, + Did, vport->fc_flag, vport->fc_rscn_id_cnt); } } @@ -570,9 +567,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, if (lpfc_els_chk_latt(vport) || lpfc_error_lost_link(irsp)) { - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0216 Link event during NS query\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0216 Link event during NS query\n"); lpfc_vport_set_state(vport, FC_VPORT_FAILED); goto out; } @@ -590,20 +586,17 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, goto out; } lpfc_vport_set_state(vport, FC_VPORT_FAILED); - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0257 GID_FT Query error: 0x%x 0x%x\n", - phba->brd_no, vport->vpi, irsp->ulpStatus, - vport->fc_ns_retry); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0257 GID_FT Query error: 0x%x 0x%x\n", + irsp->ulpStatus, vport->fc_ns_retry); } else { /* Good status, continue checking */ CTrsp = (struct lpfc_sli_ct_request *) outp->virt; if (CTrsp->CommandResponse.bits.CmdRsp == be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0208 NameServer Rsp " - "Data: x%x\n", - phba->brd_no, vport->vpi, - vport->fc_flag); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0208 NameServer Rsp Data: x%x\n", + vport->fc_flag); lpfc_ns_rsp(vport, outp, (uint32_t) (irsp->un.genreq64.bdl.bdeSize)); } else if (CTrsp->CommandResponse.bits.CmdRsp == @@ -611,10 +604,10 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, /* NameServer Rsp Error */ if ((CTrsp->ReasonCode == SLI_CT_UNABLE_TO_PERFORM_REQ) && (CTrsp->Explanation == SLI_CT_NO_FC4_TYPES)) { - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0269 No NameServer Entries " + lpfc_printf_vlog(vport, KERN_INFO, + LOG_DISCOVERY, + "0269 No NameServer Entries " "Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, CTrsp->CommandResponse.bits.CmdRsp, (uint32_t) CTrsp->ReasonCode, (uint32_t) CTrsp->Explanation, @@ -625,12 +618,11 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, (uint32_t) CTrsp->ReasonCode, (uint32_t) CTrsp->Explanation); - } - else { - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0240 NameServer Rsp Error " + } else { + lpfc_printf_vlog(vport, KERN_INFO, + LOG_DISCOVERY, + "0240 NameServer Rsp Error " "Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, CTrsp->CommandResponse.bits.CmdRsp, (uint32_t) CTrsp->ReasonCode, (uint32_t) CTrsp->Explanation, @@ -646,10 +638,9 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, } else { /* NameServer Rsp Error */ - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0241 NameServer Rsp Error " + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0241 NameServer Rsp Error " "Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, CTrsp->CommandResponse.bits.CmdRsp, (uint32_t) CTrsp->ReasonCode, (uint32_t) CTrsp->Explanation, @@ -717,40 +708,37 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { if ((fbits & FC4_FEATURE_INIT) && !(fbits & FC4_FEATURE_TARGET)) { - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0270 Skip x%x GFF " - "NameServer Rsp Data: (init) " - "x%x x%x\n", phba->brd_no, - vport->vpi, did, fbits, - vport->fc_rscn_id_cnt); + lpfc_printf_vlog(vport, KERN_INFO, + LOG_DISCOVERY, + "0270 Skip x%x GFF " + "NameServer Rsp Data: (init) " + "x%x x%x\n", did, fbits, + vport->fc_rscn_id_cnt); goto out; } } } else { - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0267 NameServer GFF Rsp" - " x%x Error (%d %d) Data: x%x x%x\n", - phba->brd_no, vport->vpi, did, - irsp->ulpStatus, irsp->un.ulpWord[4], - vport->fc_flag, vport->fc_rscn_id_cnt) + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0267 NameServer GFF Rsp " + "x%x Error (%d %d) Data: x%x x%x\n", + did, irsp->ulpStatus, irsp->un.ulpWord[4], + vport->fc_flag, vport->fc_rscn_id_cnt) } /* This is a target port, unregistered port, or the GFF_ID failed */ ndlp = lpfc_setup_disc_node(vport, did); if (ndlp) { - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0242 Process x%x GFF " - "NameServer Rsp Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, - did, ndlp->nlp_flag, vport->fc_flag, - vport->fc_rscn_id_cnt); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0242 Process x%x GFF " + "NameServer Rsp Data: x%x x%x x%x\n", + did, ndlp->nlp_flag, vport->fc_flag, + vport->fc_rscn_id_cnt); } else { - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0243 Skip x%x GFF " - "NameServer Rsp Data: x%x x%x\n", - phba->brd_no, vport->vpi, did, - vport->fc_flag, vport->fc_rscn_id_cnt); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0243 Skip x%x GFF " + "NameServer Rsp Data: x%x x%x\n", did, + vport->fc_flag, vport->fc_rscn_id_cnt); } out: /* Link up / RSCN discovery */ @@ -806,22 +794,21 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, latt = lpfc_els_chk_latt(vport); /* RFT request completes status CmdRsp */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0209 RFT request completes, latt %d, " - "ulpStatus x%x CmdRsp x%x, Context x%x, Tag x%x\n", - phba->brd_no, vport->vpi, latt, irsp->ulpStatus, - CTrsp->CommandResponse.bits.CmdRsp, - cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0209 RFT request completes, latt %d, " + "ulpStatus x%x CmdRsp x%x, Context x%x, Tag x%x\n", + latt, irsp->ulpStatus, + CTrsp->CommandResponse.bits.CmdRsp, + cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag); lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, "CT cmd cmpl: status:x%x/x%x cmd:x%x", irsp->ulpStatus, irsp->un.ulpWord[4], cmdcode); if (irsp->ulpStatus) { - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0268 NS cmd %x Error (%d %d)\n", - phba->brd_no, vport->vpi, cmdcode, - irsp->ulpStatus, irsp->un.ulpWord[4]); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0268 NS cmd %x Error (%d %d)\n", + cmdcode, irsp->ulpStatus, irsp->un.ulpWord[4]); if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) || @@ -833,9 +820,8 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, goto out; retry++; - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0216 Retrying NS cmd %x\n", - phba->brd_no, vport->vpi, cmdcode); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0216 Retrying NS cmd %x\n", cmdcode); rc = lpfc_ns_cmd(vport, cmdcode, retry, 0); if (rc == 0) goto out; @@ -979,10 +965,9 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode, } /* NameServer Req */ - lpfc_printf_log(phba, KERN_INFO ,LOG_DISCOVERY, - "%d (%d):0236 NameServer Req Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, cmdcode, vport->fc_flag, - vport->fc_rscn_id_cnt); + lpfc_printf_vlog(vport, KERN_INFO ,LOG_DISCOVERY, + "0236 NameServer Req Data: x%x x%x x%x\n", + cmdcode, vport->fc_flag, vport->fc_rscn_id_cnt); bpl = (struct ulp_bde64 *) bmp->virt; memset(bpl, 0, sizeof(struct ulp_bde64)); @@ -1099,10 +1084,9 @@ ns_cmd_free_mpvirt: ns_cmd_free_mp: kfree(mp); ns_cmd_exit: - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0266 Issue NameServer Req x%x err %d Data: x%x x%x\n", - phba->brd_no, vport->vpi, cmdcode, rc, vport->fc_flag, - vport->fc_rscn_id_cnt); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0266 Issue NameServer Req x%x err %d Data: x%x x%x\n", + cmdcode, rc, vport->fc_flag, vport->fc_rscn_id_cnt); return 1; } @@ -1128,12 +1112,11 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, irsp->ulpStatus, irsp->un.ulpWord[4], latt); if (latt || irsp->ulpStatus) { - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0229 FDMI cmd %04x failed, latt = %d " - "ulpStatus: x%x, rid x%x\n", - phba->brd_no, vport->vpi, - be16_to_cpu(fdmi_cmd), latt, irsp->ulpStatus, - irsp->un.ulpWord[4]); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0229 FDMI cmd %04x failed, latt = %d " + "ulpStatus: x%x, rid x%x\n", + be16_to_cpu(fdmi_cmd), latt, irsp->ulpStatus, + irsp->un.ulpWord[4]); lpfc_ct_free_iocb(phba, cmdiocb); return; } @@ -1141,10 +1124,9 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ndlp = lpfc_findnode_did(vport, FDMI_DID); if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { /* FDMI rsp failed */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0220 FDMI rsp failed Data: x%x\n", - phba->brd_no, vport->vpi, - be16_to_cpu(fdmi_cmd)); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0220 FDMI rsp failed Data: x%x\n", + be16_to_cpu(fdmi_cmd)); } switch (be16_to_cpu(fdmi_cmd)) { @@ -1207,11 +1189,9 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) INIT_LIST_HEAD(&bmp->list); /* FDMI request */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0218 FDMI Request Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, vport->fc_flag, - vport->port_state, cmdcode); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0218 FDMI Request Data: x%x x%x x%x\n", + vport->fc_flag, vport->port_state, cmdcode); CtReq = (struct lpfc_sli_ct_request *) mp->virt; memset(CtReq, 0, sizeof(struct lpfc_sli_ct_request)); @@ -1534,9 +1514,9 @@ fdmi_cmd_free_mp: kfree(mp); fdmi_cmd_exit: /* Issue FDMI request failed */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0244 Issue FDMI request failed Data: x%x\n", - phba->brd_no, vport->vpi, cmdcode); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0244 Issue FDMI request failed Data: x%x\n", + cmdcode); return 1; } diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 2310a2d1d8ce..dc7b858b95fa 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -642,13 +642,11 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL); atomic_set(&lpfc_debugfs_hba_count, 0); if (!lpfc_debugfs_root) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0409 Cannot create debugfs root (lpfc)", - phba->brd_no); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0409 Cannot create debugfs root\n"); goto debug_failed; } } - if (!lpfc_debugfs_start_time) lpfc_debugfs_start_time = jiffies; @@ -658,9 +656,8 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) phba->hba_debugfs_root = debugfs_create_dir(name, lpfc_debugfs_root); if (!phba->hba_debugfs_root) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0409 Cannot create debugfs hba (lpfc%d)", - phba->brd_no, phba->brd_no); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0409 Cannot create debugfs hba\n"); goto debug_failed; } atomic_inc(&lpfc_debugfs_hba_count); @@ -673,9 +670,8 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) phba->hba_debugfs_root, phba, &lpfc_debugfs_op_dumpslim); if (!phba->debug_dumpslim) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0409 Cannot create debugfs dumpslim (lpfc%d)", - phba->brd_no, phba->brd_no); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0409 Cannot create debugfs dumpslim\n"); goto debug_failed; } @@ -692,8 +688,8 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) } lpfc_debugfs_max_slow_ring_trc = (1 << i); printk(KERN_ERR - "lpfc_debugfs_max_slow_ring_trc change to %d\n", - lpfc_debugfs_max_slow_ring_trc); + "lpfc_debugfs_max_disc_trc changed to " + "%d\n", lpfc_debugfs_max_disc_trc); } } @@ -704,10 +700,9 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) phba->hba_debugfs_root, phba, &lpfc_debugfs_op_slow_ring_trc); if (!phba->debug_slow_ring_trc) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0409 Cannot create debugfs " - "slow_ring_trace (lpfc%d)", - phba->brd_no, phba->brd_no); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0409 Cannot create debugfs " + "slow_ring_trace\n"); goto debug_failed; } if (!phba->slow_ring_trc) { @@ -716,10 +711,9 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) lpfc_debugfs_max_slow_ring_trc), GFP_KERNEL); if (!phba->slow_ring_trc) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0409 Cannot create debugfs " - "slow_ring buffer (lpfc%d)", - phba->brd_no, phba->brd_no); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0409 Cannot create debugfs " + "slow_ring buffer\n"); goto debug_failed; } atomic_set(&phba->slow_ring_trc_cnt, 0); @@ -734,9 +728,8 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) vport->vport_debugfs_root = debugfs_create_dir(name, phba->hba_debugfs_root); if (!vport->vport_debugfs_root) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0409 Cant create debugfs vport%d (lpfc%d)", - phba->brd_no, vport->vpi, phba->brd_no); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0409 Cant create debugfs"); goto debug_failed; } atomic_inc(&phba->debugfs_vport_count); @@ -754,8 +747,8 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) } lpfc_debugfs_max_disc_trc = (1 << i); printk(KERN_ERR - "lpfc_debugfs_max_disc_trc changed to %d\n", - lpfc_debugfs_max_disc_trc); + "lpfc_debugfs_max_disc_trc changed to %d\n", + lpfc_debugfs_max_disc_trc); } } @@ -764,10 +757,9 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) GFP_KERNEL); if (!vport->disc_trc) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0409 Cannot create debugfs " - "vport%d disc trace buffer (lpfc%d)", - phba->brd_no, vport->vpi, phba->brd_no); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0409 Cannot create debugfs disc trace " + "buffer\n"); goto debug_failed; } atomic_set(&vport->disc_trc_cnt, 0); @@ -780,10 +772,9 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) vport->vport_debugfs_root, vport, &lpfc_debugfs_op_disc_trc); if (!vport->debug_disc_trc) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0409 Cannot create debugfs " - "vport%d discovery_trace (lpfc%d)", - phba->brd_no, vport->vpi, phba->brd_no); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0409 Cannot create debugfs " + "discovery_trace\n"); goto debug_failed; } snprintf(name, sizeof(name), "nodelist"); @@ -792,9 +783,8 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) vport->vport_debugfs_root, vport, &lpfc_debugfs_op_nodelist); if (!vport->debug_nodelist) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0409 Cant create debugfs vport%d nodelist (lpfc%d)", - phba->brd_no, vport->vpi, phba->brd_no); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0409 Cant create debugfs nodelist"); goto debug_failed; } debug_failed: diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 4aed0cffe92f..9365e19696e2 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -63,10 +63,10 @@ lpfc_els_chk_latt(struct lpfc_vport *vport) return 0; /* Pending Link Event during Discovery */ - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0237 Pending Link Event during " - "Discovery: State x%x\n", - phba->brd_no, vport->vpi, phba->pport->port_state); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0237 Pending Link Event during " + "Discovery: State x%x\n", + phba->pport->port_state); /* CLEAR_LA should re-enable link attention events and * we should then imediately take a LATT event. The @@ -208,23 +208,21 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp, if (prsp) { list_add(&prsp->list, &pcmd->list); } - if (expectRsp) { /* Xmit ELS command to remote NPORT */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0116 Xmit ELS command x%x to remote " - "NPORT x%x I/O tag: x%x, port state: x%x\n", - phba->brd_no, vport->vpi, elscmd, did, - elsiocb->iotag, vport->port_state); + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0116 Xmit ELS command x%x to remote " + "NPORT x%x I/O tag: x%x, port state: x%x\n", + elscmd, did, elsiocb->iotag, + vport->port_state); } else { /* Xmit ELS response to remote NPORT */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0117 Xmit ELS response x%x to remote " - "NPORT x%x I/O tag: x%x, size: x%x\n", - phba->brd_no, vport->vpi, elscmd, - ndlp->nlp_DID, elsiocb->iotag, cmdSize); + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0117 Xmit ELS response x%x to remote " + "NPORT x%x I/O tag: x%x, size: x%x\n", + elscmd, ndlp->nlp_DID, elsiocb->iotag, + cmdSize); } - return elsiocb; } @@ -285,9 +283,8 @@ fail_free_mbox: fail: lpfc_vport_set_state(vport, FC_VPORT_FAILED); - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0249 Cannot issue Register Fabric login\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0249 Cannot issue Register Fabric login\n"); return -ENXIO; } @@ -340,20 +337,19 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) { if (sp->cmn.response_multiple_NPort) { - lpfc_printf_log(phba, KERN_WARNING, LOG_ELS | LOG_VPORT, - "%d:1816 FLOGI NPIV supported, " - "response data 0x%x\n", - phba->brd_no, - sp->cmn.response_multiple_NPort); + lpfc_printf_vlog(vport, KERN_WARNING, + LOG_ELS | LOG_VPORT, + "1816 FLOGI NPIV supported, " + "response data 0x%x\n", + sp->cmn.response_multiple_NPort); phba->link_flag |= LS_NPIV_FAB_SUPPORTED; - } else { /* Because we asked f/w for NPIV it still expects us - to call reg_vnpid atleast for the physcial host */ - lpfc_printf_log(phba, KERN_WARNING, LOG_ELS | LOG_VPORT, - "%d:1817 Fabric does not support NPIV " - "- configuring single port mode.\n", - phba->brd_no); + to call reg_vnpid atleast for the physcial host */ + lpfc_printf_vlog(vport, KERN_WARNING, + LOG_ELS | LOG_VPORT, + "1817 Fabric does not support NPIV " + "- configuring single port mode.\n"); phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED; } } @@ -522,12 +518,11 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, } /* FLOGI failure */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0100 FLOGI failure Data: x%x x%x " - "x%x\n", - phba->brd_no, vport->vpi, - irsp->ulpStatus, irsp->un.ulpWord[4], - irsp->ulpTimeout); + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0100 FLOGI failure Data: x%x x%x " + "x%x\n", + irsp->ulpStatus, irsp->un.ulpWord[4], + irsp->ulpTimeout); goto flogifail; } @@ -540,12 +535,11 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, sp = prsp->virt + sizeof(uint32_t); /* FLOGI completes successfully */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0101 FLOGI completes sucessfully " - "Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, - irsp->un.ulpWord[4], sp->cmn.e_d_tov, - sp->cmn.w2.r_a_tov, sp->cmn.edtovResolution); + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0101 FLOGI completes sucessfully " + "Data: x%x x%x x%x x%x\n", + irsp->un.ulpWord[4], sp->cmn.e_d_tov, + sp->cmn.w2.r_a_tov, sp->cmn.edtovResolution); if (vport->port_state == LPFC_FLOGI) { /* @@ -662,8 +656,8 @@ lpfc_els_abort_flogi(struct lpfc_hba *phba) /* Abort outstanding I/O on NPort */ lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d:0201 Abort outstanding I/O on NPort x%x\n", - phba->brd_no, Fabric_DID); + "0201 Abort outstanding I/O on NPort x%x\n", + Fabric_DID); pring = &phba->sli.ring[LPFC_ELS_RING]; @@ -736,18 +730,16 @@ static void lpfc_more_plogi(struct lpfc_vport *vport) { int sentplogi; - struct lpfc_hba *phba = vport->phba; if (vport->num_disc_nodes) vport->num_disc_nodes--; /* Continue discovery with PLOGIs to go */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0232 Continue discovery with %d PLOGIs to go " - "Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, vport->num_disc_nodes, - vport->fc_plogi_cnt, vport->fc_flag, vport->port_state); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0232 Continue discovery with %d PLOGIs to go " + "Data: x%x x%x x%x\n", + vport->num_disc_nodes, vport->fc_plogi_cnt, + vport->fc_flag, vport->port_state); /* Check to see if there are more PLOGIs to be sent */ if (vport->fc_flag & FC_NLP_MORE) /* go thru NPR nodes and issue any remaining ELS PLOGIs */ @@ -833,11 +825,12 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ndlp = lpfc_findnode_did(vport, irsp->un.elsreq64.remoteID); if (!ndlp) { - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0136 PLOGI completes to NPort x%x " - "with no ndlp. Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, irsp->un.elsreq64.remoteID, - irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpIoTag); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0136 PLOGI completes to NPort x%x " + "with no ndlp. Data: x%x x%x x%x\n", + irsp->un.elsreq64.remoteID, + irsp->ulpStatus, irsp->un.ulpWord[4], + irsp->ulpIoTag); goto out; } @@ -851,13 +844,11 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, rc = 0; /* PLOGI completes to NPort */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0102 PLOGI completes to NPort x%x " - "Data: x%x x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, ndlp->nlp_DID, - irsp->ulpStatus, irsp->un.ulpWord[4], - irsp->ulpTimeout, disc, vport->num_disc_nodes); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0102 PLOGI completes to NPort x%x " + "Data: x%x x%x x%x x%x x%x\n", + ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4], + irsp->ulpTimeout, disc, vport->num_disc_nodes); /* Check to see if link went down during discovery */ if (lpfc_els_chk_latt(vport)) { spin_lock_irq(shost->host_lock); @@ -881,17 +872,14 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, } goto out; } - /* PLOGI failed */ if (ndlp->nlp_DID == NameServer_DID) { lpfc_vport_set_state(vport, FC_VPORT_FAILED); - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0250 Nameserver login error: " - "0x%x / 0x%x\n", - phba->brd_no, vport->vpi, - irsp->ulpStatus, irsp->un.ulpWord[4]); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0250 Nameserver login error: " + "0x%x / 0x%x\n", + irsp->ulpStatus, irsp->un.ulpWord[4]); } - /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ if (lpfc_error_lost_link(irsp)) { rc = NLP_STE_FREED_NODE; @@ -1017,14 +1005,12 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, "PRLI cmpl: status:x%x/x%x did:x%x", irsp->ulpStatus, irsp->un.ulpWord[4], ndlp->nlp_DID); - /* PRLI completes to NPort */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0103 PRLI completes to NPort x%x " - "Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, ndlp->nlp_DID, - irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout, - vport->num_disc_nodes); + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0103 PRLI completes to NPort x%x " + "Data: x%x x%x x%x x%x\n", + ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4], + irsp->ulpTimeout, vport->num_disc_nodes); vport->fc_prli_sent--; /* Check to see if link went down during discovery */ @@ -1129,18 +1115,15 @@ static void lpfc_more_adisc(struct lpfc_vport *vport) { int sentadisc; - struct lpfc_hba *phba = vport->phba; if (vport->num_disc_nodes) vport->num_disc_nodes--; - /* Continue discovery with ADISCs to go */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0210 Continue discovery with %d ADISCs to go " - "Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, vport->num_disc_nodes, - vport->fc_adisc_cnt, vport->fc_flag, vport->port_state); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0210 Continue discovery with %d ADISCs to go " + "Data: x%x x%x x%x\n", + vport->num_disc_nodes, vport->fc_adisc_cnt, + vport->fc_flag, vport->port_state); /* Check to see if there are more ADISCs to be sent */ if (vport->fc_flag & FC_NLP_MORE) { lpfc_set_disctmo(vport); @@ -1206,15 +1189,12 @@ lpfc_cmpl_els_adisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC); ndlp->nlp_flag &= ~(NLP_ADISC_SND | NLP_NPR_2B_DISC); spin_unlock_irq(shost->host_lock); - /* ADISC completes to NPort */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0104 ADISC completes to NPort x%x " - "Data: x%x x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, ndlp->nlp_DID, - irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout, - disc, vport->num_disc_nodes); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0104 ADISC completes to NPort x%x " + "Data: x%x x%x x%x x%x x%x\n", + ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4], + irsp->ulpTimeout, disc, vport->num_disc_nodes); /* Check to see if link went down during discovery */ if (lpfc_els_chk_latt(vport)) { spin_lock_irq(shost->host_lock); @@ -1374,15 +1354,12 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, "LOGO cmpl: status:x%x/x%x did:x%x", irsp->ulpStatus, irsp->un.ulpWord[4], ndlp->nlp_DID); - /* LOGO completes to NPort */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0105 LOGO completes to NPort x%x " - "Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, ndlp->nlp_DID, - irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout, - vport->num_disc_nodes); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0105 LOGO completes to NPort x%x " + "Data: x%x x%x x%x x%x\n", + ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4], + irsp->ulpTimeout, vport->num_disc_nodes); /* Check to see if link went down during discovery */ if (lpfc_els_chk_latt(vport)) goto out; @@ -1488,15 +1465,11 @@ lpfc_cmpl_els_cmd(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, "ELS cmd cmpl: status:x%x/x%x did:x%x", irsp->ulpStatus, irsp->un.ulpWord[4], irsp->un.elsreq64.remoteID); - /* ELS cmd tag completes */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0106 ELS cmd tag x%x completes Data: x%x x%x " - "x%x\n", - phba->brd_no, vport->vpi, - irsp->ulpIoTag, irsp->ulpStatus, - irsp->un.ulpWord[4], irsp->ulpTimeout); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0106 ELS cmd tag x%x completes Data: x%x x%x x%x\n", + irsp->ulpIoTag, irsp->ulpStatus, + irsp->un.ulpWord[4], irsp->ulpTimeout); /* Check to see if link went down during discovery */ lpfc_els_chk_latt(vport); lpfc_els_free_iocb(phba, cmdiocb); @@ -1831,9 +1804,9 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, case IOERR_ILLEGAL_COMMAND: if ((phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) && (cmd == ELS_CMD_FDISC)) { - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0124 FDISC failed (3/6) retrying...\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0124 FDISC failed (3/6) " + "retrying...\n"); lpfc_mbx_unreg_vpi(vport); retry = 1; /* Always retry for this case */ @@ -1898,10 +1871,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && (cmd == ELS_CMD_FDISC) && (stat.un.b.lsRjtRsnCodeExp == LSEXP_OUT_OF_RESOURCE)){ - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0125 FDISC Failed (x%x)." - " Fabric out of resources\n", - phba->brd_no, vport->vpi, stat.un.lsRjtError); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0125 FDISC Failed (x%x). " + "Fabric out of resources\n", + stat.un.lsRjtError); lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_RSCS); } @@ -1926,10 +1899,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ((stat.un.b.lsRjtRsnCodeExp == LSEXP_INVALID_PNAME) || (stat.un.b.lsRjtRsnCodeExp == LSEXP_INVALID_NPORT_ID)) ) { - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0123 FDISC Failed (x%x)." - " Fabric Detected Bad WWN\n", - phba->brd_no, vport->vpi, stat.un.lsRjtError); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0123 FDISC Failed (x%x). " + "Fabric Detected Bad WWN\n", + stat.un.lsRjtError); lpfc_vport_set_state(vport, FC_VPORT_FABRIC_REJ_WWN); } @@ -1959,11 +1932,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, if (retry) { /* Retry ELS command to remote NPORT */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0107 Retry ELS command x%x to remote " - "NPORT x%x Data: x%x x%x\n", - phba->brd_no, vport->vpi, - cmd, did, cmdiocb->retry, delay); + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0107 Retry ELS command x%x to remote " + "NPORT x%x Data: x%x x%x\n", + cmd, did, cmdiocb->retry, delay); if (((cmd == ELS_CMD_PLOGI) || (cmd == ELS_CMD_ADISC)) && ((irsp->ulpStatus != IOSTAT_LOCAL_REJECT) || @@ -2031,7 +2003,6 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, return 1; } } - /* No retry ELS command to remote NPORT */ lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, "0108 No retry ELS command x%x to remote " @@ -2086,14 +2057,12 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, "ACC LOGO cmpl: status:x%x/x%x did:x%x", irsp->ulpStatus, irsp->un.ulpWord[4], ndlp->nlp_DID); - /* ACC to LOGO completes to NPort */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0109 ACC to LOGO completes to NPort x%x " - "Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, ndlp->nlp_DID, - ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0109 ACC to LOGO completes to NPort x%x " + "Data: x%x x%x x%x\n", + ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, + ndlp->nlp_rpi); switch (ndlp->nlp_state) { case NLP_STE_UNUSED_NODE: /* node is just allocated */ lpfc_drop_node(vport, ndlp); @@ -2155,17 +2124,14 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, "ACC cmpl: status:x%x/x%x did:x%x", irsp->ulpStatus, irsp->un.ulpWord[4], irsp->un.rcvels.remoteID); - /* ELS response tag completes */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0110 ELS response tag x%x completes " - "Data: x%x x%x x%x x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, - cmdiocb->iocb.ulpIoTag, rspiocb->iocb.ulpStatus, - rspiocb->iocb.un.ulpWord[4], rspiocb->iocb.ulpTimeout, - ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, - ndlp->nlp_rpi); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0110 ELS response tag x%x completes " + "Data: x%x x%x x%x x%x x%x x%x x%x\n", + cmdiocb->iocb.ulpIoTag, rspiocb->iocb.ulpStatus, + rspiocb->iocb.un.ulpWord[4], rspiocb->iocb.ulpTimeout, + ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, + ndlp->nlp_rpi); if (mbox) { if ((rspiocb->iocb.ulpStatus == 0) && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { @@ -2309,15 +2275,13 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag, lpfc_nlp_put(ndlp); elsiocb->context1 = NULL; } - /* Xmit ELS ACC response tag */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0128 Xmit ELS ACC response tag x%x, XRI: x%x, " - "DID: x%x, nlp_flag: x%x nlp_state: x%x RPI: x%x\n", - phba->brd_no, vport->vpi, elsiocb->iotag, - elsiocb->iocb.ulpContext, ndlp->nlp_DID, - ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0128 Xmit ELS ACC response tag x%x, XRI: x%x, " + "DID: x%x, nlp_flag: x%x nlp_state: x%x RPI: x%x\n", + elsiocb->iotag, elsiocb->iocb.ulpContext, + ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, + ndlp->nlp_rpi); if (ndlp->nlp_flag & NLP_LOGO_ACC) { spin_lock_irq(shost->host_lock); ndlp->nlp_flag &= ~NLP_LOGO_ACC; @@ -2375,14 +2339,13 @@ lpfc_els_rsp_reject(struct lpfc_vport *vport, uint32_t rejectError, } /* Xmit ELS RJT response tag */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0129 Xmit ELS RJT x%x response tag x%x " - "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " - "rpi x%x\n", - phba->brd_no, vport->vpi, rejectError, elsiocb->iotag, - elsiocb->iocb.ulpContext, ndlp->nlp_DID, - ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0129 Xmit ELS RJT x%x response tag x%x " + "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " + "rpi x%x\n", + rejectError, elsiocb->iotag, + elsiocb->iocb.ulpContext, ndlp->nlp_DID, + ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, "Issue LS_RJT: did:x%x flg:x%x err:x%x", ndlp->nlp_DID, ndlp->nlp_flag, rejectError); @@ -2422,13 +2385,12 @@ lpfc_els_rsp_adisc_acc(struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb, icmd->ulpContext = oldcmd->ulpContext; /* Xri */ /* Xmit ADISC ACC response tag */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0130 Xmit ADISC ACC response iotag x%x xri: " - "x%x, did x%x, nlp_flag x%x, nlp_state x%x rpi x%x\n", - phba->brd_no, vport->vpi, elsiocb->iotag, - elsiocb->iocb.ulpContext, ndlp->nlp_DID, - ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0130 Xmit ADISC ACC response iotag x%x xri: " + "x%x, did x%x, nlp_flag x%x, nlp_state x%x rpi x%x\n", + elsiocb->iotag, elsiocb->iocb.ulpContext, + ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, + ndlp->nlp_rpi); pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); *((uint32_t *) (pcmd)) = ELS_CMD_ACC; @@ -2482,15 +2444,13 @@ lpfc_els_rsp_prli_acc(struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb, icmd = &elsiocb->iocb; oldcmd = &oldiocb->iocb; icmd->ulpContext = oldcmd->ulpContext; /* Xri */ - /* Xmit PRLI ACC response tag */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0131 Xmit PRLI ACC response tag x%x xri x%x, " - "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", - phba->brd_no, vport->vpi, elsiocb->iotag, - elsiocb->iocb.ulpContext, ndlp->nlp_DID, - ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0131 Xmit PRLI ACC response tag x%x xri x%x, " + "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", + elsiocb->iotag, elsiocb->iocb.ulpContext, + ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, + ndlp->nlp_rpi); pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); *((uint32_t *) (pcmd)) = (ELS_CMD_ACC | (ELS_CMD_PRLI & ~ELS_RSP_MASK)); @@ -2564,16 +2524,11 @@ lpfc_els_rsp_rnid_acc(struct lpfc_vport *vport, uint8_t format, icmd = &elsiocb->iocb; oldcmd = &oldiocb->iocb; icmd->ulpContext = oldcmd->ulpContext; /* Xri */ - /* Xmit RNID ACC response tag */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0132 Xmit RNID ACC response tag x%x " - "xri x%x\n", - phba->brd_no, vport->vpi, elsiocb->iotag, - elsiocb->iocb.ulpContext); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0132 Xmit RNID ACC response tag x%x xri x%x\n", + elsiocb->iotag, elsiocb->iocb.ulpContext); pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); - *((uint32_t *) (pcmd)) = ELS_CMD_ACC; pcmd += sizeof(uint32_t); @@ -2716,7 +2671,6 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did) D_ID rscn_did; uint32_t *lp; uint32_t payload_len, i; - struct lpfc_hba *phba = vport->phba; ns_did.un.word = did; @@ -2751,12 +2705,10 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did) break; default: /* Unknown Identifier in RSCN node */ - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0217 Unknown " - "Identifier in RSCN payload " - "Data: x%x\n", - phba->brd_no, vport->vpi, - rscn_did.un.word); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0217 Unknown Identifier in " + "RSCN payload Data: x%x\n", + rscn_did.un.word); case 3: /* Whole Fabric effected */ return did; } @@ -2813,13 +2765,10 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, payload_len = be32_to_cpu(*lp++ & ~ELS_CMD_MASK); payload_len -= sizeof(uint32_t); /* take off word 0 */ - /* RSCN received */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0214 RSCN received Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, vport->fc_flag, payload_len, - *lp, rscn_cnt); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0214 RSCN received Data: x%x x%x x%x x%x\n", + vport->fc_flag, payload_len, *lp, rscn_cnt); for (i = 0; i < payload_len/sizeof(uint32_t); i++) fc_host_post_event(shost, fc_get_event_number(), FCH_EVT_RSCN, lp[i]); @@ -2854,11 +2803,11 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, } if (rscn_id == hba_id) { /* ALL NPortIDs in RSCN are on HBA */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0214 Ignore RSCN Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, vport->fc_flag, payload_len, - *lp, rscn_cnt); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0214 Ignore RSCN " + "Data: x%x x%x x%x x%x\n", + vport->fc_flag, payload_len, + *lp, rscn_cnt); lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, "RCV RSCN vport: did:x%x/ste:x%x flg:x%x", ndlp->nlp_DID, vport->port_state, @@ -2904,23 +2853,21 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, } /* Deferred RSCN */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0235 Deferred RSCN " - "Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, - vport->fc_rscn_id_cnt, vport->fc_flag, - vport->port_state); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0235 Deferred RSCN " + "Data: x%x x%x x%x\n", + vport->fc_rscn_id_cnt, vport->fc_flag, + vport->port_state); } else { spin_lock_irq(shost->host_lock); vport->fc_flag |= FC_RSCN_DISCOVERY; spin_unlock_irq(shost->host_lock); /* ReDiscovery RSCN */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0234 ReDiscovery RSCN " - "Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, - vport->fc_rscn_id_cnt, vport->fc_flag, - vport->port_state); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0234 ReDiscovery RSCN " + "Data: x%x x%x x%x\n", + vport->fc_rscn_id_cnt, vport->fc_flag, + vport->port_state); } /* Send back ACC */ lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, @@ -2973,11 +2920,10 @@ lpfc_els_handle_rscn(struct lpfc_vport *vport) lpfc_set_disctmo(vport); /* RSCN processed */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0215 RSCN processed Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, - vport->fc_flag, 0, vport->fc_rscn_id_cnt, - vport->port_state); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0215 RSCN processed Data: x%x x%x x%x x%x\n", + vport->fc_flag, 0, vport->fc_rscn_id_cnt, + vport->port_state); /* To process RSCN, first compare RSCN data with NameServer */ vport->fc_ns_retry = 0; @@ -3045,10 +2991,10 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, /* An FLOGI ELS command was received from DID in Loop Mode */ - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0113 An FLOGI ELS command x%x was " - "received from DID x%x in Loop Mode\n", - phba->brd_no, vport->vpi, cmd, did); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0113 An FLOGI ELS command x%x was " + "received from DID x%x in Loop Mode\n", + cmd, did); return 1; } @@ -3219,16 +3165,13 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) rps_rsp->primSeqErrCnt = be32_to_cpu(mb->un.varRdLnk.primSeqErrCnt); rps_rsp->invalidXmitWord = be32_to_cpu(mb->un.varRdLnk.invalidXmitWord); rps_rsp->crcCnt = be32_to_cpu(mb->un.varRdLnk.crcCnt); - /* Xmit ELS RPS ACC response tag */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0118 Xmit ELS RPS ACC response tag x%x " - "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " - "rpi x%x\n", - phba->brd_no, ndlp->vport->vpi, elsiocb->iotag, - elsiocb->iocb.ulpContext, ndlp->nlp_DID, - ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); - + lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_ELS, + "0118 Xmit ELS RPS ACC response tag x%x xri x%x, " + "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", + elsiocb->iotag, elsiocb->iocb.ulpContext, + ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, + ndlp->nlp_rpi); elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; phba->fc_stat.elsXmitACC++; if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) @@ -3330,21 +3273,16 @@ lpfc_els_rsp_rpl_acc(struct lpfc_vport *vport, uint16_t cmdsize, rpl_rsp.port_num_blk.portID = be32_to_cpu(vport->fc_myDID); memcpy(&rpl_rsp.port_num_blk.portName, &vport->fc_portname, sizeof(struct lpfc_name)); - memcpy(pcmd, &rpl_rsp, cmdsize - sizeof(uint32_t)); - - /* Xmit ELS RPL ACC response tag */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0120 Xmit ELS RPL ACC response tag x%x " - "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " - "rpi x%x\n", - phba->brd_no, vport->vpi, elsiocb->iotag, - elsiocb->iocb.ulpContext, ndlp->nlp_DID, - ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0120 Xmit ELS RPL ACC response tag x%x " + "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " + "rpi x%x\n", + elsiocb->iotag, elsiocb->iocb.ulpContext, + ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, + ndlp->nlp_rpi); elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; - phba->fc_stat.elsXmitACC++; if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { lpfc_els_free_iocb(phba, elsiocb); @@ -3397,7 +3335,6 @@ static int lpfc_els_rcv_farp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, struct lpfc_nodelist *ndlp) { - struct lpfc_hba *phba = vport->phba; struct lpfc_dmabuf *pcmd; uint32_t *lp; IOCB_t *icmd; @@ -3411,12 +3348,9 @@ lpfc_els_rcv_farp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, cmd = *lp++; fp = (FARP *) lp; - /* FARP-REQ received from DID */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0601 FARP-REQ received from DID x%x\n", - phba->brd_no, vport->vpi, did); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0601 FARP-REQ received from DID x%x\n", did); /* We will only support match on WWPN or WWNN */ if (fp->Mflags & ~(FARP_MATCH_NODE | FARP_MATCH_PORT)) { return 0; @@ -3464,7 +3398,6 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, uint32_t *lp; IOCB_t *icmd; uint32_t cmd, did; - struct lpfc_hba *phba = vport->phba; icmd = &cmdiocb->iocb; did = icmd->un.elsreq64.remoteID; @@ -3473,9 +3406,8 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, cmd = *lp++; /* FARP-RSP received from DID */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0600 FARP-RSP received from DID x%x\n", - phba->brd_no, vport->vpi, did); + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0600 FARP-RSP received from DID x%x\n", did); /* ACCEPT the Farp resp request */ lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); @@ -3495,10 +3427,8 @@ lpfc_els_rcv_fan(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, struct lpfc_hba *phba = vport->phba; /* FAN received */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0265 FAN received\n", - phba->brd_no, vport->vpi); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0265 FAN received\n"); icmd = &cmdiocb->iocb; did = icmd->un.elsreq64.remoteID; pcmd = (struct lpfc_dmabuf *)cmdiocb->context2; @@ -3657,13 +3587,10 @@ lpfc_els_timeout_handler(struct lpfc_vport *vport) if (ndlp) remote_ID = ndlp->nlp_DID; } - - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0127 ELS timeout Data: x%x x%x x%x " - "x%x\n", - phba->brd_no, vport->vpi, els_command, - remote_ID, cmd->ulpCommand, cmd->ulpIoTag); - + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0127 ELS timeout Data: x%x x%x x%x " + "x%x\n", els_command, + remote_ID, cmd->ulpCommand, cmd->ulpIoTag); lpfc_sli_issue_abort_iotag(phba, pring, piocb); } spin_unlock_irq(&phba->hbalock); @@ -3838,11 +3765,9 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, cmd &= ELS_CMD_MASK; } /* ELS command received from NPORT */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0112 ELS command x%x received from NPORT x%x " - "Data: x%x\n", phba->brd_no, vport->vpi, cmd, did, - vport->port_state); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0112 ELS command x%x received from NPORT x%x " + "Data: x%x\n", cmd, did, vport->port_state); switch (cmd) { case ELS_CMD_PLOGI: lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, @@ -4011,10 +3936,9 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, rjt_err = LSRJT_INVALID_CMD; /* Unknown ELS command received from NPORT */ - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0115 Unknown ELS command x%x " - "received from NPORT x%x\n", - phba->brd_no, vport->vpi, cmd, did); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0115 Unknown ELS command x%x " + "received from NPORT x%x\n", cmd, did); if (newnode) lpfc_drop_node(vport, ndlp); break; @@ -4035,11 +3959,10 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, dropit: lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0111 Dropping received ELS cmd " + "(%d):0111 Dropping received ELS cmd " "Data: x%x x%x x%x\n", - phba->brd_no, vport ? vport->vpi : 0xffff, - icmd->ulpStatus, icmd->un.ulpWord[4], - icmd->ulpTimeout); + vport ? vport->vpi : 0xffff, icmd->ulpStatus, + icmd->un.ulpWord[4], icmd->ulpTimeout); phba->fc_stat.elsRcvDrop++; } @@ -4151,9 +4074,8 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport) return; } lpfc_vport_set_state(vport, FC_VPORT_FAILED); - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0251 NameServer login: no memory\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0251 NameServer login: no memory\n"); return; } lpfc_nlp_init(vport, ndlp, NameServer_DID); @@ -4164,9 +4086,8 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport) if (lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0)) { lpfc_vport_set_state(vport, FC_VPORT_FAILED); - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0252 Cannot issue NameServer login\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0252 Cannot issue NameServer login\n"); return; } @@ -4197,9 +4118,9 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) lpfc_nlp_put(ndlp); if (mb->mbxStatus) { - lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, - "%d (%d):0915 Register VPI failed: 0x%x\n", - phba->brd_no, vport->vpi, mb->mbxStatus); + lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, + "0915 Register VPI failed: 0x%x\n", + mb->mbxStatus); switch (mb->mbxStatus) { case 0x11: /* unsupported feature */ @@ -4248,17 +4169,14 @@ lpfc_register_new_vport(struct lpfc_hba *phba, struct lpfc_vport *vport, vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI; lpfc_vport_set_state(vport, FC_VPORT_FAILED); - - lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, - "%d (%d):0253 Register VPI: Cannot send mbox\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, + "0253 Register VPI: Can't send mbox\n"); } } else { lpfc_vport_set_state(vport, FC_VPORT_FAILED); - lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, - "%d (%d):0254 Register VPI: no memory\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, + "0254 Register VPI: no memory\n"); vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI; lpfc_nlp_put(ndlp); @@ -4277,11 +4195,10 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, IOCB_t *irsp = &rspiocb->iocb; struct lpfc_iocbq *piocb; - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0123 FDISC completes. x%x/x%x prevDID: x%x\n", - phba->brd_no, vport->vpi, - irsp->ulpStatus, irsp->un.ulpWord[4], vport->fc_prevDID); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0123 FDISC completes. x%x/x%x prevDID: x%x\n", + irsp->ulpStatus, irsp->un.ulpWord[4], + vport->fc_prevDID); /* Since all FDISCs are being single threaded, we * must reset the discovery timer for ALL vports * waiting to send FDISC when one completes. @@ -4298,13 +4215,10 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, /* Check for retry */ if (lpfc_els_retry(phba, cmdiocb, rspiocb)) goto out; - /* FDISC failed */ - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0124 FDISC failed. (%d/%d)\n", - phba->brd_no, vport->vpi, - irsp->ulpStatus, irsp->un.ulpWord[4]); - + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0124 FDISC failed. (%d/%d)\n", + irsp->ulpStatus, irsp->un.ulpWord[4]); if (vport->fc_vport->vport_state == FC_VPORT_INITIALIZING) lpfc_vport_set_state(vport, FC_VPORT_FAILED); @@ -4370,10 +4284,8 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, ELS_CMD_FDISC); if (!elsiocb) { lpfc_vport_set_state(vport, FC_VPORT_FAILED); - - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0255 Issue FDISC: no IOCB\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0255 Issue FDISC: no IOCB\n"); return 1; } @@ -4419,11 +4331,8 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, if (rc == IOCB_ERROR) { lpfc_els_free_iocb(phba, elsiocb); lpfc_vport_set_state(vport, FC_VPORT_FAILED); - - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0256 Issue FDISC: Cannot send IOCB\n", - phba->brd_no, vport->vpi); - + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0256 Issue FDISC: Cannot send IOCB\n"); return 1; } lpfc_vport_set_state(vport, FC_VPORT_INITIALIZING); diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 914e74ac11e5..55c4e5455a57 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -201,25 +201,23 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) warn_on = 0; if (warn_on) { - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0203 Devloss timeout on " - "WWPN %x:%x:%x:%x:%x:%x:%x:%x " - "NPort x%x Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, - *name, *(name+1), *(name+2), *(name+3), - *(name+4), *(name+5), *(name+6), *(name+7), - ndlp->nlp_DID, ndlp->nlp_flag, - ndlp->nlp_state, ndlp->nlp_rpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0203 Devloss timeout on " + "WWPN %x:%x:%x:%x:%x:%x:%x:%x " + "NPort x%x Data: x%x x%x x%x\n", + *name, *(name+1), *(name+2), *(name+3), + *(name+4), *(name+5), *(name+6), *(name+7), + ndlp->nlp_DID, ndlp->nlp_flag, + ndlp->nlp_state, ndlp->nlp_rpi); } else { - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0204 Devloss timeout on " - "WWPN %x:%x:%x:%x:%x:%x:%x:%x " - "NPort x%x Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, - *name, *(name+1), *(name+2), *(name+3), - *(name+4), *(name+5), *(name+6), *(name+7), - ndlp->nlp_DID, ndlp->nlp_flag, - ndlp->nlp_state, ndlp->nlp_rpi); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0204 Devloss timeout on " + "WWPN %x:%x:%x:%x:%x:%x:%x:%x " + "NPort x%x Data: x%x x%x x%x\n", + *name, *(name+1), *(name+2), *(name+3), + *(name+4), *(name+5), *(name+6), *(name+7), + ndlp->nlp_DID, ndlp->nlp_flag, + ndlp->nlp_state, ndlp->nlp_rpi); } if (!(vport->load_flag & FC_UNLOADING) && @@ -750,12 +748,10 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) /* Check for error */ if ((mb->mbxStatus) && (mb->mbxStatus != 0x1601)) { /* CLEAR_LA mbox error state */ - lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, - "%d (%d):0320 CLEAR_LA mbxStatus error x%x hba " - "state x%x\n", - phba->brd_no, vport->vpi, mb->mbxStatus, - vport->port_state); - + lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, + "0320 CLEAR_LA mbxStatus error x%x hba " + "state x%x\n", + mb->mbxStatus, vport->port_state); phba->link_state = LPFC_HBA_ERROR; goto out; } @@ -787,10 +783,8 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) out: /* Device Discovery completes */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0225 Device Discovery completes\n", - phba->brd_no, vport->vpi); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0225 Device Discovery completes\n"); mempool_free(pmb, phba->mbox_mem_pool); spin_lock_irq(shost->host_lock); @@ -847,19 +841,17 @@ lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) return; out: - lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, - "%d (%d):0306 CONFIG_LINK mbxStatus error x%x " - "HBA state x%x\n", - phba->brd_no, vport->vpi, pmb->mb.mbxStatus, - vport->port_state); - + lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, + "0306 CONFIG_LINK mbxStatus error x%x " + "HBA state x%x\n", + pmb->mb.mbxStatus, vport->port_state); mempool_free(pmb, phba->mbox_mem_pool); lpfc_linkdown(phba); - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0200 CONFIG_LINK bad hba state x%x\n", - phba->brd_no, vport->vpi, vport->port_state); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0200 CONFIG_LINK bad hba state x%x\n", + vport->port_state); lpfc_issue_clear_la(phba, vport); return; @@ -876,12 +868,10 @@ lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) /* Check for error */ if (mb->mbxStatus) { /* READ_SPARAM mbox error state */ - lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, - "%d (%d):0319 READ_SPARAM mbxStatus error x%x " - "hba state x%x>\n", - phba->brd_no, vport->vpi, mb->mbxStatus, - vport->port_state); - + lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, + "0319 READ_SPARAM mbxStatus error x%x " + "hba state x%x>\n", + mb->mbxStatus, vport->port_state); lpfc_linkdown(phba); goto out; } @@ -964,7 +954,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) if (i == 0) { phba->alpa_map[0] = 0; } else { - if (phba->cfg_log_verbose & LOG_LINK_EVENT) { + if (vport->cfg_log_verbose & LOG_LINK_EVENT) { int numalpa, j, k; union { uint8_t pamap[16]; @@ -990,10 +980,9 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT, - "%d:1304 Link Up Event " + "1304 Link Up Event " "ALPA map Data: x%x " "x%x x%x x%x\n", - phba->brd_no, un.pa.wd1, un.pa.wd2, un.pa.wd3, un.pa.wd4); } @@ -1041,11 +1030,9 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) } out: lpfc_vport_set_state(vport, FC_VPORT_FAILED); - lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, - "%d (%d):0263 Discovery Mailbox error: state: 0x%x : %p %p\n", - phba->brd_no, vport->vpi, - vport->port_state, sparam_mbox, cfglink_mbox); - + lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, + "0263 Discovery Mailbox error: state: 0x%x : %p %p\n", + vport->port_state, sparam_mbox, cfglink_mbox); lpfc_issue_clear_la(phba, vport); return; } @@ -1086,8 +1073,8 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) /* Check for error */ if (mb->mbxStatus) { lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, - "%d:1307 READ_LA mbox error x%x state x%x\n", - phba->brd_no, mb->mbxStatus, vport->port_state); + "1307 READ_LA mbox error x%x state x%x\n", + mb->mbxStatus, vport->port_state); lpfc_mbx_issue_link_down(phba); phba->link_state = LPFC_HBA_ERROR; goto lpfc_mbx_cmpl_read_la_free_mbuf; @@ -1118,26 +1105,26 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) phba->fc_stat.LinkUp++; if (phba->link_flag & LS_LOOPBACK_MODE) { lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, - "%d:1306 Link Up Event in loop back mode " - "x%x received Data: x%x x%x x%x x%x\n", - phba->brd_no, la->eventTag, phba->fc_eventTag, - la->granted_AL_PA, la->UlnkSpeed, - phba->alpa_map[0]); + "1306 Link Up Event in loop back mode " + "x%x received Data: x%x x%x x%x x%x\n", + la->eventTag, phba->fc_eventTag, + la->granted_AL_PA, la->UlnkSpeed, + phba->alpa_map[0]); } else { lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, - "%d:1303 Link Up Event x%x received " - "Data: x%x x%x x%x x%x\n", - phba->brd_no, la->eventTag, phba->fc_eventTag, - la->granted_AL_PA, la->UlnkSpeed, - phba->alpa_map[0]); + "1303 Link Up Event x%x received " + "Data: x%x x%x x%x x%x\n", + la->eventTag, phba->fc_eventTag, + la->granted_AL_PA, la->UlnkSpeed, + phba->alpa_map[0]); } lpfc_mbx_process_link_up(phba, la); } else { phba->fc_stat.LinkDown++; lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, - "%d:1305 Link Down Event x%x received " + "1305 Link Down Event x%x received " "Data: x%x x%x x%x\n", - phba->brd_no, la->eventTag, phba->fc_eventTag, + la->eventTag, phba->fc_eventTag, phba->pport->port_state, vport->fc_flag); lpfc_mbx_issue_link_down(phba); } @@ -1185,10 +1172,9 @@ lpfc_mbx_cmpl_unreg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) case 0x0011: case 0x0020: case 0x9700: - lpfc_printf_log(phba, KERN_INFO, LOG_NODE, - "%d (%d):0911 cmpl_unreg_vpi, " - "mb status = 0x%x\n", - phba->brd_no, vport->vpi, mb->mbxStatus); + lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, + "0911 cmpl_unreg_vpi, mb status = 0x%x\n", + mb->mbxStatus); break; } vport->unreg_vpi_cmpl = VPORT_OK; @@ -1217,9 +1203,8 @@ lpfc_mbx_unreg_vpi(struct lpfc_vport *vport) mbox->mbox_cmpl = lpfc_mbx_cmpl_unreg_vpi; rc = lpfc_sli_issue_mbox(phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); if (rc == MBX_NOT_FINISHED) { - lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_VPORT, - "%d (%d):1800 Could not issue unreg_vpi\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT, + "1800 Could not issue unreg_vpi\n"); mempool_free(mbox, phba->mbox_mem_pool); vport->unreg_vpi_cmpl = VPORT_ERROR; } @@ -1236,9 +1221,9 @@ lpfc_mbx_cmpl_reg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) case 0x0011: case 0x9601: case 0x9602: - lpfc_printf_log(phba, KERN_INFO, LOG_NODE, - "%d (%d):0912 cmpl_reg_vpi, mb status = 0x%x\n", - phba->brd_no, vport->vpi, mb->mbxStatus); + lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, + "0912 cmpl_reg_vpi, mb status = 0x%x\n", + mb->mbxStatus); lpfc_vport_set_state(vport, FC_VPORT_FAILED); spin_lock_irq(shost->host_lock); vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); @@ -1300,10 +1285,9 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) } lpfc_vport_set_state(vport, FC_VPORT_FAILED); - lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, - "%d (%d):0258 Register Fabric login error: 0x%x\n", - phba->brd_no, vport->vpi, mb->mbxStatus); - + lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, + "0258 Register Fabric login error: 0x%x\n", + mb->mbxStatus); return; } @@ -1327,11 +1311,10 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) LPFC_SLI3_NPIV_ENABLED) { lpfc_vport_set_state(vports[i], FC_VPORT_NO_FABRIC_SUPP); - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0259 No NPIV " - "Fabric support\n", - phba->brd_no, - vports[i]->vpi); + lpfc_printf_vlog(vport, KERN_ERR, + LOG_ELS, + "0259 No NPIV " + "Fabric support\n"); } } lpfc_destroy_vport_work_array(vports); @@ -1378,9 +1361,9 @@ out: return; } lpfc_vport_set_state(vport, FC_VPORT_FAILED); - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0260 Register NameServer error: 0x%x\n", - phba->brd_no, vport->vpi, mb->mbxStatus); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0260 Register NameServer error: 0x%x\n", + mb->mbxStatus); return; } @@ -1605,12 +1588,11 @@ lpfc_nlp_set_state(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int old_state = ndlp->nlp_state; char name1[16], name2[16]; - lpfc_printf_log(vport->phba, KERN_INFO, LOG_NODE, - "%d (%d):0904 NPort state transition x%06x, %s -> %s\n", - vport->phba->brd_no, vport->vpi, - ndlp->nlp_DID, - lpfc_nlp_state_name(name1, sizeof(name1), old_state), - lpfc_nlp_state_name(name2, sizeof(name2), state)); + lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, + "0904 NPort state transition x%06x, %s -> %s\n", + ndlp->nlp_DID, + lpfc_nlp_state_name(name1, sizeof(name1), old_state), + lpfc_nlp_state_name(name2, sizeof(name2), state)); lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE, "node statechg did:x%x old:%d ste:%d", @@ -1702,12 +1684,12 @@ lpfc_set_disctmo(struct lpfc_vport *vport) spin_unlock_irq(shost->host_lock); /* Start Discovery Timer state */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0247 Start Discovery Timer state x%x " - "Data: x%x x%lx x%x x%x\n", - phba->brd_no, vport->vpi, vport->port_state, tmo, - (unsigned long)&vport->fc_disctmo, vport->fc_plogi_cnt, - vport->fc_adisc_cnt); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0247 Start Discovery Timer state x%x " + "Data: x%x x%lx x%x x%x\n", + vport->port_state, tmo, + (unsigned long)&vport->fc_disctmo, vport->fc_plogi_cnt, + vport->fc_adisc_cnt); return; } @@ -1719,7 +1701,6 @@ int lpfc_can_disctmo(struct lpfc_vport *vport) { struct Scsi_Host *shost = lpfc_shost_from_vport(vport); - struct lpfc_hba *phba = vport->phba; unsigned long iflags; lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, @@ -1738,13 +1719,11 @@ lpfc_can_disctmo(struct lpfc_vport *vport) } /* Cancel Discovery Timer state */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0248 Cancel Discovery Timer state x%x " - "Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, vport->port_state, - vport->fc_flag, vport->fc_plogi_cnt, - vport->fc_adisc_cnt); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0248 Cancel Discovery Timer state x%x " + "Data: x%x x%x x%x\n", + vport->port_state, vport->fc_flag, + vport->fc_plogi_cnt, vport->fc_adisc_cnt); return 0; } @@ -1927,10 +1906,9 @@ lpfc_unreg_default_rpis(struct lpfc_vport *vport) rc = lpfc_sli_issue_mbox(phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); if (rc == MBX_NOT_FINISHED) { - lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_VPORT, - "%d (%d):1815 Could not issue " - "unreg_did (default rpis)\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT, + "1815 Could not issue " + "unreg_did (default rpis)\n"); mempool_free(mbox, phba->mbox_mem_pool); } } @@ -1949,12 +1927,11 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) struct lpfc_dmabuf *mp; /* Cleanup node for NPort */ - lpfc_printf_log(phba, KERN_INFO, LOG_NODE, - "%d (%d):0900 Cleanup node for NPort x%x " - "Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, ndlp->nlp_DID, ndlp->nlp_flag, - ndlp->nlp_state, ndlp->nlp_rpi); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, + "0900 Cleanup node for NPort x%x " + "Data: x%x x%x x%x\n", + ndlp->nlp_DID, ndlp->nlp_flag, + ndlp->nlp_state, ndlp->nlp_rpi); lpfc_dequeue_node(vport, ndlp); /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ @@ -2086,7 +2063,6 @@ lpfc_matchdid(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, static struct lpfc_nodelist * __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) { - struct lpfc_hba *phba = vport->phba; struct lpfc_nodelist *ndlp; uint32_t data1; @@ -2096,20 +2072,18 @@ __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) ((uint32_t) ndlp->nlp_xri << 16) | ((uint32_t) ndlp->nlp_type << 8) | ((uint32_t) ndlp->nlp_rpi & 0xff)); - lpfc_printf_log(phba, KERN_INFO, LOG_NODE, - "%d (%d):0929 FIND node DID " - " Data: x%p x%x x%x x%x\n", - phba->brd_no, vport->vpi, - ndlp, ndlp->nlp_DID, - ndlp->nlp_flag, data1); + lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, + "0929 FIND node DID " + "Data: x%p x%x x%x x%x\n", + ndlp, ndlp->nlp_DID, + ndlp->nlp_flag, data1); return ndlp; } } /* FIND node did NOT FOUND */ - lpfc_printf_log(phba, KERN_INFO, LOG_NODE, - "%d (%d):0932 FIND node did x%x NOT FOUND.\n", - phba->brd_no, vport->vpi, did); + lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, + "0932 FIND node did x%x NOT FOUND.\n", did); return NULL; } @@ -2301,12 +2275,11 @@ lpfc_disc_start(struct lpfc_vport *vport) vport->num_disc_nodes = 0; /* Start Discovery state */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0202 Start Discovery hba state x%x " - "Data: x%x x%x x%x\n", - phba->brd_no, vport->vpi, vport->port_state, - vport->fc_flag, vport->fc_plogi_cnt, - vport->fc_adisc_cnt); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0202 Start Discovery hba state x%x " + "Data: x%x x%x x%x\n", + vport->port_state, vport->fc_flag, vport->fc_plogi_cnt, + vport->fc_adisc_cnt); /* First do ADISCs - if any */ num_sent = lpfc_els_disc_adisc(vport); @@ -2524,10 +2497,8 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) * FAN */ /* FAN timeout */ - lpfc_printf_log(phba, KERN_WARNING, LOG_DISCOVERY, - "%d (%d):0221 FAN timeout\n", - phba->brd_no, vport->vpi); - + lpfc_printf_vlog(vport, KERN_WARNING, LOG_DISCOVERY, + "0221 FAN timeout\n"); /* Start discovery by sending FLOGI, clean up old rpis */ list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { @@ -2554,10 +2525,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) case LPFC_FLOGI: /* port_state is identically LPFC_FLOGI while waiting for FLOGI cmpl */ /* Initial FLOGI timeout */ - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0222 Initial %s timeout\n", - phba->brd_no, vport->vpi, - vport->vpi ? "FLOGI" : "FDISC"); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0222 Initial %s timeout\n", + vport->vpi ? "FLOGI" : "FDISC"); /* Assume no Fabric and go on with discovery. * Check for outstanding ELS FLOGI to abort. @@ -2573,11 +2543,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) case LPFC_FABRIC_CFG_LINK: /* hba_state is identically LPFC_FABRIC_CFG_LINK while waiting for NameServer login */ - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0223 Timeout while waiting for " - "NameServer login\n", - phba->brd_no, vport->vpi); - + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0223 Timeout while waiting for " + "NameServer login\n"); /* Next look for NameServer ndlp */ ndlp = lpfc_findnode_did(vport, NameServer_DID); if (ndlp) @@ -2588,11 +2556,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) case LPFC_NS_QRY: /* Check for wait for NameServer Rsp timeout */ - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0224 NameServer Query timeout " - "Data: x%x x%x\n", - phba->brd_no, vport->vpi, - vport->fc_ns_retry, LPFC_MAX_NS_RETRY); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0224 NameServer Query timeout " + "Data: x%x x%x\n", + vport->fc_ns_retry, LPFC_MAX_NS_RETRY); if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) { /* Try it one more time */ @@ -2619,10 +2586,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) /* Setup and issue mailbox INITIALIZE LINK command */ initlinkmbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); if (!initlinkmbox) { - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0206 Device Discovery " - "completion error\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0206 Device Discovery " + "completion error\n"); phba->link_state = LPFC_HBA_ERROR; break; } @@ -2643,9 +2609,8 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) case LPFC_DISC_AUTH: /* Node Authentication timeout */ - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0227 Node Authentication timeout\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0227 Node Authentication timeout\n"); lpfc_disc_flush_list(vport); /* @@ -2662,11 +2627,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) case LPFC_VPORT_READY: if (vport->fc_flag & FC_RSCN_MODE) { - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0231 RSCN timeout Data: x%x " - "x%x\n", - phba->brd_no, vport->vpi, - vport->fc_ns_retry, LPFC_MAX_NS_RETRY); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0231 RSCN timeout Data: x%x " + "x%x\n", + vport->fc_ns_retry, LPFC_MAX_NS_RETRY); /* Cleanup any outstanding ELS commands */ lpfc_els_flush_cmd(vport); @@ -2677,20 +2641,17 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) break; default: - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0229 Unexpected discovery timeout, " - "vport State x%x\n", - phba->brd_no, vport->vpi, vport->port_state); - + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0229 Unexpected discovery timeout, " + "vport State x%x\n", vport->port_state); break; } switch (phba->link_state) { case LPFC_CLEAR_LA: /* CLEAR LA timeout */ - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0228 CLEAR LA timeout\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0228 CLEAR LA timeout\n"); clrlaerr = 1; break; @@ -2701,10 +2662,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) case LPFC_LINK_DOWN: case LPFC_LINK_UP: case LPFC_HBA_ERROR: - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0230 Unexpected timeout, hba link " - "state x%x\n", - phba->brd_no, vport->vpi, phba->link_state); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0230 Unexpected timeout, hba link " + "state x%x\n", phba->link_state); clrlaerr = 1; break; diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 83855a5a1826..7e5ea0774e58 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -107,10 +107,9 @@ lpfc_config_port_prep(struct lpfc_hba *phba) if (rc != MBX_SUCCESS) { lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, - "%d:0324 Config Port initialization " + "0324 Config Port initialization " "error, mbxCmd x%x READ_NVPARM, " "mbxStatus x%x\n", - phba->brd_no, mb->mbxCommand, mb->mbxStatus); mempool_free(pmb, phba->mbox_mem_pool); return -ERESTART; @@ -128,9 +127,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba) rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); if (rc != MBX_SUCCESS) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0439 Adapter failed to init, mbxCmd x%x " + "0439 Adapter failed to init, mbxCmd x%x " "READ_REV, mbxStatus x%x\n", - phba->brd_no, mb->mbxCommand, mb->mbxStatus); mempool_free( pmb, phba->mbox_mem_pool); return -ERESTART; @@ -144,9 +142,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba) if (mb->un.varRdRev.rr == 0) { vp->rev.rBit = 0; lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0440 Adapter failed to init, READ_REV has " - "missing revision information.\n", - phba->brd_no); + "0440 Adapter failed to init, READ_REV has " + "missing revision information.\n"); mempool_free(pmb, phba->mbox_mem_pool); return -ERESTART; } @@ -197,9 +194,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba) if (rc != MBX_SUCCESS) { lpfc_printf_log(phba, KERN_INFO, LOG_INIT, - "%d:0441 VPD not present on adapter, " + "0441 VPD not present on adapter, " "mbxCmd x%x DUMP VPD, mbxStatus x%x\n", - phba->brd_no, mb->mbxCommand, mb->mbxStatus); mb->un.varDmp.word_cnt = 0; } @@ -253,9 +249,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) pmb->vport = vport; if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0448 Adapter failed init, mbxCmd x%x " + "0448 Adapter failed init, mbxCmd x%x " "READ_SPARM mbxStatus x%x\n", - phba->brd_no, mb->mbxCommand, mb->mbxStatus); phba->link_state = LPFC_HBA_ERROR; mp = (struct lpfc_dmabuf *) pmb->context1; @@ -312,9 +307,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) pmb->vport = vport; if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0453 Adapter failed to init, mbxCmd x%x " + "0453 Adapter failed to init, mbxCmd x%x " "READ_CONFIG, mbxStatus x%x\n", - phba->brd_no, mb->mbxCommand, mb->mbxStatus); phba->link_state = LPFC_HBA_ERROR; mempool_free( pmb, phba->mbox_mem_pool); @@ -344,9 +338,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) && !(phba->lmt & LMT_10Gb))) { /* Reset link speed to auto */ lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT, - "%d:1302 Invalid speed for this board: " + "1302 Invalid speed for this board: " "Reset link speed to auto: x%x\n", - phba->brd_no, phba->cfg_link_speed); phba->cfg_link_speed = LINK_SPEED_AUTO; } @@ -402,9 +395,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) lpfc_set_loopback_flag(phba); if (rc != MBX_SUCCESS) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0454 Adapter failed to init, mbxCmd x%x " + "0454 Adapter failed to init, mbxCmd x%x " "INIT_LINK, mbxStatus x%x\n", - phba->brd_no, mb->mbxCommand, mb->mbxStatus); /* Clear all interrupt enable conditions */ @@ -588,8 +580,8 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba) * need to take the HBA offline. */ lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0459 Adapter heartbeat failure, taking " - "this port offline.\n", phba->brd_no); + "0459 Adapter heartbeat failure, taking " + "this port offline.\n"); spin_lock_irq(&phba->hbalock); psli->sli_flag &= ~LPFC_SLI2_ACTIVE; @@ -631,9 +623,9 @@ lpfc_handle_eratt(struct lpfc_hba *phba) phba->work_hs & HS_FFER5) { /* Re-establishing Link */ lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, - "%d:1301 Re-establishing Link " + "1301 Re-establishing Link " "Data: x%x x%x x%x\n", - phba->brd_no, phba->work_hs, + phba->work_hs, phba->work_status[0], phba->work_status[1]); vports = lpfc_create_vport_work_array(phba); if (vports != NULL) @@ -679,9 +671,9 @@ lpfc_handle_eratt(struct lpfc_hba *phba) * twice. This is the adapter hardware error path. */ lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0457 Adapter Hardware Error " + "0457 Adapter Hardware Error " "Data: x%x x%x x%x\n", - phba->brd_no, phba->work_hs, + phba->work_hs, phba->work_status[0], phba->work_status[1]); event_data = FC_REG_DUMP_EVENT; @@ -777,8 +769,7 @@ lpfc_handle_latt_err_exit: /* The other case is an error from issue_mbox */ if (rc == -ENOMEM) lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, - "%d:0300 READ_LA: no buffers\n", - phba->brd_no); + "0300 READ_LA: no buffers\n"); return; } @@ -803,8 +794,7 @@ lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) /* Vital Product */ lpfc_printf_log(phba, KERN_INFO, LOG_INIT, - "%d:0455 Vital Product Data: x%x x%x x%x x%x\n", - phba->brd_no, + "0455 Vital Product Data: x%x x%x x%x x%x\n", (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2], (uint32_t) vpd[3]); while (!finished && (index < (len - 4))) { @@ -1323,10 +1313,9 @@ lpfc_establish_link_tmo(unsigned long ptr) /* Re-establishing Link, timer expired */ lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, - "%d:1300 Re-establishing Link, timer expired " + "1300 Re-establishing Link, timer expired " "Data: x%x x%x\n", - phba->brd_no, phba->pport->fc_flag, - phba->pport->port_state); + phba->pport->fc_flag, phba->pport->port_state); vports = lpfc_create_vport_work_array(phba); if (vports != NULL) for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { @@ -1382,8 +1371,7 @@ lpfc_online(struct lpfc_hba *phba) return 0; lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, - "%d:0458 Bring Adapter online\n", - phba->brd_no); + "0458 Bring Adapter online\n"); lpfc_block_mgmt_io(phba); @@ -1468,8 +1456,7 @@ lpfc_offline(struct lpfc_hba *phba) /* stop all timers associated with this hba */ lpfc_stop_phba_timers(phba); lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, - "%d:0460 Bring Adapter offline\n", - phba->brd_no); + "0460 Bring Adapter offline\n"); /* Bring down the SLI Layer and cleanup. The HBA is offline now. */ lpfc_sli_hba_down(phba); @@ -1648,17 +1635,15 @@ int lpfc_scan_finished(struct Scsi_Host *shost, unsigned long time) } if (time >= 30 * HZ) { lpfc_printf_log(phba, KERN_INFO, LOG_INIT, - "%d:0461 Scanning longer than 30 " - "seconds. Continuing initialization\n", - phba->brd_no); + "0461 Scanning longer than 30 " + "seconds. Continuing initialization\n"); stat = 1; goto finished; } if (time >= 15 * HZ && phba->link_state <= LPFC_LINK_DOWN) { lpfc_printf_log(phba, KERN_INFO, LOG_INIT, - "%d:0465 Link down longer than 15 " - "seconds. Continuing initialization\n", - phba->brd_no); + "0465 Link down longer than 15 " + "seconds. Continuing initialization\n"); stat = 1; goto finished; } @@ -1910,17 +1895,16 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) if (phba->cfg_use_msi) { error = pci_enable_msi(phba->pcidev); if (error) - lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "%d:0452 " - "Enable MSI failed, continuing with " - "IRQ\n", phba->brd_no); + lpfc_printf_log(phba, KERN_INFO, LOG_INIT, + "0452 Enable MSI failed, continuing " + "with IRQ\n"); } error = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED, LPFC_DRIVER_NAME, phba); if (error) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0451 Enable interrupt handler failed\n", - phba->brd_no); + "0451 Enable interrupt handler failed\n"); goto out_disable_msi; } diff --git a/drivers/scsi/lpfc/lpfc_logmsg.h b/drivers/scsi/lpfc/lpfc_logmsg.h index 8a6ceffeabcf..626e4d878725 100644 --- a/drivers/scsi/lpfc/lpfc_logmsg.h +++ b/drivers/scsi/lpfc/lpfc_logmsg.h @@ -33,6 +33,12 @@ #define LOG_VPORT 0x4000 /* NPIV events */ #define LOG_ALL_MSG 0xffff /* LOG all messages */ +#define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \ + { if (((mask) &(vport)->cfg_log_verbose) || (level[1] <= '3')) \ + dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \ + fmt, (vport)->phba->brd_no, vport->vpi, ##arg); } + #define lpfc_printf_log(phba, level, mask, fmt, arg...) \ - { if (((mask) &(phba)->cfg_log_verbose) || (level[1] <= '3')) \ - dev_printk(level, &((phba)->pcidev)->dev, fmt, ##arg); } + { if (((mask) &(phba)->pport->cfg_log_verbose) || (level[1] <= '3')) \ + dev_printk(level, &((phba)->pcidev)->dev, "%d:" \ + fmt, phba->brd_no, ##arg); } diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index 8f42fbfdd29e..5fa1c6f70a98 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c @@ -275,11 +275,8 @@ lpfc_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, int vpi) kfree(mp); mb->mbxCommand = MBX_READ_SPARM64; /* READ_SPARAM: no buffers */ - lpfc_printf_log(phba, - KERN_WARNING, - LOG_MBOX, - "%d:0301 READ_SPARAM: no buffers\n", - phba->brd_no); + lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, + "0301 READ_SPARAM: no buffers\n"); return (1); } INIT_LIST_HEAD(&mp->list); @@ -378,9 +375,8 @@ lpfc_reg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t did, mb->mbxCommand = MBX_REG_LOGIN64; /* REG_LOGIN: no buffers */ lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, - "%d (%d):0302 REG_LOGIN: no buffers, DID x%x, " - "flag x%x\n", - phba->brd_no, vpi, did, flag); + "0302 REG_LOGIN: no buffers, VPI:%d DID:x%x, " + "flag x%x\n", vpi, did, flag); return (1); } INIT_LIST_HEAD(&mp->list); diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 9c159a8e6e8c..66ba51cbeb50 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -133,15 +133,15 @@ lpfc_check_sparm(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, memcpy(&ndlp->nlp_portname, &sp->portName, sizeof (struct lpfc_name)); return 1; bad_service_param: - lpfc_printf_log(vport->phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0207 Device %x " - "(%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x) sent " - "invalid service parameters. Ignoring device.\n", - vport->phba->brd_no, ndlp->vport->vpi, ndlp->nlp_DID, - sp->nodeName.u.wwn[0], sp->nodeName.u.wwn[1], - sp->nodeName.u.wwn[2], sp->nodeName.u.wwn[3], - sp->nodeName.u.wwn[4], sp->nodeName.u.wwn[5], - sp->nodeName.u.wwn[6], sp->nodeName.u.wwn[7]); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0207 Device %x " + "(%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x) sent " + "invalid service parameters. Ignoring device.\n", + ndlp->nlp_DID, + sp->nodeName.u.wwn[0], sp->nodeName.u.wwn[1], + sp->nodeName.u.wwn[2], sp->nodeName.u.wwn[3], + sp->nodeName.u.wwn[4], sp->nodeName.u.wwn[5], + sp->nodeName.u.wwn[6], sp->nodeName.u.wwn[7]); return 0; } @@ -194,11 +194,11 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) IOCB_t *cmd; /* Abort outstanding I/O on NPort */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0205 Abort outstanding I/O on NPort x%x " - "Data: x%x x%x x%x\n", - phba->brd_no, ndlp->vport->vpi, ndlp->nlp_DID, - ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); + lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_DISCOVERY, + "0205 Abort outstanding I/O on NPort x%x " + "Data: x%x x%x x%x\n", + ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, + ndlp->nlp_rpi); lpfc_fabric_abort_nport(ndlp); @@ -298,11 +298,10 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, icmd = &cmdiocb->iocb; /* PLOGI chkparm OK */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0114 PLOGI chkparm OK Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, - ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, - ndlp->nlp_rpi); + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0114 PLOGI chkparm OK Data: x%x x%x x%x x%x\n", + ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, + ndlp->nlp_rpi); if (vport->cfg_fcp_class == 2 && sp->cls2.classValid) ndlp->nlp_fcp_info |= CLASS2; @@ -582,12 +581,11 @@ static uint32_t lpfc_disc_illegal(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, void *arg, uint32_t evt) { - lpfc_printf_log(vport->phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0253 Illegal State Transition: node x%x " - "event x%x, state x%x Data: x%x x%x\n", - vport->phba->brd_no, vport->vpi, - ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi, - ndlp->nlp_flag); + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0253 Illegal State Transition: node x%x " + "event x%x, state x%x Data: x%x x%x\n", + ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi, + ndlp->nlp_flag); return ndlp->nlp_state; } @@ -777,15 +775,11 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t)); if (!lpfc_check_sparm(vport, ndlp, sp, CLASS3)) goto out; - /* PLOGI chkparm OK */ - lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (%d):0121 PLOGI chkparm OK " - "Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, - ndlp->nlp_DID, ndlp->nlp_state, - ndlp->nlp_flag, ndlp->nlp_rpi); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0121 PLOGI chkparm OK Data: x%x x%x x%x x%x\n", + ndlp->nlp_DID, ndlp->nlp_state, + ndlp->nlp_flag, ndlp->nlp_rpi); if (vport->cfg_fcp_class == 2 && (sp->cls2.classValid)) ndlp->nlp_fcp_info |= CLASS2; else @@ -805,10 +799,9 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); if (!mbox) { - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0133 PLOGI: no memory for reg_login " + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0133 PLOGI: no memory for reg_login " "Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, ndlp->nlp_rpi); goto out; @@ -843,30 +836,27 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, kfree(mp); mempool_free(mbox, phba->mbox_mem_pool); - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0134 PLOGI: cannot issue reg_login " - "Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, - ndlp->nlp_DID, ndlp->nlp_state, - ndlp->nlp_flag, ndlp->nlp_rpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0134 PLOGI: cannot issue reg_login " + "Data: x%x x%x x%x x%x\n", + ndlp->nlp_DID, ndlp->nlp_state, + ndlp->nlp_flag, ndlp->nlp_rpi); } else { mempool_free(mbox, phba->mbox_mem_pool); - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0135 PLOGI: cannot format reg_login " - "Data: x%x x%x x%x x%x\n", - phba->brd_no, vport->vpi, - ndlp->nlp_DID, ndlp->nlp_state, - ndlp->nlp_flag, ndlp->nlp_rpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0135 PLOGI: cannot format reg_login " + "Data: x%x x%x x%x x%x\n", + ndlp->nlp_DID, ndlp->nlp_state, + ndlp->nlp_flag, ndlp->nlp_rpi); } out: if (ndlp->nlp_DID == NameServer_DID) { lpfc_vport_set_state(vport, FC_VPORT_FAILED); - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0261 Cannot Register NameServer login\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0261 Cannot Register NameServer login\n"); } /* Free this node since the driver cannot login or has the wrong @@ -1188,19 +1178,15 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport, uint32_t evt) { struct Scsi_Host *shost = lpfc_shost_from_vport(vport); - struct lpfc_hba *phba = vport->phba; LPFC_MBOXQ_t *pmb = (LPFC_MBOXQ_t *) arg; MAILBOX_t *mb = &pmb->mb; uint32_t did = mb->un.varWords[1]; if (mb->mbxStatus) { /* RegLogin failed */ - lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, - "%d (%d):0246 RegLogin failed Data: x%x x%x " - "x%x\n", - phba->brd_no, vport->vpi, + lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + "0246 RegLogin failed Data: x%x x%x x%x\n", did, mb->mbxStatus, vport->port_state); - /* * If RegLogin failed due to lack of HBA resources do not * retry discovery. @@ -2046,7 +2032,6 @@ int lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, void *arg, uint32_t evt) { - struct lpfc_hba *phba = vport->phba; uint32_t cur_state, rc; uint32_t(*func) (struct lpfc_vport *, struct lpfc_nodelist *, void *, uint32_t); @@ -2055,11 +2040,10 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, cur_state = ndlp->nlp_state; /* DSM in event on NPort in state */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0211 DSM in event x%x on NPort x%x in " - "state %d Data: x%x\n", - phba->brd_no, vport->vpi, - evt, ndlp->nlp_DID, cur_state, ndlp->nlp_flag); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0211 DSM in event x%x on NPort x%x in " + "state %d Data: x%x\n", + evt, ndlp->nlp_DID, cur_state, ndlp->nlp_flag); lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, "DSM in: evt:%d ste:%d did:x%x", @@ -2069,11 +2053,9 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, rc = (func) (vport, ndlp, arg, evt); /* DSM out state on NPort */ - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, - "%d (%d):0212 DSM out state %d on NPort x%x " - "Data: x%x\n", - phba->brd_no, vport->vpi, - rc, ndlp->nlp_DID, ndlp->nlp_flag); + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0212 DSM out state %d on NPort x%x Data: x%x\n", + rc, ndlp->nlp_DID, ndlp->nlp_flag); lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, "DSM out: ste:%d did:x%x flg:x%x", diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 78666c62330e..9ee2927ad82a 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -406,9 +406,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, struct scsi_cmnd *cmnd = lpfc_cmd->pCmd; struct fcp_cmnd *fcpcmd = lpfc_cmd->fcp_cmnd; struct fcp_rsp *fcprsp = lpfc_cmd->fcp_rsp; - struct lpfc_hba *phba = vport->phba; uint32_t fcpi_parm = rsp_iocb->iocb.un.fcpi.fcpi_parm; - uint32_t vpi = vport->vpi; uint32_t resp_info = fcprsp->rspStatus2; uint32_t scsi_status = fcprsp->rspStatus3; uint32_t *lp; @@ -440,15 +438,15 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, if (!scsi_status && (resp_info & RESID_UNDER)) logit = LOG_FCP; - lpfc_printf_log(phba, KERN_WARNING, logit, - "%d (%d):0730 FCP command x%x failed: x%x SNS x%x x%x " - "Data: x%x x%x x%x x%x x%x\n", - phba->brd_no, vpi, cmnd->cmnd[0], scsi_status, - be32_to_cpu(*lp), be32_to_cpu(*(lp + 3)), resp_info, - be32_to_cpu(fcprsp->rspResId), - be32_to_cpu(fcprsp->rspSnsLen), - be32_to_cpu(fcprsp->rspRspLen), - fcprsp->rspInfo3); + lpfc_printf_vlog(vport, KERN_WARNING, logit, + "0730 FCP command x%x failed: x%x SNS x%x x%x " + "Data: x%x x%x x%x x%x x%x\n", + cmnd->cmnd[0], scsi_status, + be32_to_cpu(*lp), be32_to_cpu(*(lp + 3)), resp_info, + be32_to_cpu(fcprsp->rspResId), + be32_to_cpu(fcprsp->rspSnsLen), + be32_to_cpu(fcprsp->rspRspLen), + fcprsp->rspInfo3); if (resp_info & RSP_LEN_VALID) { rsplen = be32_to_cpu(fcprsp->rspRspLen); @@ -463,12 +461,12 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, if (resp_info & RESID_UNDER) { scsi_set_resid(cmnd, be32_to_cpu(fcprsp->rspResId)); - lpfc_printf_log(phba, KERN_INFO, LOG_FCP, - "%d (%d):0716 FCP Read Underrun, expected %d, " - "residual %d Data: x%x x%x x%x\n", - phba->brd_no, vpi, be32_to_cpu(fcpcmd->fcpDl), - scsi_get_resid(cmnd), fcpi_parm, cmnd->cmnd[0], - cmnd->underflow); + lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, + "0716 FCP Read Underrun, expected %d, " + "residual %d Data: x%x x%x x%x\n", + be32_to_cpu(fcpcmd->fcpDl), + scsi_get_resid(cmnd), fcpi_parm, cmnd->cmnd[0], + cmnd->underflow); /* * If there is an under run check if under run reported by @@ -478,14 +476,13 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, if ((cmnd->sc_data_direction == DMA_FROM_DEVICE) && fcpi_parm && (scsi_get_resid(cmnd) != fcpi_parm)) { - lpfc_printf_log(phba, KERN_WARNING, - LOG_FCP | LOG_FCP_ERROR, - "%d (%d):0735 FCP Read Check Error " - "and Underrun Data: x%x x%x x%x x%x\n", - phba->brd_no, vpi, - be32_to_cpu(fcpcmd->fcpDl), - scsi_get_resid(cmnd), fcpi_parm, - cmnd->cmnd[0]); + lpfc_printf_vlog(vport, KERN_WARNING, + LOG_FCP | LOG_FCP_ERROR, + "0735 FCP Read Check Error " + "and Underrun Data: x%x x%x x%x x%x\n", + be32_to_cpu(fcpcmd->fcpDl), + scsi_get_resid(cmnd), fcpi_parm, + cmnd->cmnd[0]); scsi_set_resid(cmnd, scsi_bufflen(cmnd)); host_status = DID_ERROR; } @@ -499,21 +496,19 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, (scsi_status == SAM_STAT_GOOD) && (scsi_bufflen(cmnd) - scsi_get_resid(cmnd) < cmnd->underflow)) { - lpfc_printf_log(phba, KERN_INFO, LOG_FCP, - "%d (%d):0717 FCP command x%x residual " - "underrun converted to error " - "Data: x%x x%x x%x\n", - phba->brd_no, vpi, cmnd->cmnd[0], - scsi_bufflen(cmnd), - scsi_get_resid(cmnd), cmnd->underflow); + lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, + "0717 FCP command x%x residual " + "underrun converted to error " + "Data: x%x x%x x%x\n", + cmnd->cmnd[0], cmnd->request_bufflen, + scsi_get_resid(cmnd), cmnd->underflow); host_status = DID_ERROR; } } else if (resp_info & RESID_OVER) { - lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, - "%d (%d):0720 FCP command x%x residual " - "overrun error. Data: x%x x%x \n", - phba->brd_no, vpi, cmnd->cmnd[0], - scsi_bufflen(cmnd), scsi_get_resid(cmnd)); + lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, + "0720 FCP command x%x residual overrun error. " + "Data: x%x x%x \n", cmnd->cmnd[0], + scsi_bufflen(cmnd), scsi_get_resid(cmnd)); host_status = DID_ERROR; /* @@ -522,13 +517,12 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, */ } else if ((scsi_status == SAM_STAT_GOOD) && fcpi_parm && (cmnd->sc_data_direction == DMA_FROM_DEVICE)) { - lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR, - "%d (%d):0734 FCP Read Check Error Data: " - "x%x x%x x%x x%x\n", - phba->brd_no, vpi, - be32_to_cpu(fcpcmd->fcpDl), - be32_to_cpu(fcprsp->rspResId), - fcpi_parm, cmnd->cmnd[0]); + lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR, + "0734 FCP Read Check Error Data: " + "x%x x%x x%x x%x\n", + be32_to_cpu(fcpcmd->fcpDl), + be32_to_cpu(fcprsp->rspResId), + fcpi_parm, cmnd->cmnd[0]); host_status = DID_ERROR; scsi_set_resid(cmnd, scsi_bufflen(cmnd)); } @@ -547,9 +541,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, struct lpfc_rport_data *rdata = lpfc_cmd->rdata; struct lpfc_nodelist *pnode = rdata->pnode; struct scsi_cmnd *cmd = lpfc_cmd->pCmd; - uint32_t vpi = (lpfc_cmd->cur_iocbq.vport - ? lpfc_cmd->cur_iocbq.vport->vpi - : 0); int result; struct scsi_device *sdev, *tmp_sdev; int depth = 0; @@ -564,15 +555,15 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, else if (lpfc_cmd->status >= IOSTAT_CNT) lpfc_cmd->status = IOSTAT_DEFAULT; - lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, - "%d (%d):0729 FCP cmd x%x failed <%d/%d> " - "status: x%x result: x%x Data: x%x x%x\n", - phba->brd_no, vpi, cmd->cmnd[0], - cmd->device ? cmd->device->id : 0xffff, - cmd->device ? cmd->device->lun : 0xffff, - lpfc_cmd->status, lpfc_cmd->result, - pIocbOut->iocb.ulpContext, - lpfc_cmd->cur_iocbq.iocb.ulpIoTag); + lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, + "0729 FCP cmd x%x failed <%d/%d> " + "status: x%x result: x%x Data: x%x x%x\n", + cmd->cmnd[0], + cmd->device ? cmd->device->id : 0xffff, + cmd->device ? cmd->device->lun : 0xffff, + lpfc_cmd->status, lpfc_cmd->result, + pIocbOut->iocb.ulpContext, + lpfc_cmd->cur_iocbq.iocb.ulpIoTag); switch (lpfc_cmd->status) { case IOSTAT_FCP_RSP_ERROR: @@ -605,13 +596,12 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, if (cmd->result || lpfc_cmd->fcp_rsp->rspSnsLen) { uint32_t *lp = (uint32_t *)cmd->sense_buffer; - lpfc_printf_log(phba, KERN_INFO, LOG_FCP, - "%d (%d):0710 Iodone <%d/%d> cmd %p, error " - "x%x SNS x%x x%x Data: x%x x%x\n", - phba->brd_no, vpi, cmd->device->id, - cmd->device->lun, cmd, cmd->result, - *lp, *(lp + 3), cmd->retries, - scsi_get_resid(cmd)); + lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, + "0710 Iodone <%d/%d> cmd %p, error " + "x%x SNS x%x x%x Data: x%x x%x\n", + cmd->device->id, cmd->device->lun, cmd, + cmd->result, *lp, *(lp + 3), cmd->retries, + scsi_get_resid(cmd)); } result = cmd->result; @@ -675,10 +665,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, depth = sdev->host->cmd_per_lun; if (depth) { - lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, - "%d (%d):0711 detected queue full - " - "lun queue depth adjusted to %d.\n", - phba->brd_no, vpi, depth); + lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, + "0711 detected queue full - lun queue " + "depth adjusted to %d.\n", depth); } } @@ -848,12 +837,9 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf *lpfc_cmd, struct lpfc_vport *vport, return FAILED; /* Issue Target Reset to TGT */ - lpfc_printf_log(phba, KERN_INFO, LOG_FCP, - "%d (%d):0702 Issue Target Reset to TGT %d " - "Data: x%x x%x\n", - phba->brd_no, vport->vpi, tgt_id, - rdata->pnode->nlp_rpi, rdata->pnode->nlp_flag); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, + "0702 Issue Target Reset to TGT %d Data: x%x x%x\n", + tgt_id, rdata->pnode->nlp_rpi, rdata->pnode->nlp_flag); ret = lpfc_sli_issue_iocb_wait(phba, &phba->sli.ring[phba->sli.fcp_ring], iocbq, iocbqrsp, lpfc_cmd->timeout); @@ -960,10 +946,9 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) if (lpfc_cmd == NULL) { lpfc_adjust_queue_depth(phba); - lpfc_printf_log(phba, KERN_INFO, LOG_FCP, - "%d (%d):0707 driver's buffer pool is empty, " - "IO busied\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, + "0707 driver's buffer pool is empty, " + "IO busied\n"); goto out_host_busy; } @@ -1104,22 +1089,19 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) if (lpfc_cmd->pCmd == cmnd) { ret = FAILED; - lpfc_printf_log(phba, KERN_ERR, LOG_FCP, - "%d (%d):0748 abort handler timed out waiting " - "for abort to complete: ret %#x, ID %d, " - "LUN %d, snum %#lx\n", - phba->brd_no, vport->vpi, ret, - cmnd->device->id, cmnd->device->lun, - cmnd->serial_number); + lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, + "0748 abort handler timed out waiting " + "for abort to complete: ret %#x, ID %d, " + "LUN %d, snum %#lx\n", + ret, cmnd->device->id, cmnd->device->lun, + cmnd->serial_number); } out: - lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, - "%d (%d):0749 SCSI Layer I/O Abort Request " - "Status x%x ID %d LUN %d snum %#lx\n", - phba->brd_no, vport->vpi, ret, cmnd->device->id, - cmnd->device->lun, cmnd->serial_number); - + lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, + "0749 SCSI Layer I/O Abort Request Status x%x ID %d " + "LUN %d snum %#lx\n", ret, cmnd->device->id, + cmnd->device->lun, cmnd->serial_number); return ret; } @@ -1154,11 +1136,10 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) rdata = cmnd->device->hostdata; if (!rdata || (loopcnt > ((vport->cfg_devloss_tmo * 2) + 1))){ - lpfc_printf_log(phba, KERN_ERR, LOG_FCP, - "%d (%d):0721 LUN Reset rport " - "failure: cnt x%x rdata x%p\n", - phba->brd_no, vport->vpi, - loopcnt, rdata); + lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, + "0721 LUN Reset rport " + "failure: cnt x%x rdata x%p\n", + loopcnt, rdata); goto out; } pnode = rdata->pnode; @@ -1188,12 +1169,10 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) if (iocbqrsp == NULL) goto out_free_scsi_buf; - lpfc_printf_log(phba, KERN_INFO, LOG_FCP, - "%d (%d):0703 Issue target reset to TGT %d LUN %d " - "rpi x%x nlp_flag x%x\n", - phba->brd_no, vport->vpi, cmnd->device->id, - cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag); - + lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, + "0703 Issue target reset to TGT %d LUN %d " + "rpi x%x nlp_flag x%x\n", cmnd->device->id, + cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag); iocb_status = lpfc_sli_issue_iocb_wait(phba, &phba->sli.ring[phba->sli.fcp_ring], iocbq, iocbqrsp, lpfc_cmd->timeout); @@ -1239,10 +1218,9 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) } if (cnt) { - lpfc_printf_log(phba, KERN_ERR, LOG_FCP, - "%d (%d):0719 device reset I/O flush failure: " - "cnt x%x\n", - phba->brd_no, vport->vpi, cnt); + lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, + "0719 device reset I/O flush failure: " + "cnt x%x\n", cnt); ret = FAILED; } @@ -1250,12 +1228,11 @@ out_free_scsi_buf: if (iocb_status != IOCB_TIMEDOUT) { lpfc_release_scsi_buf(phba, lpfc_cmd); } - lpfc_printf_log(phba, KERN_ERR, LOG_FCP, - "%d (%d):0713 SCSI layer issued device reset (%d, %d) " - "return x%x status x%x result x%x\n", - phba->brd_no, vport->vpi, cmnd->device->id, - cmnd->device->lun, ret, cmd_status, cmd_result); - + lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, + "0713 SCSI layer issued device reset (%d, %d) " + "return x%x status x%x result x%x\n", + cmnd->device->id, cmnd->device->lun, ret, + cmd_status, cmd_result); out: return ret; } @@ -1306,10 +1283,9 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) cmnd->device->lun, ndlp->rport->dd_data); if (ret != SUCCESS) { - lpfc_printf_log(phba, KERN_ERR, LOG_FCP, - "%d (%d):0700 Bus Reset on target %d " - "failed\n", - phba->brd_no, vport->vpi, i); + lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, + "0700 Bus Reset on target %d failed\n", + i); err_count++; break; } @@ -1347,16 +1323,14 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) } if (cnt) { - lpfc_printf_log(phba, KERN_ERR, LOG_FCP, - "%d (%d):0715 Bus Reset I/O flush failure: " - "cnt x%x left x%x\n", - phba->brd_no, vport->vpi, cnt, i); + lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, + "0715 Bus Reset I/O flush failure: " + "cnt x%x left x%x\n", cnt, i); ret = FAILED; } - lpfc_printf_log(phba, KERN_ERR, LOG_FCP, - "%d (%d):0714 SCSI layer issued Bus Reset Data: x%x\n", - phba->brd_no, vport->vpi, ret); + lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, + "0714 SCSI layer issued Bus Reset Data: x%x\n", ret); out: return ret; } @@ -1389,32 +1363,28 @@ lpfc_slave_alloc(struct scsi_device *sdev) /* Allow some exchanges to be available always to complete discovery */ if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { - lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, - "%d (%d):0704 At limitation of %d " - "preallocated command buffers\n", - phba->brd_no, vport->vpi, total); + lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, + "0704 At limitation of %d preallocated " + "command buffers\n", total); return 0; - /* Allow some exchanges to be available always to complete discovery */ } else if (total + num_to_alloc > phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { - lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, - "%d (%d):0705 Allocation request of %d " - "command buffers will exceed max of %d. " - "Reducing allocation request to %d.\n", - phba->brd_no, vport->vpi, num_to_alloc, - phba->cfg_hba_queue_depth, - (phba->cfg_hba_queue_depth - total)); + lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, + "0705 Allocation request of %d " + "command buffers will exceed max of %d. " + "Reducing allocation request to %d.\n", + num_to_alloc, phba->cfg_hba_queue_depth, + (phba->cfg_hba_queue_depth - total)); num_to_alloc = phba->cfg_hba_queue_depth - total; } for (i = 0; i < num_to_alloc; i++) { scsi_buf = lpfc_new_scsi_buf(vport); if (!scsi_buf) { - lpfc_printf_log(phba, KERN_ERR, LOG_FCP, - "%d (%d):0706 Failed to allocate " - "command buffer\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, + "0706 Failed to allocate " + "command buffer\n"); break; } diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 14fe6b000b59..2da75d85de84 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -49,9 +49,8 @@ lpfc_printf_log(phba, \ KERN_INFO, \ LOG_MBOX | LOG_SLI, \ - "%d (%d):0311 Mailbox command x%x cannot " \ + "(%d):0311 Mailbox command x%x cannot " \ "issue Data: x%x x%x x%x\n", \ - phba->brd_no, \ pmbox->vport ? pmbox->vport->vpi : 0, \ pmbox->mb.mbxCommand, \ phba->pport->port_state, \ @@ -231,13 +230,11 @@ lpfc_sli_ring_map(struct lpfc_hba *phba) rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); if (rc != MBX_SUCCESS) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0446 Adapter failed to init (%d), " + "0446 Adapter failed to init (%d), " "mbxCmd x%x CFG_RING, mbxStatus x%x, " "ring %d\n", - phba->brd_no, rc, - pmbox->mbxCommand, - pmbox->mbxStatus, - i); + rc, pmbox->mbxCommand, + pmbox->mbxStatus, i); phba->link_state = LPFC_HBA_ERROR; ret = -ENXIO; break; @@ -296,9 +293,9 @@ lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) if (unlikely(pring->local_getidx >= max_cmd_idx)) { lpfc_printf_log(phba, KERN_ERR, LOG_SLI, - "%d:0315 Ring %d issue: portCmdGet %d " + "0315 Ring %d issue: portCmdGet %d " "is bigger then cmd ring %d\n", - phba->brd_no, pring->ringno, + pring->ringno, pring->local_getidx, max_cmd_idx); phba->link_state = LPFC_HBA_ERROR; @@ -380,8 +377,8 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) spin_unlock_irq(&phba->hbalock); lpfc_printf_log(phba, KERN_ERR,LOG_SLI, - "%d:0318 Failed to allocate IOTAG.last IOTAG is %d\n", - phba->brd_no, psli->last_iotag); + "0318 Failed to allocate IOTAG.last IOTAG is %d\n", + psli->last_iotag); return 0; } @@ -535,10 +532,9 @@ lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno) if (unlikely(hbqp->local_hbqGetIdx >= hbqp->entry_count)) { lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT, - "%d:1802 HBQ %d: local_hbqGetIdx " + "1802 HBQ %d: local_hbqGetIdx " "%u is > than hbqp->entry_count %u\n", - phba->brd_no, hbqno, - hbqp->local_hbqGetIdx, + hbqno, hbqp->local_hbqGetIdx, hbqp->entry_count); phba->link_state = LPFC_HBA_ERROR; @@ -666,9 +662,8 @@ lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag) } } lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT, - "%d:1803 Bad hbq tag. Data: x%x x%x\n", - phba->brd_no, tag, - lpfc_hbq_defs[tag >> 16]->buffer_count); + "1803 Bad hbq tag. Data: x%x x%x\n", + tag, lpfc_hbq_defs[tag >> 16]->buffer_count); return NULL; } @@ -845,12 +840,10 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba) */ if (lpfc_sli_chk_mbx_command(pmbox->mbxCommand) == MBX_SHUTDOWN) { - /* Unknow mailbox command compl */ lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, - "%d (%d):0323 Unknown Mailbox command " + "(%d):0323 Unknown Mailbox command " "%x Cmpl\n", - phba->brd_no, pmb->vport ? pmb->vport->vpi : 0, pmbox->mbxCommand); phba->link_state = LPFC_HBA_ERROR; @@ -865,10 +858,9 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba) /* Mbox cmd cmpl error - RETRYing */ lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, - "%d (%d):0305 Mbox cmd cmpl " + "(%d):0305 Mbox cmd cmpl " "error - RETRYing Data: x%x " "x%x x%x x%x\n", - phba->brd_no, pmb->vport ? pmb->vport->vpi :0, pmbox->mbxCommand, pmbox->mbxStatus, @@ -887,9 +879,8 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba) /* Mailbox cmd Cmpl */ lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, - "%d (%d):0307 Mailbox cmd x%x Cmpl x%p " + "(%d):0307 Mailbox cmd x%x Cmpl x%p " "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n", - phba->brd_no, pmb->vport ? pmb->vport->vpi : 0, pmbox->mbxCommand, pmb->mbox_cmpl, @@ -1004,12 +995,9 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, /* Ring handler: unexpected Rctl Type received */ lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, - "%d:0313 Ring %d handler: unexpected Rctl x%x " + "0313 Ring %d handler: unexpected Rctl x%x " "Type x%x received\n", - phba->brd_no, - pring->ringno, - Rctl, - Type); + pring->ringno, Rctl, Type); } return 1; } @@ -1032,10 +1020,9 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, } lpfc_printf_log(phba, KERN_ERR, LOG_SLI, - "%d:0317 iotag x%x is out off " + "0317 iotag x%x is out off " "range: max iotag x%x wd0 x%x\n", - phba->brd_no, iotag, - phba->sli.last_iotag, + iotag, phba->sli.last_iotag, *(((uint32_t *) &prspiocb->iocb) + 7)); return NULL; } @@ -1083,18 +1070,16 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, * Ring handler: unexpected completion IoTag * */ - lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, - "%d (%d):0322 Ring %d handler: " - "unexpected completion IoTag x%x " - "Data: x%x x%x x%x x%x\n", - phba->brd_no, - cmdiocbp->vport->vpi, - pring->ringno, - saveq->iocb.ulpIoTag, - saveq->iocb.ulpStatus, - saveq->iocb.un.ulpWord[4], - saveq->iocb.ulpCommand, - saveq->iocb.ulpContext); + lpfc_printf_vlog(cmdiocbp->vport, KERN_WARNING, LOG_SLI, + "0322 Ring %d handler: " + "unexpected completion IoTag x%x " + "Data: x%x x%x x%x x%x\n", + pring->ringno, + saveq->iocb.ulpIoTag, + saveq->iocb.ulpStatus, + saveq->iocb.un.ulpWord[4], + saveq->iocb.ulpCommand, + saveq->iocb.ulpContext); } } @@ -1112,10 +1097,9 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) * rsp ring */ lpfc_printf_log(phba, KERN_ERR, LOG_SLI, - "%d:0312 Ring %d handler: portRspPut %d " + "0312 Ring %d handler: portRspPut %d " "is bigger then rsp ring %d\n", - phba->brd_no, pring->ringno, - le32_to_cpu(pgp->rspPutInx), + pring->ringno, le32_to_cpu(pgp->rspPutInx), pring->numRiocb); phba->link_state = LPFC_HBA_ERROR; @@ -1185,9 +1169,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) if (unlikely(irsp->ulpStatus)) { /* Rsp ring error: IOCB */ lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, - "%d:0326 Rsp Ring %d error: IOCB Data: " + "0326 Rsp Ring %d error: IOCB Data: " "x%x x%x x%x x%x x%x x%x x%x x%x\n", - phba->brd_no, pring->ringno, + pring->ringno, irsp->un.ulpWord[0], irsp->un.ulpWord[1], irsp->un.ulpWord[2], @@ -1207,9 +1191,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) */ if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { lpfc_printf_log(phba, KERN_INFO, LOG_SLI, - "%d:0314 IOCB cmd 0x%x" - " processed. Skipping" - " completion", phba->brd_no, + "0314 IOCB cmd 0x%x " + "processed. Skipping " + "completion", irsp->ulpCommand); break; } @@ -1234,10 +1218,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) } else { /* Unknown IOCB command */ lpfc_printf_log(phba, KERN_ERR, LOG_SLI, - "%d:0321 Unknown IOCB command " + "0321 Unknown IOCB command " "Data: x%x, x%x x%x x%x x%x\n", - phba->brd_no, type, - irsp->ulpCommand, + type, irsp->ulpCommand, irsp->ulpStatus, irsp->ulpIoTag, irsp->ulpContext); @@ -1361,9 +1344,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, /* Rsp ring error: IOCB */ lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, - "%d:0336 Rsp Ring %d error: IOCB Data: " + "0336 Rsp Ring %d error: IOCB Data: " "x%x x%x x%x x%x x%x x%x x%x x%x\n", - phba->brd_no, pring->ringno, + pring->ringno, irsp->un.ulpWord[0], irsp->un.ulpWord[1], irsp->un.ulpWord[2], @@ -1383,10 +1366,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, */ if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { lpfc_printf_log(phba, KERN_INFO, LOG_SLI, - "%d:0333 IOCB cmd 0x%x" + "0333 IOCB cmd 0x%x" " processed. Skipping" " completion\n", - phba->brd_no, irsp->ulpCommand); break; } @@ -1423,10 +1405,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, } else { /* Unknown IOCB command */ lpfc_printf_log(phba, KERN_ERR, LOG_SLI, - "%d:0334 Unknown IOCB command " + "0334 Unknown IOCB command " "Data: x%x, x%x x%x x%x x%x\n", - phba->brd_no, type, - irsp->ulpCommand, + type, irsp->ulpCommand, irsp->ulpStatus, irsp->ulpIoTag, irsp->ulpContext); @@ -1504,10 +1485,9 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, * rsp ring */ lpfc_printf_log(phba, KERN_ERR, LOG_SLI, - "%d:0303 Ring %d handler: portRspPut %d " + "0303 Ring %d handler: portRspPut %d " "is bigger then rsp ring %d\n", - phba->brd_no, pring->ringno, portRspPut, - portRspMax); + pring->ringno, portRspPut, portRspMax); phba->link_state = LPFC_HBA_ERROR; spin_unlock_irqrestore(&phba->hbalock, iflag); @@ -1596,13 +1576,12 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, if (irsp->ulpStatus) { /* Rsp ring error: IOCB */ lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, - "%d:0328 Rsp Ring %d error: " + "0328 Rsp Ring %d error: " "IOCB Data: " "x%x x%x x%x x%x " "x%x x%x x%x x%x " "x%x x%x x%x x%x " "x%x x%x x%x x%x\n", - phba->brd_no, pring->ringno, irsp->un.ulpWord[0], irsp->un.ulpWord[1], @@ -1677,10 +1656,9 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, } else { /* Unknown IOCB command */ lpfc_printf_log(phba, KERN_ERR, LOG_SLI, - "%d:0335 Unknown IOCB " + "0335 Unknown IOCB " "command Data: x%x " "x%x x%x x%x\n", - phba->brd_no, irsp->ulpCommand, irsp->ulpStatus, irsp->ulpIoTag, @@ -1908,8 +1886,8 @@ lpfc_sli_brdkill(struct lpfc_hba *phba) /* Kill HBA */ lpfc_printf_log(phba, KERN_INFO, LOG_SLI, - "%d:0329 Kill HBA Data: x%x x%x\n", - phba->brd_no, phba->pport->port_state, psli->sli_flag); + "0329 Kill HBA Data: x%x x%x\n", + phba->pport->port_state, psli->sli_flag); if ((pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL)) == 0) @@ -1982,7 +1960,7 @@ lpfc_sli_brdreset(struct lpfc_hba *phba) /* Reset HBA */ lpfc_printf_log(phba, KERN_INFO, LOG_SLI, - "%d:0325 Reset HBA Data: x%x x%x\n", phba->brd_no, + "0325 Reset HBA Data: x%x x%x\n", phba->pport->port_state, psli->sli_flag); /* perform board reset */ @@ -2037,7 +2015,7 @@ lpfc_sli_brdrestart(struct lpfc_hba *phba) /* Restart HBA */ lpfc_printf_log(phba, KERN_INFO, LOG_SLI, - "%d:0337 Restart HBA Data: x%x x%x\n", phba->brd_no, + "0337 Restart HBA Data: x%x x%x\n", phba->pport->port_state, psli->sli_flag); word0 = 0; @@ -2102,9 +2080,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) /* Adapter failed to init, timeout, status reg */ lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0436 Adapter failed to init, " - "timeout, status reg x%x\n", - phba->brd_no, status); + "0436 Adapter failed to init, " + "timeout, status reg x%x\n", status); phba->link_state = LPFC_HBA_ERROR; return -ETIMEDOUT; } @@ -2115,10 +2092,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) /* Adapter failed to init, chipset, status reg */ lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0437 Adapter failed to init, " - "chipset, status reg x%x\n", - phba->brd_no, - status); + "0437 Adapter failed to init, " + "chipset, status reg x%x\n", status); phba->link_state = LPFC_HBA_ERROR; return -EIO; } @@ -2145,10 +2120,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) /* ERROR: During chipset initialization */ /* Adapter failed to init, chipset, status reg */ lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0438 Adapter failed to init, chipset, " - "status reg x%x\n", - phba->brd_no, - status); + "0438 Adapter failed to init, chipset, " + "status reg x%x\n", status); phba->link_state = LPFC_HBA_ERROR; return -EIO; } @@ -2226,9 +2199,9 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba) lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT, - "%d:1805 Adapter failed to init. " + "1805 Adapter failed to init. " "Data: x%x x%x x%x\n", - phba->brd_no, pmbox->mbxCommand, + pmbox->mbxCommand, pmbox->mbxStatus, hbqno); phba->link_state = LPFC_HBA_ERROR; @@ -2295,10 +2268,9 @@ lpfc_do_config_port(struct lpfc_hba *phba, int sli_mode) rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); if (rc != MBX_SUCCESS) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0442 Adapter failed to init, mbxCmd x%x " + "0442 Adapter failed to init, mbxCmd x%x " "CONFIG_PORT, mbxStatus x%x Data: x%x\n", - phba->brd_no, pmb->mb.mbxCommand, - pmb->mb.mbxStatus, 0); + pmb->mb.mbxCommand, pmb->mb.mbxStatus, 0); spin_lock_irq(&phba->hbalock); phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE; spin_unlock_irq(&phba->hbalock); @@ -2339,9 +2311,9 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) case 2: if (phba->cfg_npiv_enable) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, - "%d:1824 NPIV enabled: Override lpfc_sli_mode " + "1824 NPIV enabled: Override lpfc_sli_mode " "parameter (%d) to auto (0).\n", - phba->brd_no, lpfc_sli_mode); + lpfc_sli_mode); break; } mode = 2; @@ -2351,9 +2323,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) break; default: lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, - "%d:1819 Unrecognized lpfc_sli_mode " - "parameter: %d.\n", - phba->brd_no, lpfc_sli_mode); + "1819 Unrecognized lpfc_sli_mode " + "parameter: %d.\n", lpfc_sli_mode); break; } @@ -2361,9 +2332,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) rc = lpfc_do_config_port(phba, mode); if (rc && lpfc_sli_mode == 3) lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, - "%d:1820 Unable to select SLI-3. " - "Not supported by adapter.\n", - phba->brd_no); + "1820 Unable to select SLI-3. " + "Not supported by adapter.\n"); if (rc && mode != 2) rc = lpfc_do_config_port(phba, 2); if (rc) @@ -2382,8 +2352,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) } lpfc_printf_log(phba, KERN_INFO, LOG_INIT, - "%d:0444 Firmware in SLI %x mode. Max_vpi %d\n", - phba->brd_no, phba->sli_rev, phba->max_vpi); + "0444 Firmware in SLI %x mode. Max_vpi %d\n", + phba->sli_rev, phba->max_vpi); rc = lpfc_sli_ring_map(phba); if (rc) @@ -2408,8 +2378,7 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) lpfc_sli_hba_setup_error: phba->link_state = LPFC_HBA_ERROR; lpfc_printf_log(phba, KERN_INFO, LOG_INIT, - "%d:0445 Firmware initialization failed\n", - phba->brd_no); + "0445 Firmware initialization failed\n"); return rc; } @@ -2461,9 +2430,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) /* Mbox cmd timeout */ lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, - "%d:0310 Mailbox command x%x timeout Data: x%x x%x " - "x%p\n", - phba->brd_no, + "0310 Mailbox command x%x timeout Data: x%x x%x x%p\n", mb->mbxCommand, phba->pport->port_state, phba->sli.sli_flag, @@ -2486,8 +2453,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) lpfc_sli_abort_iocb_ring(phba, pring); lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, - "%d:0316 Resetting board due to mailbox timeout\n", - phba->brd_no); + "0316 Resetting board due to mailbox timeout\n"); /* * lpfc_offline calls lpfc_sli_hba_down which will clean up * on oustanding mailbox commands. @@ -2518,8 +2484,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) if(!pmbox->vport) { lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_VPORT, - "%d:1806 Mbox x%x failed. No vport\n", - phba->brd_no, + "1806 Mbox x%x failed. No vport\n", pmbox->mb.mbxCommand); dump_stack(); return MBXERR_ERROR; @@ -2596,9 +2561,8 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) /* Mbox cmd issue - BUSY */ lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, - "%d (%d):0308 Mbox cmd issue - BUSY Data: " + "(%d):0308 Mbox cmd issue - BUSY Data: " "x%x x%x x%x x%x\n", - phba->brd_no, pmbox->vport ? pmbox->vport->vpi : 0xffffff, mb->mbxCommand, phba->pport->port_state, psli->sli_flag, flag); @@ -2660,9 +2624,9 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) /* Mailbox cmd issue */ lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, - "%d (%d):0309 Mailbox cmd x%x issue Data: x%x x%x " + "(%d):0309 Mailbox cmd x%x issue Data: x%x x%x " "x%x\n", - phba->brd_no, pmbox->vport ? pmbox->vport->vpi : 0, + pmbox->vport ? pmbox->vport->vpi : 0, mb->mbxCommand, phba->pport->port_state, psli->sli_flag, flag); @@ -2864,8 +2828,7 @@ __lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, (piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN)) { lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT, - "%d:1807 IOCB x%x failed. No vport\n", - phba->brd_no, + "1807 IOCB x%x failed. No vport\n", piocb->iocb.ulpCommand); dump_stack(); return IOCB_ERROR; @@ -3096,11 +3059,10 @@ lpfc_sli_setup(struct lpfc_hba *phba) } if (totiocbsize > MAX_SLIM_IOCB_SIZE) { /* Too many cmd / rsp ring entries in SLI2 SLIM */ - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0462 Too many cmd / rsp ring entries in " - "SLI2 SLIM Data: x%x x%lx\n", - phba->brd_no, totiocbsize, - (unsigned long) MAX_SLIM_IOCB_SIZE); + printk(KERN_ERR "%d:0462 Too many cmd / rsp ring entries in " + "SLI2 SLIM Data: x%x x%lx\n", + phba->brd_no, totiocbsize, + (unsigned long) MAX_SLIM_IOCB_SIZE); } if (phba->cfg_multi_ring_support == 2) lpfc_extra_ring_setup(phba); @@ -3321,9 +3283,9 @@ lpfc_sli_ringpostbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, spin_unlock_irq(&phba->hbalock); lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0410 Cannot find virtual addr for mapped buf on " + "0410 Cannot find virtual addr for mapped buf on " "ring %d Data x%llx x%p x%p x%x\n", - phba->brd_no, pring->ringno, (unsigned long long)phys, + pring->ringno, (unsigned long long)phys, slp->next, slp->prev, pring->postbufq_cnt); return NULL; } @@ -3348,12 +3310,11 @@ lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, abort_iocb = phba->sli.iocbq_lookup[abort_iotag]; lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_SLI, - "%d:0327 Cannot abort els iocb %p " + "0327 Cannot abort els iocb %p " "with tag %x context %x, abort status %x, " "abort code %x\n", - phba->brd_no, abort_iocb, abort_iotag, - abort_context, irsp->ulpStatus, - irsp->un.ulpWord[4]); + abort_iocb, abort_iotag, abort_context, + irsp->ulpStatus, irsp->un.ulpWord[4]); /* * make sure we have the right iocbq before taking it @@ -3387,9 +3348,9 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, /* ELS cmd tag completes */ lpfc_printf_log(phba, KERN_INFO, LOG_ELS, - "%d (X):0133 Ignoring ELS cmd tag x%x completion Data: " + "0133 Ignoring ELS cmd tag x%x completion Data: " "x%x x%x x%x\n", - phba->brd_no, irsp->ulpIoTag, irsp->ulpStatus, + irsp->ulpIoTag, irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout); if (cmdiocb->iocb.ulpCommand == CMD_GEN_REQUEST64_CR) lpfc_ct_free_iocb(phba, cmdiocb); @@ -3455,12 +3416,11 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, abtsiocbp->iocb_cmpl = lpfc_sli_abort_els_cmpl; - lpfc_printf_log(phba, KERN_INFO, LOG_SLI, - "%d (%d):0339 Abort xri x%x, original iotag x%x, " - "abort cmd iotag x%x\n", - phba->brd_no, vport->vpi, - iabt->un.acxri.abortContextTag, - iabt->un.acxri.abortIoTag, abtsiocbp->iotag); + lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, + "0339 Abort xri x%x, original iotag x%x, " + "abort cmd iotag x%x\n", + iabt->un.acxri.abortContextTag, + iabt->un.acxri.abortIoTag, abtsiocbp->iotag); retval = __lpfc_sli_issue_iocb(phba, pring, abtsiocbp, 0); abort_iotag_exit: @@ -3663,25 +3623,23 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, if (piocb->iocb_flag & LPFC_IO_WAKE) { lpfc_printf_log(phba, KERN_INFO, LOG_SLI, - "%d:0331 IOCB wake signaled\n", - phba->brd_no); + "0331 IOCB wake signaled\n"); } else if (timeleft == 0) { lpfc_printf_log(phba, KERN_ERR, LOG_SLI, - "%d:0338 IOCB wait timeout error - no " - "wake response Data x%x\n", - phba->brd_no, timeout); + "0338 IOCB wait timeout error - no " + "wake response Data x%x\n", timeout); retval = IOCB_TIMEDOUT; } else { lpfc_printf_log(phba, KERN_ERR, LOG_SLI, - "%d:0330 IOCB wake NOT set, " - "Data x%x x%lx\n", phba->brd_no, + "0330 IOCB wake NOT set, " + "Data x%x x%lx\n", timeout, (timeleft / jiffies)); retval = IOCB_TIMEDOUT; } } else { lpfc_printf_log(phba, KERN_INFO, LOG_SLI, - "%d:0332 IOCB wait issue failed, Data x%x\n", - phba->brd_no, retval); + ":0332 IOCB wait issue failed, Data x%x\n", + retval); retval = IOCB_ERROR; } @@ -3932,12 +3890,10 @@ lpfc_intr_handler(int irq, void *dev_id) */ lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, - "%d (%d):0304 Stray Mailbox " + "(%d):0304 Stray Mailbox " "Interrupt mbxCommand x%x " "mbxStatus x%x\n", - phba->brd_no, - (vport - ? vport->vpi : 0), + (vport ? vport->vpi : 0), pmbox->mbxCommand, pmbox->mbxStatus); } diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index 70e1bc34fd48..77067d17c39d 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c @@ -125,11 +125,10 @@ lpfc_vport_sparm(struct lpfc_hba *phba, struct lpfc_vport *vport) pmb->vport = vport; rc = lpfc_sli_issue_mbox_wait(phba, pmb, phba->fc_ratov * 2); if (rc != MBX_SUCCESS) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, - "%d (%d):1818 VPort failed init, mbxCmd x%x " - "READ_SPARM mbxStatus x%x, rc = x%x\n", - phba->brd_no, vport->vpi, - mb->mbxCommand, mb->mbxStatus, rc); + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT | LOG_VPORT, + "1818 VPort failed init, mbxCmd x%x " + "READ_SPARM mbxStatus x%x, rc = x%x\n", + mb->mbxCommand, mb->mbxStatus, rc); lpfc_mbuf_free(phba, mp->virt, mp->phys); kfree(mp); if (rc != MBX_TIMEOUT) @@ -162,9 +161,9 @@ lpfc_valid_wwn_format(struct lpfc_hba *phba, struct lpfc_name *wwn, return 1; lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, - "%d:1822 Invalid %s: %02x:%02x:%02x:%02x:" + "1822 Invalid %s: %02x:%02x:%02x:%02x:" "%02x:%02x:%02x:%02x\n", - phba->brd_no, name_type, + name_type, wwn->u.wwn[0], wwn->u.wwn[1], wwn->u.wwn[2], wwn->u.wwn[3], wwn->u.wwn[4], wwn->u.wwn[5], @@ -209,9 +208,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) if ((phba->sli_rev < 3) || !(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) { lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, - "%d:1808 Create VPORT failed: " + "1808 Create VPORT failed: " "NPIV is not enabled: SLImode:%d\n", - phba->brd_no, phba->sli_rev); + phba->sli_rev); rc = VPORT_INVAL; goto error_out; } @@ -219,9 +218,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) vpi = lpfc_alloc_vpi(phba); if (vpi == 0) { lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, - "%d:1809 Create VPORT failed: " + "1809 Create VPORT failed: " "Max VPORTs (%d) exceeded\n", - phba->brd_no, phba->max_vpi); + phba->max_vpi); rc = VPORT_NORESOURCES; goto error_out; } @@ -230,8 +229,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) /* Assign an unused board number */ if ((instance = lpfc_get_instance()) < 0) { lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, - "%d:1810 Create VPORT failed: Cannot get " - "instance number\n", phba->brd_no); + "1810 Create VPORT failed: Cannot get " + "instance number\n"); lpfc_free_vpi(phba, vpi); rc = VPORT_NORESOURCES; goto error_out; @@ -240,8 +239,7 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) vport = lpfc_create_port(phba, instance, &fc_vport->dev); if (!vport) { lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, - "%d:1811 Create VPORT failed: vpi x%x\n", - phba->brd_no, vpi); + "1811 Create VPORT failed: vpi x%x\n", vpi); lpfc_free_vpi(phba, vpi); rc = VPORT_NORESOURCES; goto error_out; @@ -251,10 +249,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) lpfc_debugfs_initialize(vport); if (lpfc_vport_sparm(phba, vport)) { - lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, - "%d:1813 Create VPORT failed: vpi:%d " - "Cannot get sparam\n", - phba->brd_no, vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, + "1813 Create VPORT failed. " + "Cannot get sparam\n"); lpfc_free_vpi(phba, vpi); destroy_port(vport); rc = VPORT_NORESOURCES; @@ -274,10 +271,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) if (!lpfc_valid_wwn_format(phba, &vport->fc_sparam.nodeName, "WWNN") || !lpfc_valid_wwn_format(phba, &vport->fc_sparam.portName, "WWPN")) { - lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, - "%d:1821 Create VPORT failed: vpi:%d " - "Invalid WWN format\n", - phba->brd_no, vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, + "1821 Create VPORT failed. " + "Invalid WWN format\n"); lpfc_free_vpi(phba, vpi); destroy_port(vport); rc = VPORT_INVAL; @@ -285,10 +281,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) } if (!lpfc_unique_wwpn(phba, vport)) { - lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, - "%d:1823 Create VPORT failed: vpi:%d " - "Duplicate WWN on HBA\n", - phba->brd_no, vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, + "1823 Create VPORT failed. " + "Duplicate WWN on HBA\n"); lpfc_free_vpi(phba, vpi); destroy_port(vport); rc = VPORT_INVAL; @@ -320,10 +315,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) lpfc_initial_fdisc(vport); } else { lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0262 No NPIV Fabric " - "support\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0262 No NPIV Fabric support\n"); } } else { lpfc_vport_set_state(vport, FC_VPORT_FAILED); @@ -409,10 +402,8 @@ enable_vport(struct fc_vport *fc_vport) lpfc_initial_fdisc(vport); } else { lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); - lpfc_printf_log(phba, KERN_ERR, LOG_ELS, - "%d (%d):0264 No NPIV Fabric " - "support\n", - phba->brd_no, vport->vpi); + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "0264 No NPIV Fabric support\n"); } } else { lpfc_vport_set_state(vport, FC_VPORT_FAILED); @@ -462,9 +453,9 @@ lpfc_vport_delete(struct fc_vport *fc_vport) return VPORT_INVAL; if (vport->port_type == LPFC_PHYSICAL_PORT) { - lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, - "%d:1812 vport_delete failed: Cannot delete " - "physical host\n", phba->brd_no); + lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, + "1812 vport_delete failed: Cannot delete " + "physical host\n"); goto out; } @@ -544,8 +535,12 @@ lpfc_create_vport_work_array(struct lpfc_hba *phba) return NULL; spin_lock_irq(&phba->hbalock); list_for_each_entry(port_iterator, &phba->port_list, listentry) { - if (!scsi_host_get(lpfc_shost_from_vport(port_iterator))) + if (!scsi_host_get(lpfc_shost_from_vport(port_iterator))) { + lpfc_printf_vlog(port_iterator, KERN_ERR, LOG_VPORT, + "1801 Create vport work array FAILED: " + "cannot do scsi_host_get\n"); continue; + } vports[index++] = port_iterator; } spin_unlock_irq(&phba->hbalock); -- cgit v1.2.3 From 78b2d852a88cd2a55e3ab632109de045d58b83e3 Mon Sep 17 00:00:00 2001 From: James Smart Date: Thu, 2 Aug 2007 11:10:21 -0400 Subject: [SCSI] lpfc 8.2.2 : Miscellaneous management and logging mods - Remove the "management_version" sysfs parameter (was unused) - Add HBQ information to lpfc debugfs - Change lpfc_npiv_enable name back to lpfc_enable_npiv (internal stds) - Remove "issue_lip" attribute from the vports transport template Signed-off-by: James Smart Signed-off-by: James Bottomley --- drivers/scsi/lpfc/lpfc.h | 3 +- drivers/scsi/lpfc/lpfc_attr.c | 17 +---- drivers/scsi/lpfc/lpfc_debugfs.c | 159 ++++++++++++++++++++++++++++++++++++++- drivers/scsi/lpfc/lpfc_hbadisc.c | 2 +- drivers/scsi/lpfc/lpfc_mbox.c | 2 +- drivers/scsi/lpfc/lpfc_sli.c | 6 +- drivers/scsi/lpfc/lpfc_version.h | 2 - 7 files changed, 168 insertions(+), 23 deletions(-) (limited to 'drivers/scsi/lpfc/lpfc_attr.c') diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 5a76d2b4253b..a6dd13e05ab2 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -430,7 +430,7 @@ struct lpfc_hba { /* HBA Config Parameters */ uint32_t cfg_ack0; - uint32_t cfg_npiv_enable; + uint32_t cfg_enable_npiv; uint32_t cfg_topology; uint32_t cfg_link_speed; uint32_t cfg_cr_delay; @@ -551,6 +551,7 @@ struct lpfc_hba { #ifdef CONFIG_LPFC_DEBUG_FS struct dentry *hba_debugfs_root; atomic_t debugfs_vport_count; + struct dentry *debug_hbqinfo; struct dentry *debug_dumpslim; struct dentry *debug_slow_ring_trc; struct lpfc_debugfs_trc *slow_ring_trc; diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index c1cedc3d1b70..0a7f06ba77c0 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -67,12 +67,6 @@ lpfc_drvr_version_show(struct class_device *cdev, char *buf) return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n"); } -static ssize_t -management_version_show(struct class_device *cdev, char *buf) -{ - return snprintf(buf, PAGE_SIZE, DFC_API_VERSION "\n"); -} - static ssize_t lpfc_info_show(struct class_device *cdev, char *buf) { @@ -904,8 +898,6 @@ static CLASS_DEVICE_ATTR(num_discovered_ports, S_IRUGO, static CLASS_DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL); static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, NULL); -static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show, - NULL); static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, lpfc_board_mode_show, lpfc_board_mode_store); static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); @@ -1110,7 +1102,7 @@ MODULE_PARM_DESC(lpfc_sli_mode, "SLI mode selector:" " 2 - select SLI-2 even on SLI-3 capable HBAs," " 3 - select SLI-3"); -LPFC_ATTR_R(npiv_enable, 0, 0, 1, "Enable NPIV functionality"); +LPFC_ATTR_R(enable_npiv, 0, 0, 1, "Enable NPIV functionality"); /* # lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear @@ -1530,9 +1522,8 @@ struct class_device_attribute *lpfc_hba_attrs[] = { &class_device_attr_lpfc_multi_ring_type, &class_device_attr_lpfc_fdmi_on, &class_device_attr_lpfc_max_luns, - &class_device_attr_lpfc_npiv_enable, + &class_device_attr_lpfc_enable_npiv, &class_device_attr_nport_evt_cnt, - &class_device_attr_management_version, &class_device_attr_board_mode, &class_device_attr_max_vpi, &class_device_attr_used_vpi, @@ -1569,7 +1560,6 @@ struct class_device_attribute *lpfc_vport_attrs[] = { &class_device_attr_lpfc_fdmi_on, &class_device_attr_lpfc_max_luns, &class_device_attr_nport_evt_cnt, - &class_device_attr_management_version, &class_device_attr_npiv_info, NULL, }; @@ -2413,7 +2403,6 @@ struct fc_function_template lpfc_vport_transport_functions = { .get_starget_port_name = lpfc_get_starget_port_name, .show_starget_port_name = 1, - .issue_fc_host_lip = lpfc_issue_lip, .dev_loss_tmo_callbk = lpfc_dev_loss_tmo_callbk, .terminate_rport_io = lpfc_terminate_rport_io, @@ -2432,7 +2421,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) lpfc_topology_init(phba, lpfc_topology); lpfc_link_speed_init(phba, lpfc_link_speed); lpfc_poll_tmo_init(phba, lpfc_poll_tmo); - lpfc_npiv_enable_init(phba, lpfc_npiv_enable); + lpfc_enable_npiv_init(phba, lpfc_enable_npiv); lpfc_use_msi_init(phba, lpfc_use_msi); phba->cfg_poll = lpfc_poll; phba->cfg_soft_wwnn = 0L; diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index dc7b858b95fa..f334761d04df 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -101,14 +101,20 @@ MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc, #define LPFC_NODELIST_SIZE 8192 #define LPFC_NODELIST_ENTRY_SIZE 120 -/* dump_slim output buffer size */ +/* dumpslim output buffer size */ #define LPFC_DUMPSLIM_SIZE 4096 +/* hbqinfo output buffer size */ +#define LPFC_HBQINFO_SIZE 8192 + struct lpfc_debug { char *buffer; int len; }; +extern struct lpfc_hbq_init *lpfc_hbq_defs[]; +extern int lpfc_sli_hbq_count(void); + atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0); unsigned long lpfc_debugfs_start_time = 0L; @@ -196,6 +202,105 @@ lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size) return len; } +int lpfc_debugfs_last_hbq = -1; + +static int +lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) +{ + int len = 0; + int cnt, i, j, found, posted, low; + uint32_t phys, raw_index, getidx; + struct lpfc_hbq_init *hip; + struct hbq_s *hbqs; + struct lpfc_hbq_entry *hbqe; + struct lpfc_dmabuf *d_buf; + struct hbq_dmabuf *hbq_buf; + + cnt = LPFC_HBQINFO_SIZE; + spin_lock_irq(&phba->hbalock); + + /* toggle between multiple hbqs, if any */ + i = lpfc_sli_hbq_count(); + if (i > 1) { + lpfc_debugfs_last_hbq++; + if (lpfc_debugfs_last_hbq >= i) + lpfc_debugfs_last_hbq = 0; + } + else + lpfc_debugfs_last_hbq = 0; + + i = lpfc_debugfs_last_hbq; + + len += snprintf(buf+len, size-len, "HBQ %d Info\n", i); + + posted = 0; + list_for_each_entry(d_buf, &phba->hbq_buffer_list, list) + posted++; + + hip = lpfc_hbq_defs[i]; + len += snprintf(buf+len, size-len, + "idx:%d prof:%d rn:%d bufcnt:%d icnt:%d acnt:%d posted %d\n", + hip->hbq_index, hip->profile, hip->rn, + hip->buffer_count, hip->init_count, hip->add_count, posted); + + hbqs = &phba->hbqs[i]; + raw_index = phba->hbq_get[i]; + getidx = le32_to_cpu(raw_index); + len += snprintf(buf+len, size-len, + "entrys:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n", + hbqs->entry_count, hbqs->hbqPutIdx, hbqs->next_hbqPutIdx, + hbqs->local_hbqGetIdx, getidx); + + hbqe = (struct lpfc_hbq_entry *) phba->hbqslimp.virt; + for (j=0; jentry_count; j++) { + len += snprintf(buf+len, size-len, + "%03d: %08x %04x %05x ", j, + hbqe->bde.addrLow, hbqe->bde.tus.w, hbqe->buffer_tag); + + i = 0; + found = 0; + + /* First calculate if slot has an associated posted buffer */ + low = hbqs->hbqPutIdx - posted; + if (low >= 0) { + if ((j >= hbqs->hbqPutIdx) || (j < low)) { + len += snprintf(buf+len, size-len, "Unused\n"); + goto skipit; + } + } + else { + if ((j >= hbqs->hbqPutIdx) && + (j < (hbqs->entry_count+low))) { + len += snprintf(buf+len, size-len, "Unused\n"); + goto skipit; + } + } + + /* Get the Buffer info for the posted buffer */ + list_for_each_entry(d_buf, &phba->hbq_buffer_list, list) { + hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); + phys = ((uint64_t)hbq_buf->dbuf.phys & 0xffffffff); + if (phys == hbqe->bde.addrLow) { + len += snprintf(buf+len, size-len, + "Buf%d: %p %06x\n", i, + hbq_buf->dbuf.virt, hbq_buf->tag); + found = 1; + break; + } + i++; + } + if (!found) { + len += snprintf(buf+len, size-len, "No DMAinfo?\n"); + } +skipit: + hbqe++; + if (len > LPFC_HBQINFO_SIZE - 54) + break; + } + spin_unlock_irq(&phba->hbalock); + return len; +} + static int lpfc_debugfs_dumpslim_data(struct lpfc_hba *phba, char *buf, int size) { @@ -491,6 +596,33 @@ out: return rc; } +static int +lpfc_debugfs_hbqinfo_open(struct inode *inode, struct file *file) +{ + struct lpfc_hba *phba = inode->i_private; + struct lpfc_debug *debug; + int rc = -ENOMEM; + + debug = kmalloc(sizeof(*debug), GFP_KERNEL); + if (!debug) + goto out; + + /* Round to page boundry */ + debug->buffer = kmalloc(LPFC_HBQINFO_SIZE, GFP_KERNEL); + if (!debug->buffer) { + kfree(debug); + goto out; + } + + debug->len = lpfc_debugfs_hbqinfo_data(phba, debug->buffer, + LPFC_HBQINFO_SIZE); + file->private_data = debug; + + rc = 0; +out: + return rc; +} + static int lpfc_debugfs_dumpslim_open(struct inode *inode, struct file *file) { @@ -604,6 +736,15 @@ static struct file_operations lpfc_debugfs_op_nodelist = { .release = lpfc_debugfs_release, }; +#undef lpfc_debugfs_op_hbqinfo +static struct file_operations lpfc_debugfs_op_hbqinfo = { + .owner = THIS_MODULE, + .open = lpfc_debugfs_hbqinfo_open, + .llseek = lpfc_debugfs_lseek, + .read = lpfc_debugfs_read, + .release = lpfc_debugfs_release, +}; + #undef lpfc_debugfs_op_dumpslim static struct file_operations lpfc_debugfs_op_dumpslim = { .owner = THIS_MODULE, @@ -663,6 +804,18 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) atomic_inc(&lpfc_debugfs_hba_count); atomic_set(&phba->debugfs_vport_count, 0); + /* Setup hbqinfo */ + snprintf(name, sizeof(name), "hbqinfo"); + phba->debug_hbqinfo = + debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, + phba->hba_debugfs_root, + phba, &lpfc_debugfs_op_hbqinfo); + if (!phba->debug_hbqinfo) { + lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, + "0409 Cannot create debugfs hbqinfo\n"); + goto debug_failed; + } + /* Setup dumpslim */ snprintf(name, sizeof(name), "dumpslim"); phba->debug_dumpslim = @@ -819,6 +972,10 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport) } if (atomic_read(&phba->debugfs_vport_count) == 0) { + if (phba->debug_hbqinfo) { + debugfs_remove(phba->debug_hbqinfo); /* hbqinfo */ + phba->debug_hbqinfo = NULL; + } if (phba->debug_dumpslim) { debugfs_remove(phba->debug_dumpslim); /* dumpslim */ phba->debug_dumpslim = NULL; diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 55c4e5455a57..f96ab75ba637 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -990,7 +990,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) } } else { if (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) { - if (phba->max_vpi && phba->cfg_npiv_enable && + if (phba->max_vpi && phba->cfg_enable_npiv && (phba->sli_rev == 3)) phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED; } diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index 5fa1c6f70a98..09ecdcb63a74 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c @@ -688,7 +688,7 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) if (phba->sli_rev == 3 && phba->vpd.sli3Feat.cerbm) { mb->un.varCfgPort.cerbm = 1; /* Request HBQs */ mb->un.varCfgPort.max_hbq = 1; /* Requesting 2 HBQs */ - if (phba->max_vpi && phba->cfg_npiv_enable && + if (phba->max_vpi && phba->cfg_enable_npiv && phba->vpd.sli3Feat.cmv) { mb->un.varCfgPort.max_vpi = phba->max_vpi; mb->un.varCfgPort.cmv = 1; diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 2da75d85de84..5417bc26f181 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -602,7 +602,7 @@ static struct lpfc_hbq_init lpfc_els_hbq = { .add_count = 5, }; -static struct lpfc_hbq_init *lpfc_hbq_defs[] = { +struct lpfc_hbq_init *lpfc_hbq_defs[] = { &lpfc_els_hbq, }; @@ -2136,7 +2136,7 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) return 0; } -static int +int lpfc_sli_hbq_count(void) { return ARRAY_SIZE(lpfc_hbq_defs); @@ -2309,7 +2309,7 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) switch (lpfc_sli_mode) { case 2: - if (phba->cfg_npiv_enable) { + if (phba->cfg_enable_npiv) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, "1824 NPIV enabled: Override lpfc_sli_mode " "parameter (%d) to auto (0).\n", diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index a5bc79eef052..0b4e6fd02679 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h @@ -25,5 +25,3 @@ #define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ LPFC_DRIVER_VERSION #define LPFC_COPYRIGHT "Copyright(c) 2004-2007 Emulex. All rights reserved." - -#define DFC_API_VERSION "0.0.0" -- cgit v1.2.3 From 51ef4c26891a734bc8416b639ad460a8162926bc Mon Sep 17 00:00:00 2001 From: James Smart Date: Thu, 2 Aug 2007 11:10:31 -0400 Subject: [SCSI] lpfc 8.2.2 : Miscellaneous Bug Fixes - Fix vport ndlp ref counting errors - Fix use after free of ndlp structure - Use the correct flag to check for LOADING setting. - Fix driver unload bugs (related to shost references) after link down or rscn - Fix up HBQ initialization - Fix port_list locking around driver unload. - Fix references to hostdata as a phba - Fix GFFID type offset to work correctly with big endian structure. - Only call pci_disable_msi if the pci_enable_msi succeeded - Fix vport_delete wait/fail if in discovery - Put a reference on the nameservers ndlp when performing CT traffic. - Remove unbalanced hba unlock. - Fix up HBQ processing - Fix lpfc debugfs discovery trace output for ELS rsp cmpl - Send ADISC when rpi is 0 - Stop FDISC retrying forever - Unable to retrieve correct config parameter for vport - Fix sli_validate_fcp_iocb, sli_sum_iocb, sli_abort_iocb to be vport-aware. - Fix index-out-of-range error in iocb. Spotted by Coverity. Signed-off-by: James Smart Signed-off-by: James Bottomley --- drivers/scsi/lpfc/lpfc.h | 33 ++++++---- drivers/scsi/lpfc/lpfc_attr.c | 29 +++------ drivers/scsi/lpfc/lpfc_crtn.h | 18 +++--- drivers/scsi/lpfc/lpfc_ct.c | 19 ++++++ drivers/scsi/lpfc/lpfc_debugfs.c | 11 ++-- drivers/scsi/lpfc/lpfc_els.c | 64 +++++++++---------- drivers/scsi/lpfc/lpfc_hbadisc.c | 53 ++++++++------- drivers/scsi/lpfc/lpfc_hw.h | 4 ++ drivers/scsi/lpfc/lpfc_init.c | 86 ++++++++++++++----------- drivers/scsi/lpfc/lpfc_mbox.c | 6 +- drivers/scsi/lpfc/lpfc_mem.c | 32 +++++++--- drivers/scsi/lpfc/lpfc_nportdisc.c | 31 +++++---- drivers/scsi/lpfc/lpfc_scsi.c | 26 +++----- drivers/scsi/lpfc/lpfc_sli.c | 128 +++++++++++++++++++++++-------------- drivers/scsi/lpfc/lpfc_sli.h | 8 +-- drivers/scsi/lpfc/lpfc_vport.c | 40 ++++++++---- 16 files changed, 342 insertions(+), 246 deletions(-) (limited to 'drivers/scsi/lpfc/lpfc_attr.c') diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index a6dd13e05ab2..c28db0521c01 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -78,6 +78,7 @@ struct lpfc_dma_pool { struct hbq_dmabuf { struct lpfc_dmabuf dbuf; + uint32_t size; uint32_t tag; }; @@ -329,15 +330,7 @@ struct lpfc_vport { #define FC_LOADING 0x1 /* HBA in process of loading drvr */ #define FC_UNLOADING 0x2 /* HBA in process of unloading drvr */ char *vname; /* Application assigned name */ - struct fc_vport *fc_vport; -#ifdef CONFIG_LPFC_DEBUG_FS - struct dentry *debug_disc_trc; - struct dentry *debug_nodelist; - struct dentry *vport_debugfs_root; - struct lpfc_debugfs_trc *disc_trc; - atomic_t disc_trc_cnt; -#endif /* Vport Config Parameters */ uint32_t cfg_scan_down; uint32_t cfg_lun_queue_depth; @@ -353,6 +346,16 @@ struct lpfc_vport { uint32_t cfg_max_luns; uint32_t dev_loss_tmo_changed; + + struct fc_vport *fc_vport; + +#ifdef CONFIG_LPFC_DEBUG_FS + struct dentry *debug_disc_trc; + struct dentry *debug_nodelist; + struct dentry *vport_debugfs_root; + struct lpfc_debugfs_trc *disc_trc; + atomic_t disc_trc_cnt; +#endif }; struct hbq_s { @@ -360,11 +363,19 @@ struct hbq_s { uint32_t next_hbqPutIdx; /* Index to next HBQ slot to use */ uint32_t hbqPutIdx; /* HBQ slot to use */ uint32_t local_hbqGetIdx; /* Local copy of Get index from Port */ + void *hbq_virt; /* Virtual ptr to this hbq */ + struct list_head hbq_buffer_list; /* buffers assigned to this HBQ */ + /* Callback for HBQ buffer allocation */ + struct hbq_dmabuf *(*hbq_alloc_buffer) (struct lpfc_hba *); + /* Callback for HBQ buffer free */ + void (*hbq_free_buffer) (struct lpfc_hba *, + struct hbq_dmabuf *); }; -#define LPFC_MAX_HBQS 16 -/* this matches the possition in the lpfc_hbq_defs array */ +#define LPFC_MAX_HBQS 4 +/* this matches the position in the lpfc_hbq_defs array */ #define LPFC_ELS_HBQ 0 +#define LPFC_EXTRA_HBQ 1 struct lpfc_hba { struct lpfc_sli sli; @@ -460,7 +471,6 @@ struct lpfc_hba { wait_queue_head_t *work_wait; struct task_struct *worker_thread; - struct list_head hbq_buffer_list; uint32_t hbq_count; /* Count of configured HBQs */ struct hbq_s hbqs[LPFC_MAX_HBQS]; /* local copy of hbq indicies */ @@ -529,6 +539,7 @@ struct lpfc_hba { mempool_t *nlp_mem_pool; struct fc_host_statistics link_stats; + uint8_t using_msi; struct list_head port_list; struct lpfc_vport *pport; /* physical lpfc_vport pointer */ diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 0a7f06ba77c0..09743d7b6bab 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -1027,8 +1027,8 @@ static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ static ssize_t lpfc_soft_wwnn_show(struct class_device *cdev, char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); - struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; + struct Scsi_Host *shost = class_to_shost(cdev); + struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; return snprintf(buf, PAGE_SIZE, "0x%llx\n", (unsigned long long)phba->cfg_soft_wwnn); } @@ -1037,8 +1037,8 @@ lpfc_soft_wwnn_show(struct class_device *cdev, char *buf) static ssize_t lpfc_soft_wwnn_store(struct class_device *cdev, const char *buf, size_t count) { - struct Scsi_Host *host = class_to_shost(cdev); - struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; + struct Scsi_Host *shost = class_to_shost(cdev); + struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; unsigned int i, j, cnt=count; u8 wwnn[8]; @@ -1153,24 +1153,15 @@ lpfc_nodev_tmo_init(struct lpfc_vport *vport, int val) static void lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) { - struct lpfc_vport **vports; struct Scsi_Host *shost; struct lpfc_nodelist *ndlp; - int i; - vports = lpfc_create_vport_work_array(vport->phba); - if (vports != NULL) - for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { - shost = lpfc_shost_from_vport(vports[i]); - spin_lock_irq(shost->host_lock); - list_for_each_entry(ndlp, &vports[i]->fc_nodes, - nlp_listp) - if (ndlp->rport) - ndlp->rport->dev_loss_tmo = - vport->cfg_devloss_tmo; - spin_unlock_irq(shost->host_lock); - } - lpfc_destroy_vport_work_array(vports); + shost = lpfc_shost_from_vport(vport); + spin_lock_irq(shost->host_lock); + list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) + if (ndlp->rport) + ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; + spin_unlock_irq(shost->host_lock); } static int diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index ef86345ced6e..b789355fedf5 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h @@ -102,7 +102,7 @@ int lpfc_issue_els_scr(struct lpfc_vport *, uint32_t, uint8_t); int lpfc_els_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *); int lpfc_ct_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *); int lpfc_els_rsp_acc(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *, - struct lpfc_nodelist *, LPFC_MBOXQ_t *, uint8_t); + struct lpfc_nodelist *, LPFC_MBOXQ_t *); int lpfc_els_rsp_reject(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *, struct lpfc_nodelist *, LPFC_MBOXQ_t *); int lpfc_els_rsp_adisc_acc(struct lpfc_vport *, struct lpfc_iocbq *, @@ -163,9 +163,11 @@ LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *); void lpfc_mbox_cmpl_put(struct lpfc_hba *, LPFC_MBOXQ_t *); int lpfc_mbox_tmo_val(struct lpfc_hba *, int); -void lpfc_config_hbq(struct lpfc_hba *, struct lpfc_hbq_init *, uint32_t , - LPFC_MBOXQ_t *); +void lpfc_config_hbq(struct lpfc_hba *, uint32_t, struct lpfc_hbq_init *, + uint32_t , LPFC_MBOXQ_t *); struct lpfc_hbq_entry * lpfc_sli_next_hbq_slot(struct lpfc_hba *, uint32_t); +struct hbq_dmabuf *lpfc_els_hbq_alloc(struct lpfc_hba *); +void lpfc_els_hbq_free(struct lpfc_hba *, struct hbq_dmabuf *); int lpfc_mem_alloc(struct lpfc_hba *); void lpfc_mem_free(struct lpfc_hba *); @@ -202,6 +204,7 @@ int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *, struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *, struct lpfc_sli_ring *, dma_addr_t); +int lpfc_sli_hbq_count(void); int lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *, uint32_t); int lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *, uint32_t); void lpfc_sli_hbqbuf_free_all(struct lpfc_hba *); @@ -209,10 +212,9 @@ struct hbq_dmabuf *lpfc_sli_hbqbuf_find(struct lpfc_hba *, uint32_t); int lpfc_sli_hbq_size(void); int lpfc_sli_issue_abort_iotag(struct lpfc_hba *, struct lpfc_sli_ring *, struct lpfc_iocbq *); -int lpfc_sli_sum_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, - uint64_t, lpfc_ctx_cmd); -int lpfc_sli_abort_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, - uint64_t, uint32_t, lpfc_ctx_cmd); +int lpfc_sli_sum_iocb(struct lpfc_vport *, uint16_t, uint64_t, lpfc_ctx_cmd); +int lpfc_sli_abort_iocb(struct lpfc_vport *, struct lpfc_sli_ring *, uint16_t, + uint64_t, lpfc_ctx_cmd); void lpfc_mbox_timeout(unsigned long); void lpfc_mbox_timeout_handler(struct lpfc_hba *); @@ -236,8 +238,6 @@ void lpfc_sli_abort_fcp_cmpl(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, struct lpfc_iocbq * rspiocb); -void *lpfc_hbq_alloc(struct lpfc_hba *, int, dma_addr_t *); -void lpfc_hbq_free(struct lpfc_hba *, void *, dma_addr_t); void lpfc_sli_free_hbq(struct lpfc_hba *, struct hbq_dmabuf *); void *lpfc_mbuf_alloc(struct lpfc_hba *, int, dma_addr_t *); diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index ad7f33a31567..6f187f3b3048 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -257,6 +257,10 @@ lpfc_ct_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *ctiocb) { struct lpfc_dmabuf *buf_ptr; + if (ctiocb->context_un.ndlp) { + lpfc_nlp_put(ctiocb->context_un.ndlp); + ctiocb->context_un.ndlp = NULL; + } if (ctiocb->context1) { buf_ptr = (struct lpfc_dmabuf *) ctiocb->context1; lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); @@ -314,6 +318,7 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, /* Save for completion so we can release these resources */ geniocb->context1 = (uint8_t *) inp; geniocb->context2 = (uint8_t *) outp; + geniocb->context_un.ndlp = ndlp; /* Fill in payload, bp points to frame payload */ icmd->ulpCommand = CMD_GEN_REQUEST64_CR; @@ -548,8 +553,12 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, struct lpfc_dmabuf *bmp; struct lpfc_dmabuf *outp; struct lpfc_sli_ct_request *CTrsp; + struct lpfc_nodelist *ndlp; int rc; + /* First save ndlp, before we overwrite it */ + ndlp = cmdiocb->context_un.ndlp; + /* we pass cmdiocb to state machine which needs rspiocb as well */ cmdiocb->context_un.rsp_iocb = rspiocb; @@ -674,6 +683,7 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, lpfc_disc_start(vport); } out: + cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */ lpfc_ct_free_iocb(phba, cmdiocb); return; } @@ -776,10 +786,14 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, struct lpfc_dmabuf *outp; IOCB_t *irsp; struct lpfc_sli_ct_request *CTrsp; + struct lpfc_nodelist *ndlp; int cmdcode, rc; uint8_t retry; uint32_t latt; + /* First save ndlp, before we overwrite it */ + ndlp = cmdiocb->context_un.ndlp; + /* we pass cmdiocb to state machine which needs rspiocb as well */ cmdiocb->context_un.rsp_iocb = rspiocb; @@ -828,6 +842,7 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, } out: + cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */ lpfc_ct_free_iocb(phba, cmdiocb); return; } @@ -1066,6 +1081,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode, cmpl = lpfc_cmpl_ct_cmd_rff_id; break; } + lpfc_nlp_get(ndlp); if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) { /* On success, The cmpl function will free the buffers */ @@ -1076,6 +1092,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode, } rc=6; + lpfc_nlp_put(ndlp); lpfc_mbuf_free(phba, bmp->virt, bmp->phys); ns_cmd_free_bmp: kfree(bmp); @@ -1501,10 +1518,12 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) bpl->tus.w = le32_to_cpu(bpl->tus.w); cmpl = lpfc_cmpl_ct_cmd_fdmi; + lpfc_nlp_get(ndlp); if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP, 0)) return 0; + lpfc_nlp_put(ndlp); lpfc_mbuf_free(phba, bmp->virt, bmp->phys); fdmi_cmd_free_bmp: kfree(bmp); diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index f334761d04df..697a09dccb6f 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -71,7 +71,7 @@ * lpfc_debugfs_mask_disc_trc=Y Where Y is an event mask as defined in * lpfc_debugfs.h . */ -static int lpfc_debugfs_enable = 0; +static int lpfc_debugfs_enable = 1; module_param(lpfc_debugfs_enable, int, 0); MODULE_PARM_DESC(lpfc_debugfs_enable, "Enable debugfs services"); @@ -113,7 +113,6 @@ struct lpfc_debug { }; extern struct lpfc_hbq_init *lpfc_hbq_defs[]; -extern int lpfc_sli_hbq_count(void); atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0); unsigned long lpfc_debugfs_start_time = 0L; @@ -233,8 +232,9 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) len += snprintf(buf+len, size-len, "HBQ %d Info\n", i); + hbqs = &phba->hbqs[i]; posted = 0; - list_for_each_entry(d_buf, &phba->hbq_buffer_list, list) + list_for_each_entry(d_buf, &hbqs->hbq_buffer_list, list) posted++; hip = lpfc_hbq_defs[i]; @@ -243,7 +243,6 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) hip->hbq_index, hip->profile, hip->rn, hip->buffer_count, hip->init_count, hip->add_count, posted); - hbqs = &phba->hbqs[i]; raw_index = phba->hbq_get[i]; getidx = le32_to_cpu(raw_index); len += snprintf(buf+len, size-len, @@ -251,7 +250,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) hbqs->entry_count, hbqs->hbqPutIdx, hbqs->next_hbqPutIdx, hbqs->local_hbqGetIdx, getidx); - hbqe = (struct lpfc_hbq_entry *) phba->hbqslimp.virt; + hbqe = (struct lpfc_hbq_entry *) phba->hbqs[i].hbq_virt; for (j=0; jentry_count; j++) { len += snprintf(buf+len, size-len, "%03d: %08x %04x %05x ", j, @@ -277,7 +276,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) } /* Get the Buffer info for the posted buffer */ - list_for_each_entry(d_buf, &phba->hbq_buffer_list, list) { + list_for_each_entry(d_buf, &hbqs->hbq_buffer_list, list) { hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); phys = ((uint64_t)hbq_buf->dbuf.phys & 0xffffffff); if (phys == hbqe->bde.addrLow) { diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 9365e19696e2..8085900635d4 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -196,9 +196,7 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp, bpl->tus.w = le32_to_cpu(bpl->tus.w); } - /* Save for completion so we can release these resources */ - if (elscmd != ELS_CMD_LS_RJT) - elsiocb->context1 = lpfc_nlp_get(ndlp); + elsiocb->context1 = lpfc_nlp_get(ndlp); elsiocb->context2 = pcmd; elsiocb->context3 = pbuflist; elsiocb->retry = retry; @@ -1809,8 +1807,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, "retrying...\n"); lpfc_mbx_unreg_vpi(vport); retry = 1; - /* Always retry for this case */ - cmdiocb->retry = 0; + /* FDISC retry policy */ + maxretry = 48; + if (cmdiocb->retry >= 32) + delay = 1000; } break; @@ -1886,8 +1886,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, delay = 1000; maxretry = 48; } else if (cmd == ELS_CMD_FDISC) { - /* Always retry for this case */ - cmdiocb->retry = 0; + /* FDISC retry policy */ + maxretry = 48; + if (cmdiocb->retry >= 32) + delay = 1000; } retry = 1; break; @@ -2121,9 +2123,9 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, } lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, - "ACC cmpl: status:x%x/x%x did:x%x", + "ELS rsp cmpl: status:x%x/x%x did:x%x", irsp->ulpStatus, irsp->un.ulpWord[4], - irsp->un.rcvels.remoteID); + cmdiocb->iocb.un.elsreq64.remoteID); /* ELS response tag completes */ lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, "0110 ELS response tag x%x completes " @@ -2184,7 +2186,7 @@ out: int lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag, struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp, - LPFC_MBOXQ_t *mbox, uint8_t newnode) + LPFC_MBOXQ_t *mbox) { struct Scsi_Host *shost = lpfc_shost_from_vport(vport); struct lpfc_hba *phba = vport->phba; @@ -2270,11 +2272,6 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag, default: return 1; } - - if (newnode) { - lpfc_nlp_put(ndlp); - elsiocb->context1 = NULL; - } /* Xmit ELS ACC response tag */ lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, "0128 Xmit ELS ACC response tag x%x, XRI: x%x, " @@ -2333,10 +2330,8 @@ lpfc_els_rsp_reject(struct lpfc_vport *vport, uint32_t rejectError, pcmd += sizeof(uint32_t); *((uint32_t *) (pcmd)) = rejectError; - if (mbox) { + if (mbox) elsiocb->context_un.mbox = mbox; - elsiocb->context1 = lpfc_nlp_get(ndlp); - } /* Xmit ELS RJT response tag */ lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, @@ -2353,6 +2348,15 @@ lpfc_els_rsp_reject(struct lpfc_vport *vport, uint32_t rejectError, phba->fc_stat.elsXmitLSRJT++; elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; rc = lpfc_sli_issue_iocb(phba, pring, elsiocb, 0); + + /* If the node is in the UNUSED state, and we are sending + * a reject, we are done with it. Release driver reference + * count here. The outstanding els will release its reference on + * completion and the node can be freed then. + */ + if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) + lpfc_nlp_put(ndlp); + if (rc == IOCB_ERROR) { lpfc_els_free_iocb(phba, elsiocb); return 1; @@ -2747,7 +2751,7 @@ lpfc_rscn_recovery_check(struct lpfc_vport *vport) static int lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, - struct lpfc_nodelist *ndlp, uint8_t newnode) + struct lpfc_nodelist *ndlp) { struct Scsi_Host *shost = lpfc_shost_from_vport(vport); struct lpfc_hba *phba = vport->phba; @@ -2781,8 +2785,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, "RCV RSCN ignore: did:x%x/ste:x%x flg:x%x", ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag); - lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, - newnode); + lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); return 0; } @@ -2814,7 +2817,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, ndlp->nlp_flag); lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, - ndlp, NULL, newnode); + ndlp, NULL); return 0; } } @@ -2870,8 +2873,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, vport->port_state); } /* Send back ACC */ - lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, - newnode); + lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); /* send RECOVERY event for ALL nodes that match RSCN payload */ lpfc_rscn_recovery_check(vport); @@ -2896,7 +2898,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, lpfc_set_disctmo(vport); /* Send back ACC */ - lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, newnode); + lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); /* send RECOVERY event for ALL nodes that match RSCN payload */ lpfc_rscn_recovery_check(vport); @@ -2965,7 +2967,7 @@ lpfc_els_handle_rscn(struct lpfc_vport *vport) static int lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, - struct lpfc_nodelist *ndlp, uint8_t newnode) + struct lpfc_nodelist *ndlp) { struct Scsi_Host *shost = lpfc_shost_from_vport(vport); struct lpfc_hba *phba = vport->phba; @@ -3048,7 +3050,7 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, } /* Send back ACC */ - lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL, newnode); + lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL); return 0; } @@ -3409,7 +3411,7 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, "0600 FARP-RSP received from DID x%x\n", did); /* ACCEPT the Farp resp request */ - lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); + lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); return 0; } @@ -3791,7 +3793,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, did, vport->port_state, ndlp->nlp_flag); phba->fc_stat.elsRcvFLOGI++; - lpfc_els_rcv_flogi(vport, elsiocb, ndlp, newnode); + lpfc_els_rcv_flogi(vport, elsiocb, ndlp); if (newnode) lpfc_drop_node(vport, ndlp); break; @@ -3821,7 +3823,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, break; case ELS_CMD_RSCN: phba->fc_stat.elsRcvRSCN++; - lpfc_els_rcv_rscn(vport, elsiocb, ndlp, newnode); + lpfc_els_rcv_rscn(vport, elsiocb, ndlp); if (newnode) lpfc_drop_node(vport, ndlp); break; @@ -3951,8 +3953,6 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE; lpfc_els_rsp_reject(vport, stat.un.lsRjtError, elsiocb, ndlp, NULL); - if (newnode) - lpfc_drop_node(vport, ndlp); } return; diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index f96ab75ba637..8788f14b1dec 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -83,10 +83,17 @@ lpfc_terminate_rport_io(struct fc_rport *rport) ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag); if (ndlp->nlp_sid != NLP_NO_SID) { - lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], - ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT); + lpfc_sli_abort_iocb(ndlp->vport, + &phba->sli.ring[phba->sli.fcp_ring], + ndlp->nlp_sid, 0, LPFC_CTX_TGT); } + /* + * A device is normally blocked for rediscovery and unblocked when + * devloss timeout happens. In case a vport is removed or driver + * unloaded before devloss timeout happens, we need to unblock here. + */ + scsi_target_unblock(&rport->dev); return; } @@ -194,8 +201,8 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) if (ndlp->nlp_sid != NLP_NO_SID) { warn_on = 1; /* flush the target */ - lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], - ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT); + lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring], + ndlp->nlp_sid, 0, LPFC_CTX_TGT); } if (vport->load_flag & FC_UNLOADING) warn_on = 0; @@ -348,6 +355,7 @@ lpfc_work_done(struct lpfc_hba *phba) struct lpfc_sli_ring *pring; uint32_t ha_copy, status, control, work_port_events; struct lpfc_vport **vports; + struct lpfc_vport *vport; int i; spin_lock_irq(&phba->hbalock); @@ -365,12 +373,22 @@ lpfc_work_done(struct lpfc_hba *phba) lpfc_handle_latt(phba); vports = lpfc_create_vport_work_array(phba); if (vports != NULL) - for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { - work_port_events = vports[i]->work_port_events; + for(i = 0; i < LPFC_MAX_VPORTS; i++) { + /* + * We could have no vports in array if unloading, so if + * this happens then just use the pport + */ + if (vports[i] == NULL && i == 0) + vport = phba->pport; + else + vport = vports[i]; + if (vport == NULL) + break; + work_port_events = vport->work_port_events; if (work_port_events & WORKER_DISC_TMO) - lpfc_disc_timeout_handler(vports[i]); + lpfc_disc_timeout_handler(vport); if (work_port_events & WORKER_ELS_TMO) - lpfc_els_timeout_handler(vports[i]); + lpfc_els_timeout_handler(vport); if (work_port_events & WORKER_HB_TMO) lpfc_hb_timeout_handler(phba); if (work_port_events & WORKER_MBOX_TMO) @@ -378,14 +396,14 @@ lpfc_work_done(struct lpfc_hba *phba) if (work_port_events & WORKER_FABRIC_BLOCK_TMO) lpfc_unblock_fabric_iocbs(phba); if (work_port_events & WORKER_FDMI_TMO) - lpfc_fdmi_timeout_handler(vports[i]); + lpfc_fdmi_timeout_handler(vport); if (work_port_events & WORKER_RAMP_DOWN_QUEUE) lpfc_ramp_down_queue_handler(phba); if (work_port_events & WORKER_RAMP_UP_QUEUE) lpfc_ramp_up_queue_handler(phba); - spin_lock_irq(&vports[i]->work_port_lock); - vports[i]->work_port_events &= ~work_port_events; - spin_unlock_irq(&vports[i]->work_port_lock); + spin_lock_irq(&vport->work_port_lock); + vport->work_port_events &= ~work_port_events; + spin_unlock_irq(&vport->work_port_lock); } lpfc_destroy_vport_work_array(vports); @@ -1638,16 +1656,7 @@ lpfc_dequeue_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) void lpfc_drop_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) { - struct Scsi_Host *shost = lpfc_shost_from_vport(vport); - - if ((ndlp->nlp_flag & NLP_DELAY_TMO) != 0) - lpfc_cancel_retry_delay_tmo(vport, ndlp); - if (ndlp->nlp_state && !list_empty(&ndlp->nlp_listp)) - lpfc_nlp_counters(vport, ndlp->nlp_state, -1); - spin_lock_irq(shost->host_lock); - list_del_init(&ndlp->nlp_listp); - ndlp->nlp_flag &= ~NLP_TARGET_REMOVE; - spin_unlock_irq(shost->host_lock); + lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE); lpfc_nlp_put(ndlp); } diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index c2fb59f595f3..a90b1fd9c760 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h @@ -150,7 +150,11 @@ struct lpfc_sli_ct_request { struct gff_acc { uint8_t fbits[128]; } gff_acc; +#ifdef __BIG_ENDIAN_BITFIELD +#define FCP_TYPE_FEATURE_OFFSET 7 +#else /* __LITTLE_ENDIAN_BITFIELD */ #define FCP_TYPE_FEATURE_OFFSET 4 +#endif struct rff { uint32_t PortId; uint8_t reserved[2]; diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 7e5ea0774e58..21f8f7a56e23 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -55,6 +55,8 @@ static DEFINE_IDR(lpfc_hba_index); +extern struct lpfc_hbq_init *lpfc_hbq_defs[]; + /************************************************************************/ /* */ /* lpfc_config_port_prep */ @@ -429,18 +431,11 @@ lpfc_config_port_post(struct lpfc_hba *phba) int lpfc_hba_down_prep(struct lpfc_hba *phba) { - struct lpfc_vport **vports; - int i; - /* Disable interrupts */ writel(0, phba->HCregaddr); readl(phba->HCregaddr); /* flush */ - vports = lpfc_create_vport_work_array(phba); - if (vports != NULL) - for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) - lpfc_cleanup_discovery_resources(vports[i]); - lpfc_destroy_vport_work_array(vports); + lpfc_cleanup_discovery_resources(phba->pport); return 0; } @@ -512,7 +507,7 @@ lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) mempool_free(pmboxq, phba->mbox_mem_pool); if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && !(phba->link_state == LPFC_HBA_ERROR) && - !(phba->pport->fc_flag & FC_UNLOADING)) + !(phba->pport->load_flag & FC_UNLOADING)) mod_timer(&phba->hb_tmofunc, jiffies + HZ * LPFC_HB_MBOX_INTERVAL); return; @@ -526,7 +521,7 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba) struct lpfc_sli *psli = &phba->sli; if ((phba->link_state == LPFC_HBA_ERROR) || - (phba->pport->fc_flag & FC_UNLOADING) || + (phba->pport->load_flag & FC_UNLOADING) || (phba->pport->fc_flag & FC_OFFLINE_MODE)) return; @@ -1340,16 +1335,9 @@ lpfc_stop_vport_timers(struct lpfc_vport *vport) static void lpfc_stop_phba_timers(struct lpfc_hba *phba) { - struct lpfc_vport **vports; - int i; - del_timer_sync(&phba->fcp_poll_timer); del_timer_sync(&phba->fc_estabtmo); - vports = lpfc_create_vport_work_array(phba); - if (vports != NULL) - for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) - lpfc_stop_vport_timers(vports[i]); - lpfc_destroy_vport_work_array(vports); + lpfc_stop_vport_timers(phba->pport); del_timer_sync(&phba->sli.mbox_tmo); del_timer_sync(&phba->fabric_block_timer); phba->hb_outstanding = 0; @@ -1455,6 +1443,11 @@ lpfc_offline(struct lpfc_hba *phba) /* stop all timers associated with this hba */ lpfc_stop_phba_timers(phba); + vports = lpfc_create_vport_work_array(phba); + if (vports != NULL) + for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) + lpfc_stop_vport_timers(vports[i]); + lpfc_destroy_vport_work_array(vports); lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, "0460 Bring Adapter offline\n"); /* Bring down the SLI Layer and cleanup. The HBA is offline @@ -1629,7 +1622,7 @@ int lpfc_scan_finished(struct Scsi_Host *shost, unsigned long time) spin_lock_irq(shost->host_lock); - if (vport->fc_flag & FC_UNLOADING) { + if (vport->load_flag & FC_UNLOADING) { stat = 1; goto finished; } @@ -1706,7 +1699,7 @@ void lpfc_host_attrib_init(struct Scsi_Host *shost) fc_host_max_npiv_vports(shost) = phba->max_vpi; spin_lock_irq(shost->host_lock); - vport->fc_flag &= ~FC_LOADING; + vport->load_flag &= ~FC_LOADING; spin_unlock_irq(shost->host_lock); } @@ -1718,9 +1711,10 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) struct lpfc_sli *psli; struct lpfc_iocbq *iocbq_entry = NULL, *iocbq_next = NULL; struct Scsi_Host *shost = NULL; + void *ptr; unsigned long bar0map_len, bar2map_len; int error = -ENODEV; - int i; + int i, hbq_count; uint16_t iotag; if (pci_enable_device(pdev)) @@ -1741,7 +1735,6 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) goto out_free_phba; INIT_LIST_HEAD(&phba->port_list); - INIT_LIST_HEAD(&phba->hbq_buffer_list); /* * Get all the module params for configuring this host and then * establish the host. @@ -1819,6 +1812,17 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) if (!phba->hbqslimp.virt) goto out_free_slim; + hbq_count = lpfc_sli_hbq_count(); + ptr = phba->hbqslimp.virt; + for (i = 0; i < hbq_count; ++i) { + phba->hbqs[i].hbq_virt = ptr; + INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); + ptr += (lpfc_hbq_defs[i]->entry_count * + sizeof(struct lpfc_hbq_entry)); + } + phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; + phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; + memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); /* Initialize the SLI Layer to run with lpfc HBAs. */ @@ -1894,7 +1898,9 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) if (phba->cfg_use_msi) { error = pci_enable_msi(phba->pcidev); - if (error) + if (!error) + phba->using_msi = 1; + else lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0452 Enable MSI failed, continuing " "with IRQ\n"); @@ -1941,14 +1947,15 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) out_remove_device: lpfc_free_sysfs_attr(vport); spin_lock_irq(shost->host_lock); - vport->fc_flag |= FC_UNLOADING; + vport->load_flag |= FC_UNLOADING; spin_unlock_irq(shost->host_lock); out_free_irq: lpfc_stop_phba_timers(phba); phba->pport->work_port_events = 0; free_irq(phba->pcidev->irq, phba); out_disable_msi: - pci_disable_msi(phba->pcidev); + if (phba->using_msi) + pci_disable_msi(phba->pcidev); destroy_port(vport); out_kthread_stop: kthread_stop(phba->worker_thread); @@ -1990,10 +1997,8 @@ lpfc_pci_remove_one(struct pci_dev *pdev) struct Scsi_Host *shost = pci_get_drvdata(pdev); struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; struct lpfc_hba *phba = vport->phba; - struct lpfc_vport *port_iterator; spin_lock_irq(&phba->hbalock); - list_for_each_entry(port_iterator, &phba->port_list, listentry) - port_iterator->load_flag |= FC_UNLOADING; + vport->load_flag |= FC_UNLOADING; spin_unlock_irq(&phba->hbalock); kfree(vport->vname); @@ -2001,7 +2006,6 @@ lpfc_pci_remove_one(struct pci_dev *pdev) fc_remove_host(shost); scsi_remove_host(shost); - /* * Bring down the SLI Layer. This step disable all interrupts, * clears the rings, discards all mailbox commands, and resets @@ -2022,7 +2026,8 @@ lpfc_pci_remove_one(struct pci_dev *pdev) /* Release the irq reservation */ free_irq(phba->pcidev->irq, phba); - pci_disable_msi(phba->pcidev); + if (phba->using_msi) + pci_disable_msi(phba->pcidev); pci_set_drvdata(pdev, NULL); scsi_host_put(shost); @@ -2064,8 +2069,8 @@ lpfc_pci_remove_one(struct pci_dev *pdev) static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state) { - struct Scsi_Host *host = pci_get_drvdata(pdev); - struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; + struct Scsi_Host *shost = pci_get_drvdata(pdev); + struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; struct lpfc_sli *psli = &phba->sli; struct lpfc_sli_ring *pring; @@ -2081,6 +2086,11 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, pring = &psli->ring[psli->fcp_ring]; lpfc_sli_abort_iocb_ring(phba, pring); + /* Release the irq reservation */ + free_irq(phba->pcidev->irq, phba); + if (phba->using_msi) + pci_disable_msi(phba->pcidev); + /* Request a slot reset. */ return PCI_ERS_RESULT_NEED_RESET; } @@ -2093,8 +2103,8 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, */ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) { - struct Scsi_Host *host = pci_get_drvdata(pdev); - struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; + struct Scsi_Host *shost = pci_get_drvdata(pdev); + struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; struct lpfc_sli *psli = &phba->sli; int bars = pci_select_bars(pdev, IORESOURCE_MEM); @@ -2108,9 +2118,9 @@ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) pci_set_master(pdev); /* Re-establishing Link */ - spin_lock_irq(host->host_lock); + spin_lock_irq(shost->host_lock); phba->pport->fc_flag |= FC_ESTABLISH_LINK; - spin_unlock_irq(host->host_lock); + spin_unlock_irq(shost->host_lock); spin_lock_irq(&phba->hbalock); psli->sli_flag &= ~LPFC_SLI2_ACTIVE; @@ -2133,8 +2143,8 @@ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) */ static void lpfc_io_resume(struct pci_dev *pdev) { - struct Scsi_Host *host = pci_get_drvdata(pdev); - struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; + struct Scsi_Host *shost = pci_get_drvdata(pdev); + struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; if (lpfc_online(phba) == 0) { mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60); diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index 09ecdcb63a74..a592733664e9 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c @@ -560,7 +560,8 @@ lpfc_build_hbq_profile5(struct config_hbq_var *hbqmb, } void -lpfc_config_hbq(struct lpfc_hba *phba, struct lpfc_hbq_init *hbq_desc, +lpfc_config_hbq(struct lpfc_hba *phba, uint32_t id, + struct lpfc_hbq_init *hbq_desc, uint32_t hbq_entry_index, LPFC_MBOXQ_t *pmb) { int i; @@ -568,6 +569,7 @@ lpfc_config_hbq(struct lpfc_hba *phba, struct lpfc_hbq_init *hbq_desc, struct config_hbq_var *hbqmb = &mb->un.varCfgHbq; memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); + hbqmb->hbqId = id; hbqmb->entry_count = hbq_desc->entry_count; /* # entries in HBQ */ hbqmb->recvNotify = hbq_desc->rn; /* Receive * Notification */ @@ -687,7 +689,7 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) if (phba->sli_rev == 3 && phba->vpd.sli3Feat.cerbm) { mb->un.varCfgPort.cerbm = 1; /* Request HBQs */ - mb->un.varCfgPort.max_hbq = 1; /* Requesting 2 HBQs */ + mb->un.varCfgPort.max_hbq = lpfc_sli_hbq_count(); if (phba->max_vpi && phba->cfg_enable_npiv && phba->vpd.sli3Feat.cmv) { mb->un.varCfgPort.max_vpi = phba->max_vpi; diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c index 3594c469494f..43c3b8a0d76a 100644 --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c @@ -231,21 +231,34 @@ lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma) return; } -void * -lpfc_hbq_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle) +struct hbq_dmabuf * +lpfc_els_hbq_alloc(struct lpfc_hba *phba) { - void *ret; - ret = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_ATOMIC, handle); - return ret; + struct hbq_dmabuf *hbqbp; + + hbqbp = kmalloc(sizeof(struct hbq_dmabuf), GFP_KERNEL); + if (!hbqbp) + return NULL; + + hbqbp->dbuf.virt = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL, + &hbqbp->dbuf.phys); + if (!hbqbp->dbuf.virt) { + kfree(hbqbp); + return NULL; + } + hbqbp->size = LPFC_BPL_SIZE; + return hbqbp; } void -lpfc_hbq_free(struct lpfc_hba *phba, void *virt, dma_addr_t dma) +lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp) { - pci_pool_free(phba->lpfc_hbq_pool, virt, dma); + pci_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys); + kfree(hbqbp); return; } +/* This is ONLY called for the LPFC_ELS_HBQ */ void lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) { @@ -254,9 +267,8 @@ lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { hbq_entry = container_of(mp, struct hbq_dmabuf, dbuf); if (hbq_entry->tag == -1) { - lpfc_hbq_free(phba, hbq_entry->dbuf.virt, - hbq_entry->dbuf.phys); - kfree(hbq_entry); + (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer) + (phba, hbq_entry); } else { lpfc_sli_free_hbq(phba, hbq_entry); } diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 66ba51cbeb50..880af0cd463d 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -329,7 +329,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, case NLP_STE_PRLI_ISSUE: case NLP_STE_UNMAPPED_NODE: case NLP_STE_MAPPED_NODE: - lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL, 0); + lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL); return 1; } @@ -407,7 +407,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, ndlp, mbox); return 1; } - lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0); + lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox); return 1; out: @@ -451,7 +451,7 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, lpfc_els_rsp_adisc_acc(vport, cmdiocb, ndlp); } else { lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, - NULL, 0); + NULL); } return 1; } @@ -488,9 +488,9 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, ndlp->nlp_flag |= NLP_LOGO_ACC; spin_unlock_irq(shost->host_lock); if (els_cmd == ELS_CMD_PRLO) - lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); + lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); else - lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); + lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); if (!(ndlp->nlp_type & NLP_FABRIC) || (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) { @@ -564,6 +564,11 @@ lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) { struct Scsi_Host *shost = lpfc_shost_from_vport(vport); + if (!ndlp->nlp_rpi) { + ndlp->nlp_flag &= ~NLP_NPR_ADISC; + return 0; + } + /* Check config parameter use-adisc or FCP-2 */ if ((vport->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) || ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) { @@ -627,7 +632,7 @@ lpfc_rcv_logo_unused_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, spin_lock_irq(shost->host_lock); ndlp->nlp_flag |= NLP_LOGO_ACC; spin_unlock_irq(shost->host_lock); - lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); + lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE); return ndlp->nlp_state; @@ -723,7 +728,7 @@ lpfc_rcv_els_plogi_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, lpfc_els_abort(phba, ndlp); if (evt == NLP_EVT_RCV_LOGO) { - lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); + lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); } else { lpfc_issue_els_logo(vport, ndlp, 0); } @@ -1167,7 +1172,7 @@ lpfc_rcv_prlo_reglogin_issue(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb; cmdiocb = (struct lpfc_iocbq *) arg; - lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); + lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); return ndlp->nlp_state; } @@ -1322,7 +1327,7 @@ lpfc_rcv_prlo_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, { struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; - lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); + lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); return ndlp->nlp_state; } @@ -1514,7 +1519,7 @@ lpfc_rcv_prlo_unmap_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, { struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; - lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); + lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); return ndlp->nlp_state; } @@ -1585,8 +1590,8 @@ lpfc_rcv_prlo_mapped_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; /* flush the target */ - lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], - ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT); + lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring], + ndlp->nlp_sid, 0, LPFC_CTX_TGT); /* Treat like rcv logo */ lpfc_rcv_logo(vport, ndlp, cmdiocb, ELS_CMD_PRLO); @@ -1719,7 +1724,7 @@ lpfc_rcv_prlo_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, ndlp->nlp_flag |= NLP_LOGO_ACC; spin_unlock_irq(shost->host_lock); - lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); + lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); if ((ndlp->nlp_flag & NLP_DELAY_TMO) == 0) { mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1); diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 9ee2927ad82a..94458d7a8f7f 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -152,7 +152,6 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) } } lpfc_destroy_vport_work_array(vports); - spin_unlock_irq(&phba->hbalock); atomic_set(&phba->num_rsrc_err, 0); atomic_set(&phba->num_cmd_success, 0); } @@ -1195,14 +1194,12 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) * Unfortunately, some targets do not abide by this forcing the driver * to double check. */ - cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], - cmnd->device->id, cmnd->device->lun, + cnt = lpfc_sli_sum_iocb(vport, cmnd->device->id, cmnd->device->lun, LPFC_CTX_LUN); if (cnt) - lpfc_sli_abort_iocb(phba, - &phba->sli.ring[phba->sli.fcp_ring], + lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring], cmnd->device->id, cmnd->device->lun, - 0, LPFC_CTX_LUN); + LPFC_CTX_LUN); loopcnt = 0; while(cnt) { schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); @@ -1211,10 +1208,8 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT) break; - cnt = lpfc_sli_sum_iocb(phba, - &phba->sli.ring[phba->sli.fcp_ring], - cmnd->device->id, cmnd->device->lun, - LPFC_CTX_LUN); + cnt = lpfc_sli_sum_iocb(vport, cmnd->device->id, + cmnd->device->lun, LPFC_CTX_LUN); } if (cnt) { @@ -1304,11 +1299,10 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) * the targets. Unfortunately, some targets do not abide by * this forcing the driver to double check. */ - cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], - 0, 0, LPFC_CTX_HOST); + cnt = lpfc_sli_sum_iocb(vport, 0, 0, LPFC_CTX_HOST); if (cnt) - lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], - 0, 0, 0, LPFC_CTX_HOST); + lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring], + 0, 0, LPFC_CTX_HOST); loopcnt = 0; while(cnt) { schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); @@ -1317,9 +1311,7 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT) break; - cnt = lpfc_sli_sum_iocb(phba, - &phba->sli.ring[phba->sli.fcp_ring], - 0, 0, LPFC_CTX_HOST); + cnt = lpfc_sli_sum_iocb(vport, 0, 0, LPFC_CTX_HOST); } if (cnt) { diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 5417bc26f181..c54a9ea336a6 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -545,7 +545,8 @@ lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno) return NULL; } - return (struct lpfc_hbq_entry *) phba->hbqslimp.virt + hbqp->hbqPutIdx; + return (struct lpfc_hbq_entry *) phba->hbqs[hbqno].hbq_virt + + hbqp->hbqPutIdx; } void @@ -553,18 +554,21 @@ lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba) { struct lpfc_dmabuf *dmabuf, *next_dmabuf; struct hbq_dmabuf *hbq_buf; + int i, hbq_count; + hbq_count = lpfc_sli_hbq_count(); /* Return all memory used by all HBQs */ - list_for_each_entry_safe(dmabuf, next_dmabuf, - &phba->hbq_buffer_list, list) { - hbq_buf = container_of(dmabuf, struct hbq_dmabuf, dbuf); - list_del(&hbq_buf->dbuf.list); - lpfc_hbq_free(phba, hbq_buf->dbuf.virt, hbq_buf->dbuf.phys); - kfree(hbq_buf); + for (i = 0; i < hbq_count; ++i) { + list_for_each_entry_safe(dmabuf, next_dmabuf, + &phba->hbqs[i].hbq_buffer_list, list) { + hbq_buf = container_of(dmabuf, struct hbq_dmabuf, dbuf); + list_del(&hbq_buf->dbuf.list); + (phba->hbqs[i].hbq_free_buffer)(phba, hbq_buf); + } } } -static void +static struct lpfc_hbq_entry * lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, struct hbq_dmabuf *hbq_buf) { @@ -578,7 +582,7 @@ lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, hbqe->bde.addrHigh = le32_to_cpu(putPaddrHigh(physaddr)); hbqe->bde.addrLow = le32_to_cpu(putPaddrLow(physaddr)); - hbqe->bde.tus.f.bdeSize = FCELSSIZE; + hbqe->bde.tus.f.bdeSize = hbq_buf->size; hbqe->bde.tus.f.bdeFlags = 0; hbqe->bde.tus.w = le32_to_cpu(hbqe->bde.tus.w); hbqe->buffer_tag = le32_to_cpu(hbq_buf->tag); @@ -587,8 +591,9 @@ lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, writel(hbqp->hbqPutIdx, phba->hbq_put + hbqno); /* flush */ readl(phba->hbq_put + hbqno); - list_add_tail(&hbq_buf->dbuf.list, &phba->hbq_buffer_list); + list_add_tail(&hbq_buf->dbuf.list, &hbqp->hbq_buffer_list); } + return hbqe; } static struct lpfc_hbq_init lpfc_els_hbq = { @@ -596,14 +601,26 @@ static struct lpfc_hbq_init lpfc_els_hbq = { .entry_count = 200, .mask_count = 0, .profile = 0, - .ring_mask = 1 << LPFC_ELS_RING, + .ring_mask = (1 << LPFC_ELS_RING), .buffer_count = 0, .init_count = 20, .add_count = 5, }; +static struct lpfc_hbq_init lpfc_extra_hbq = { + .rn = 1, + .entry_count = 200, + .mask_count = 0, + .profile = 0, + .ring_mask = (1 << LPFC_EXTRA_RING), + .buffer_count = 0, + .init_count = 0, + .add_count = 5, +}; + struct lpfc_hbq_init *lpfc_hbq_defs[] = { &lpfc_els_hbq, + &lpfc_extra_hbq, }; int @@ -612,6 +629,10 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) uint32_t i, start, end; struct hbq_dmabuf *hbq_buffer; + if (!phba->hbqs[hbqno].hbq_alloc_buffer) { + return 0; + } + start = lpfc_hbq_defs[hbqno]->buffer_count; end = count + lpfc_hbq_defs[hbqno]->buffer_count; if (end > lpfc_hbq_defs[hbqno]->entry_count) { @@ -620,17 +641,14 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) /* Populate HBQ entries */ for (i = start; i < end; i++) { - hbq_buffer = kmalloc(sizeof(struct hbq_dmabuf), - GFP_KERNEL); + hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); if (!hbq_buffer) return 1; - hbq_buffer->dbuf.virt = lpfc_hbq_alloc(phba, MEM_PRI, - &hbq_buffer->dbuf.phys); - if (hbq_buffer->dbuf.virt == NULL) - return 1; hbq_buffer->tag = (i | (hbqno << 16)); - lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer); - lpfc_hbq_defs[hbqno]->buffer_count++; + if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) + lpfc_hbq_defs[hbqno]->buffer_count++; + else + (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); } return 0; } @@ -654,10 +672,15 @@ lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag) { struct lpfc_dmabuf *d_buf; struct hbq_dmabuf *hbq_buf; + uint32_t hbqno; + + hbqno = tag >> 16; + if (hbqno > LPFC_MAX_HBQS) + return NULL; - list_for_each_entry(d_buf, &phba->hbq_buffer_list, list) { + list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) { hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); - if ((hbq_buf->tag & 0xffff) == tag) { + if (hbq_buf->tag == tag) { return hbq_buf; } } @@ -668,13 +691,15 @@ lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag) } void -lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *sp) +lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer) { uint32_t hbqno; - if (sp) { - hbqno = sp->tag >> 16; - lpfc_sli_hbq_to_firmware(phba, hbqno, sp); + if (hbq_buffer) { + hbqno = hbq_buffer->tag >> 16; + if (!lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) { + (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); + } } } @@ -904,21 +929,26 @@ static struct lpfc_dmabuf * lpfc_sli_replace_hbqbuff(struct lpfc_hba *phba, uint32_t tag) { struct hbq_dmabuf *hbq_entry, *new_hbq_entry; + uint32_t hbqno; + void *virt; /* virtual address ptr */ + dma_addr_t phys; /* mapped address */ hbq_entry = lpfc_sli_hbqbuf_find(phba, tag); if (hbq_entry == NULL) return NULL; list_del(&hbq_entry->dbuf.list); - new_hbq_entry = kmalloc(sizeof(struct hbq_dmabuf), GFP_ATOMIC); + + hbqno = tag >> 16; + new_hbq_entry = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); if (new_hbq_entry == NULL) return &hbq_entry->dbuf; - new_hbq_entry->dbuf = hbq_entry->dbuf; new_hbq_entry->tag = -1; - hbq_entry->dbuf.virt = lpfc_hbq_alloc(phba, 0, &hbq_entry->dbuf.phys); - if (hbq_entry->dbuf.virt == NULL) { - kfree(new_hbq_entry); - return &hbq_entry->dbuf; - } + phys = new_hbq_entry->dbuf.phys; + virt = new_hbq_entry->dbuf.virt; + new_hbq_entry->dbuf.phys = hbq_entry->dbuf.phys; + new_hbq_entry->dbuf.virt = hbq_entry->dbuf.virt; + hbq_entry->dbuf.phys = phys; + hbq_entry->dbuf.virt = virt; lpfc_sli_free_hbq(phba, hbq_entry); return &new_hbq_entry->dbuf; } @@ -964,7 +994,7 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, irsp->un.ulpWord[3]); if (irsp->ulpBdeCount == 2) saveq->context3 = lpfc_sli_replace_hbqbuff(phba, - irsp->un.ulpWord[15]); + irsp->unsli3.sli3Words[7]); } /* unSolicited Responses */ @@ -2189,8 +2219,8 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba) phba->hbqs[hbqno].local_hbqGetIdx = 0; phba->hbqs[hbqno].entry_count = lpfc_hbq_defs[hbqno]->entry_count; - lpfc_config_hbq(phba, lpfc_hbq_defs[hbqno], hbq_entry_index, - pmb); + lpfc_config_hbq(phba, hbqno, lpfc_hbq_defs[hbqno], + hbq_entry_index, pmb); hbq_entry_index += phba->hbqs[hbqno].entry_count; if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { @@ -3433,8 +3463,8 @@ abort_iotag_exit: } static int -lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, - uint64_t lun_id, uint32_t ctx, +lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport, + uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd ctx_cmd) { struct lpfc_scsi_buf *lpfc_cmd; @@ -3444,6 +3474,9 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, if (!(iocbq->iocb_flag & LPFC_IO_FCP)) return rc; + if (iocbq->vport != vport) + return rc; + lpfc_cmd = container_of(iocbq, struct lpfc_scsi_buf, cur_iocbq); cmnd = lpfc_cmd->pCmd; @@ -3460,10 +3493,6 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, if (cmnd->device->id == tgt_id) rc = 0; break; - case LPFC_CTX_CTX: - if (iocbq->iocb.ulpContext == ctx) - rc = 0; - break; case LPFC_CTX_HOST: rc = 0; break; @@ -3477,17 +3506,18 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, } int -lpfc_sli_sum_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, - uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd ctx_cmd) +lpfc_sli_sum_iocb(struct lpfc_vport *vport, uint16_t tgt_id, uint64_t lun_id, + lpfc_ctx_cmd ctx_cmd) { + struct lpfc_hba *phba = vport->phba; struct lpfc_iocbq *iocbq; int sum, i; for (i = 1, sum = 0; i <= phba->sli.last_iotag; i++) { iocbq = phba->sli.iocbq_lookup[i]; - if (lpfc_sli_validate_fcp_iocb (iocbq, tgt_id, lun_id, - 0, ctx_cmd) == 0) + if (lpfc_sli_validate_fcp_iocb (iocbq, vport, tgt_id, lun_id, + ctx_cmd) == 0) sum++; } @@ -3503,10 +3533,10 @@ lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, } int -lpfc_sli_abort_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, - uint16_t tgt_id, uint64_t lun_id, uint32_t ctx, - lpfc_ctx_cmd abort_cmd) +lpfc_sli_abort_iocb(struct lpfc_vport *vport, struct lpfc_sli_ring *pring, + uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd abort_cmd) { + struct lpfc_hba *phba = vport->phba; struct lpfc_iocbq *iocbq; struct lpfc_iocbq *abtsiocb; IOCB_t *cmd = NULL; @@ -3516,7 +3546,7 @@ lpfc_sli_abort_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, for (i = 1; i <= phba->sli.last_iotag; i++) { iocbq = phba->sli.iocbq_lookup[i]; - if (lpfc_sli_validate_fcp_iocb(iocbq, tgt_id, lun_id, 0, + if (lpfc_sli_validate_fcp_iocb(iocbq, vport, tgt_id, lun_id, abort_cmd) != 0) continue; diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h index 76058505795e..50f6d627da2e 100644 --- a/drivers/scsi/lpfc/lpfc_sli.h +++ b/drivers/scsi/lpfc/lpfc_sli.h @@ -26,7 +26,6 @@ struct lpfc_vport; typedef enum _lpfc_ctx_cmd { LPFC_CTX_LUN, LPFC_CTX_TGT, - LPFC_CTX_CTX, LPFC_CTX_HOST } lpfc_ctx_cmd; @@ -54,9 +53,10 @@ struct lpfc_iocbq { void *context2; /* caller context information */ void *context3; /* caller context information */ union { - wait_queue_head_t *wait_queue; - struct lpfc_iocbq *rsp_iocb; - struct lpfcMboxq *mbox; + wait_queue_head_t *wait_queue; + struct lpfc_iocbq *rsp_iocb; + struct lpfcMboxq *mbox; + struct lpfc_nodelist *ndlp; } context_un; void (*fabric_iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *, diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index 77067d17c39d..7f0c263d1bd3 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c @@ -432,8 +432,29 @@ lpfc_vport_delete(struct fc_vport *fc_vport) struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; struct lpfc_hba *phba = vport->phba; long timeout; - int rc = VPORT_ERROR; + if (vport->port_type == LPFC_PHYSICAL_PORT) { + lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, + "1812 vport_delete failed: Cannot delete " + "physical host\n"); + return VPORT_ERROR; + } + /* + * If we are not unloading the driver then prevent the vport_delete + * from happening until after this vport's discovery is finished. + */ + if (!(phba->pport->load_flag & FC_UNLOADING)) { + int check_count = 0; + while (check_count < ((phba->fc_ratov * 3) + 3) && + vport->port_state > LPFC_VPORT_FAILED && + vport->port_state < LPFC_VPORT_READY) { + check_count++; + msleep(1000); + } + if (vport->port_state > LPFC_VPORT_FAILED && + vport->port_state < LPFC_VPORT_READY) + return -EAGAIN; + } /* * This is a bit of a mess. We want to ensure the shost doesn't get * torn down until we're done with the embedded lpfc_vport structure. @@ -451,16 +472,9 @@ lpfc_vport_delete(struct fc_vport *fc_vport) */ if (!scsi_host_get(shost) || !scsi_host_get(shost)) return VPORT_INVAL; - - if (vport->port_type == LPFC_PHYSICAL_PORT) { - lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, - "1812 vport_delete failed: Cannot delete " - "physical host\n"); - goto out; - } - + spin_lock_irq(&phba->hbalock); vport->load_flag |= FC_UNLOADING; - + spin_unlock_irq(&phba->hbalock); kfree(vport->vname); lpfc_debugfs_terminate(vport); fc_remove_host(lpfc_shost_from_vport(vport)); @@ -514,10 +528,8 @@ skip_logo: spin_unlock_irq(&phba->hbalock); lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, "1828 Vport Deleted.\n"); - rc = VPORT_OK; -out: scsi_host_put(shost); - return rc; + return VPORT_OK; } EXPORT_SYMBOL(lpfc_vport_create); @@ -536,7 +548,7 @@ lpfc_create_vport_work_array(struct lpfc_hba *phba) spin_lock_irq(&phba->hbalock); list_for_each_entry(port_iterator, &phba->port_list, listentry) { if (!scsi_host_get(lpfc_shost_from_vport(port_iterator))) { - lpfc_printf_vlog(port_iterator, KERN_ERR, LOG_VPORT, + lpfc_printf_vlog(port_iterator, KERN_WARNING, LOG_VPORT, "1801 Create vport work array FAILED: " "cannot do scsi_host_get\n"); continue; -- cgit v1.2.3 From 311464ec0bfea96e7f09f4afca26283f5fa90c24 Mon Sep 17 00:00:00 2001 From: James Smart Date: Thu, 2 Aug 2007 11:10:37 -0400 Subject: [SCSI] lpfc 8.2.2 : Style cleanups - Clean up all instances of mixed tab-space indentation - Clean up sparse build errors - Add appropriate static's Signed-off-by: James Smart Signed-off-by: James Bottomley --- drivers/scsi/lpfc/lpfc.h | 6 +++--- drivers/scsi/lpfc/lpfc_attr.c | 2 +- drivers/scsi/lpfc/lpfc_crtn.h | 1 + drivers/scsi/lpfc/lpfc_ct.c | 4 ++-- drivers/scsi/lpfc/lpfc_debugfs.c | 8 +++----- drivers/scsi/lpfc/lpfc_hbadisc.c | 32 +++----------------------------- drivers/scsi/lpfc/lpfc_hw.h | 10 +++++----- drivers/scsi/lpfc/lpfc_init.c | 4 ---- drivers/scsi/lpfc/lpfc_sli.c | 4 ++-- drivers/scsi/lpfc/lpfc_sli.h | 2 +- drivers/scsi/lpfc/lpfc_vport.c | 4 ++-- 11 files changed, 23 insertions(+), 54 deletions(-) (limited to 'drivers/scsi/lpfc/lpfc_attr.c') diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index c28db0521c01..ba3ecab9baf3 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -45,7 +45,7 @@ struct lpfc_sli2_slim; #define LPFC_DISC_IOCB_BUFF_COUNT 20 #define LPFC_HB_MBOX_INTERVAL 5 /* Heart beat interval in seconds. */ -#define LPFC_HB_MBOX_TIMEOUT 30 /* Heart beat timeout in seconds. */ +#define LPFC_HB_MBOX_TIMEOUT 30 /* Heart beat timeout in seconds. */ /* Define macros for 64 bit support */ #define putPaddrLow(addr) ((uint32_t) (0xffffffff & (u64)(addr))) @@ -381,7 +381,7 @@ struct lpfc_hba { struct lpfc_sli sli; uint32_t sli_rev; /* SLI2 or SLI3 */ uint32_t sli3_options; /* Mask of enabled SLI3 options */ -#define LPFC_SLI3_ENABLED 0x01 +#define LPFC_SLI3_ENABLED 0x01 #define LPFC_SLI3_HBQ_ENABLED 0x02 #define LPFC_SLI3_NPIV_ENABLED 0x04 #define LPFC_SLI3_VPORT_TEARDOWN 0x08 @@ -390,7 +390,7 @@ struct lpfc_hba { enum hba_state link_state; uint32_t link_flag; /* link state flags */ -#define LS_LOOPBACK_MODE 0x1 /* NPort is in Loopback mode */ +#define LS_LOOPBACK_MODE 0x1 /* NPort is in Loopback mode */ /* This flag is set while issuing */ /* INIT_LINK mailbox command */ #define LS_NPIV_FAB_SUPPORTED 0x2 /* Fabric supports NPIV */ diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 09743d7b6bab..80a11218b9bb 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -430,7 +430,7 @@ lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count) return -EIO; } -int +static int lpfc_get_hba_info(struct lpfc_hba *phba, uint32_t *mxri, uint32_t *axri, uint32_t *mrpi, uint32_t *arpi, diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index b789355fedf5..a599e1510710 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h @@ -278,6 +278,7 @@ extern void lpfc_debugfs_disc_trc(struct lpfc_vport *, int, char *, uint32_t, uint32_t, uint32_t); extern void lpfc_debugfs_slow_ring_trc(struct lpfc_hba *, char *, uint32_t, uint32_t, uint32_t); +extern struct lpfc_hbq_init *lpfc_hbq_defs[]; /* Interface exported by fabric iocb scheduler */ int lpfc_issue_fabric_iocb(struct lpfc_hba *, struct lpfc_iocbq *); diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 6f187f3b3048..c701e4d611a9 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -688,7 +688,7 @@ out: return; } -void +static void lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, struct lpfc_iocbq *rspiocb) { @@ -885,7 +885,7 @@ lpfc_cmpl_ct_cmd_rff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, return; } -int +static int lpfc_vport_symbolic_port_name(struct lpfc_vport *vport, char *symbol, size_t size) { diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 697a09dccb6f..2e3c01bebed6 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -112,10 +112,8 @@ struct lpfc_debug { int len; }; -extern struct lpfc_hbq_init *lpfc_hbq_defs[]; - -atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0); -unsigned long lpfc_debugfs_start_time = 0L; +static atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0); +static unsigned long lpfc_debugfs_start_time = 0L; static int lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) @@ -201,7 +199,7 @@ lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size) return len; } -int lpfc_debugfs_last_hbq = -1; +static int lpfc_debugfs_last_hbq = -1; static int lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 8788f14b1dec..c81c2b3228d6 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -349,7 +349,7 @@ lpfc_work_list_done(struct lpfc_hba *phba) } -void +static void lpfc_work_done(struct lpfc_hba *phba) { struct lpfc_sli_ring *pring; @@ -1591,7 +1591,7 @@ lpfc_nlp_state_name(char *buffer, size_t size, int state) [NLP_STE_NPR_NODE] = "NPR", }; - if (state < ARRAY_SIZE(states) && states[state]) + if (state < NLP_STE_MAX_STATE && states[state]) strlcpy(buffer, states[state], size); else snprintf(buffer, size, "unknown (%d)", state); @@ -2814,32 +2814,6 @@ lpfc_findnode_wwpn(struct lpfc_vport *vport, struct lpfc_name *wwpn) return ndlp; } -void -lpfc_dev_loss_delay(unsigned long ptr) -{ - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) ptr; - struct lpfc_vport *vport = ndlp->vport; - struct lpfc_hba *phba = vport->phba; - struct lpfc_work_evt *evtp = &ndlp->dev_loss_evt; - unsigned long flags; - - evtp = &ndlp->dev_loss_evt; - - spin_lock_irqsave(&phba->hbalock, flags); - if (!list_empty(&evtp->evt_listp)) { - spin_unlock_irqrestore(&phba->hbalock, flags); - return; - } - - evtp->evt_arg1 = ndlp; - evtp->evt = LPFC_EVT_DEV_LOSS_DELAY; - list_add_tail(&evtp->evt_listp, &phba->work_list); - if (phba->work_wait) - lpfc_worker_wake_up(phba); - spin_unlock_irqrestore(&phba->hbalock, flags); - return; -} - void lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, uint32_t did) @@ -2863,7 +2837,7 @@ lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, return; } -void +static void lpfc_nlp_release(struct kref *kref) { struct lpfc_nodelist *ndlp = container_of(kref, struct lpfc_nodelist, diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index a90b1fd9c760..451accd5564b 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h @@ -809,7 +809,7 @@ typedef struct _RNID { /* Structure is in Big Endian format */ } un; } RNID; -typedef struct _RPS { /* Structure is in Big Endian format */ +typedef struct _RPS { /* Structure is in Big Endian format */ union { uint32_t portNum; struct lpfc_name portName; @@ -827,7 +827,7 @@ typedef struct _RPS_RSP { /* Structure is in Big Endian format */ uint32_t crcCnt; } RPS_RSP; -typedef struct _RPL { /* Structure is in Big Endian format */ +typedef struct _RPL { /* Structure is in Big Endian format */ uint32_t maxsize; uint32_t index; } RPL; @@ -838,7 +838,7 @@ typedef struct _PORT_NUM_BLK { struct lpfc_name portName; } PORT_NUM_BLK; -typedef struct _RPL_RSP { /* Structure is in Big Endian format */ +typedef struct _RPL_RSP { /* Structure is in Big Endian format */ uint32_t listLen; uint32_t index; PORT_NUM_BLK port_num_blk; @@ -2617,8 +2617,8 @@ typedef union { LOAD_SM_VAR varLdSM; /* cmd = 1 (LOAD_SM) */ READ_NV_VAR varRDnvp; /* cmd = 2 (READ_NVPARMS) */ WRITE_NV_VAR varWTnvp; /* cmd = 3 (WRITE_NVPARMS) */ - BIU_DIAG_VAR varBIUdiag; /* cmd = 4 (RUN_BIU_DIAG) */ - INIT_LINK_VAR varInitLnk; /* cmd = 5 (INIT_LINK) */ + BIU_DIAG_VAR varBIUdiag; /* cmd = 4 (RUN_BIU_DIAG) */ + INIT_LINK_VAR varInitLnk; /* cmd = 5 (INIT_LINK) */ DOWN_LINK_VAR varDwnLnk; /* cmd = 6 (DOWN_LINK) */ CONFIG_LINK varCfgLnk; /* cmd = 7 (CONFIG_LINK) */ PART_SLIM_VAR varSlim; /* cmd = 8 (PART_SLIM) */ diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 21f8f7a56e23..414350ab584e 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -53,10 +53,6 @@ static struct scsi_transport_template *lpfc_transport_template = NULL; static struct scsi_transport_template *lpfc_vport_transport_template = NULL; static DEFINE_IDR(lpfc_hba_index); - - -extern struct lpfc_hbq_init *lpfc_hbq_defs[]; - /************************************************************************/ /* */ /* lpfc_config_port_prep */ diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index c54a9ea336a6..ce5ff2bccba6 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -363,7 +363,7 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) if (psli->iocbq_lookup) memcpy(new_arr, old_arr, ((psli->last_iotag + 1) * - sizeof (struct lpfc_iocbq *))); + sizeof (struct lpfc_iocbq *))); psli->iocbq_lookup = new_arr; psli->iocbq_lookup_len = new_len; psli->last_iotag = iotag; @@ -623,7 +623,7 @@ struct lpfc_hbq_init *lpfc_hbq_defs[] = { &lpfc_extra_hbq, }; -int +static int lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) { uint32_t i, start, end; diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h index 50f6d627da2e..51b2b6b949be 100644 --- a/drivers/scsi/lpfc/lpfc_sli.h +++ b/drivers/scsi/lpfc/lpfc_sli.h @@ -143,7 +143,7 @@ struct lpfc_sli_ring { uint16_t numCiocb; /* number of command iocb's per ring */ uint16_t numRiocb; /* number of rsp iocb's per ring */ uint16_t sizeCiocb; /* Size of command iocb's in this ring */ - uint16_t sizeRiocb; /* Size of response iocb's in this ring */ + uint16_t sizeRiocb; /* Size of response iocb's in this ring */ uint32_t fast_iotag; /* max fastlookup based iotag */ uint32_t iotag_ctr; /* keeps track of the next iotag to use */ diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index 7f0c263d1bd3..dcb415e717c3 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c @@ -331,7 +331,7 @@ error_out: return rc; } -int +static int disable_vport(struct fc_vport *fc_vport) { struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; @@ -376,7 +376,7 @@ disable_vport(struct fc_vport *fc_vport) return VPORT_OK; } -int +static int enable_vport(struct fc_vport *fc_vport) { struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; -- cgit v1.2.3