From 76a95d75ede64e4f1684ddb8c626fdfdb641bda2 Mon Sep 17 00:00:00 2001 From: James Smart Date: Sat, 20 Nov 2010 23:11:48 -0500 Subject: [SCSI] lpfc 8.3.19: Add SLI4 FC Discovery support Add SLI4 FC Discovery support - Replace READ_LA and READ_LA64 with READ_TOPOLOGY mailbox command. - Converted the old READ_LA structure to use bf_set/get instead of bit fields. - Rename HBA_FCOE_SUPPORT flag to HBA_FCOE_MODE. Flag now indicates function is running as SLI-4 FC or FCoE port. Make sure flag reset each time READ_REV completed as it can dynamically change. - Removed BDE union in the READ_TOPOLOGY mailbox command and added a define to define the ALPA MAP SIZE. Added FC Code for async events. - Added code to support new 16G link speed. - Define new set of values to keep track of valid user settable link speeds. - Used new link speed definitions to define link speed max and bitmap. - Redefined FDMI Port sppeds to be hax values and added the 16G value. - Added new CQE trailer code for FC Events. - Add lpfc_issue_init_vfi and lpfc_init_vfi_cmpl routines. - Replace many calls to the initial_flogi routine with lpfc_issue_init_vfi. - Add vp and vpi fields to the INIT_VFI mailbox command. - Addapt lpfc_hba_init_link routine for SLI4 use. - Use lpfc_hba_init_link call from lpfc_sli4_hba_setup. - Add a check for FC mode to register the FCFI before init link. - Convert lpfc_sli4_init_vpi to be called without a vpi (get it from vport). Signed-off-by: Alex Iannicelli Signed-off-by: James Smart Signed-off-by: James Bottomley --- drivers/scsi/lpfc/lpfc_attr.c | 91 ++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 48 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 c1cbec01345d..45bd72a9f60e 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -52,10 +52,6 @@ #define LPFC_MIN_DEVLOSS_TMO 1 #define LPFC_MAX_DEVLOSS_TMO 255 -#define LPFC_MAX_LINK_SPEED 8 -#define LPFC_LINK_SPEED_BITMAP 0x00000117 -#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8" - /** * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules * @incr: integer to convert. @@ -463,7 +459,7 @@ lpfc_link_state_show(struct device *dev, struct device_attribute *attr, if (phba->sli.sli_flag & LPFC_MENLO_MAINT) len += snprintf(buf + len, PAGE_SIZE-len, " Menlo Maint Mode\n"); - else if (phba->fc_topology == TOPOLOGY_LOOP) { + else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { if (vport->fc_flag & FC_PUBLIC_LOOP) len += snprintf(buf + len, PAGE_SIZE-len, " Public Loop\n"); @@ -2837,14 +2833,8 @@ static struct bin_attribute sysfs_drvr_stat_data_attr = { /* # lpfc_link_speed: Link speed selection for initializing the Fibre Channel # connection. -# 0 = auto select (default) -# 1 = 1 Gigabaud -# 2 = 2 Gigabaud -# 4 = 4 Gigabaud -# 8 = 8 Gigabaud -# Value range is [0,8]. Default value is 0. +# Value range is [0,16]. Default value is 0. */ - /** * lpfc_link_speed_set - Set the adapters link speed * @phba: lpfc_hba pointer. @@ -2869,7 +2859,7 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, struct Scsi_Host *shost = class_to_shost(dev); struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; struct lpfc_hba *phba = vport->phba; - int val = 0; + int val = LPFC_USER_LINK_SPEED_AUTO; int nolip = 0; const char *val_buf = buf; int err; @@ -2885,15 +2875,20 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, if (sscanf(val_buf, "%i", &val) != 1) return -EINVAL; - if (((val == LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || - ((val == LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || - ((val == LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || - ((val == LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || - ((val == LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb))) + if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || + ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || + ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || + ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || + ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) || + ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb))) { + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, + "2879 lpfc_link_speed attribute cannot be set " + "to %d. Speed is not supported by this port.\n", + val); return -EINVAL; - - if ((val >= 0 && val <= 8) - && (LPFC_LINK_SPEED_BITMAP & (1 << val))) { + } + if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) && + (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) { prev_val = phba->cfg_link_speed; phba->cfg_link_speed = val; if (nolip) @@ -2906,11 +2901,9 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, } else return strlen(buf); } - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "%d:0469 lpfc_link_speed attribute cannot be set to %d, " - "allowed range is [0, 8]\n", - phba->brd_no, val); + "0469 lpfc_link_speed attribute cannot be set to %d, " + "allowed values are ["LPFC_LINK_SPEED_STRING"]\n", val); return -EINVAL; } @@ -2938,8 +2931,8 @@ lpfc_param_show(link_speed) static int lpfc_link_speed_init(struct lpfc_hba *phba, int val) { - if ((val >= 0 && val <= LPFC_MAX_LINK_SPEED) - && (LPFC_LINK_SPEED_BITMAP & (1 << val))) { + if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) && + (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) { phba->cfg_link_speed = val; return 0; } @@ -2947,12 +2940,12 @@ lpfc_link_speed_init(struct lpfc_hba *phba, int val) "0405 lpfc_link_speed attribute cannot " "be set to %d, allowed values are " "["LPFC_LINK_SPEED_STRING"]\n", val); - phba->cfg_link_speed = 0; + phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; return -EINVAL; } static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR, - lpfc_link_speed_show, lpfc_link_speed_store); + lpfc_link_speed_show, lpfc_link_speed_store); /* # lpfc_aer_support: Support PCIe device Advanced Error Reporting (AER) @@ -3798,8 +3791,7 @@ sysfs_mbox_read(struct file *filp, struct kobject *kobj, } break; case MBX_READ_SPARM64: - case MBX_READ_LA: - case MBX_READ_LA64: + case MBX_READ_TOPOLOGY: case MBX_REG_LOGIN: case MBX_REG_LOGIN64: case MBX_CONFIG_PORT: @@ -3989,7 +3981,7 @@ lpfc_get_host_port_type(struct Scsi_Host *shost) if (vport->port_type == LPFC_NPIV_PORT) { fc_host_port_type(shost) = FC_PORTTYPE_NPIV; } else if (lpfc_is_link_up(phba)) { - if (phba->fc_topology == TOPOLOGY_LOOP) { + if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { if (vport->fc_flag & FC_PUBLIC_LOOP) fc_host_port_type(shost) = FC_PORTTYPE_NLPORT; else @@ -4058,23 +4050,26 @@ lpfc_get_host_speed(struct Scsi_Host *shost) if (lpfc_is_link_up(phba)) { switch(phba->fc_linkspeed) { - case LA_1GHZ_LINK: - fc_host_speed(shost) = FC_PORTSPEED_1GBIT; + case LPFC_LINK_SPEED_1GHZ: + fc_host_speed(shost) = FC_PORTSPEED_1GBIT; break; - case LA_2GHZ_LINK: - fc_host_speed(shost) = FC_PORTSPEED_2GBIT; + case LPFC_LINK_SPEED_2GHZ: + fc_host_speed(shost) = FC_PORTSPEED_2GBIT; break; - case LA_4GHZ_LINK: - fc_host_speed(shost) = FC_PORTSPEED_4GBIT; + case LPFC_LINK_SPEED_4GHZ: + fc_host_speed(shost) = FC_PORTSPEED_4GBIT; break; - case LA_8GHZ_LINK: - fc_host_speed(shost) = FC_PORTSPEED_8GBIT; + case LPFC_LINK_SPEED_8GHZ: + fc_host_speed(shost) = FC_PORTSPEED_8GBIT; break; - case LA_10GHZ_LINK: - fc_host_speed(shost) = FC_PORTSPEED_10GBIT; + case LPFC_LINK_SPEED_10GHZ: + fc_host_speed(shost) = FC_PORTSPEED_10GBIT; break; - default: - fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; + case LPFC_LINK_SPEED_16GHZ: + fc_host_speed(shost) = FC_PORTSPEED_16GBIT; + break; + default: + fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; break; } } else @@ -4097,7 +4092,7 @@ lpfc_get_host_fabric_name (struct Scsi_Host *shost) spin_lock_irq(shost->host_lock); if ((vport->fc_flag & FC_FABRIC) || - ((phba->fc_topology == TOPOLOGY_LOOP) && + ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) && (vport->fc_flag & FC_PUBLIC_LOOP))) node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); else @@ -4208,11 +4203,11 @@ lpfc_get_stats(struct Scsi_Host *shost) hs->invalid_crc_count -= lso->invalid_crc_count; hs->error_frames -= lso->error_frames; - if (phba->hba_flag & HBA_FCOE_SUPPORT) { + if (phba->hba_flag & HBA_FCOE_MODE) { hs->lip_count = -1; hs->nos_count = (phba->link_events >> 1); hs->nos_count -= lso->link_events; - } else if (phba->fc_topology == TOPOLOGY_LOOP) { + } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { hs->lip_count = (phba->fc_eventTag >> 1); hs->lip_count -= lso->link_events; hs->nos_count = -1; @@ -4303,7 +4298,7 @@ lpfc_reset_stats(struct Scsi_Host *shost) lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; lso->error_frames = pmb->un.varRdLnk.crcCnt; - if (phba->hba_flag & HBA_FCOE_SUPPORT) + if (phba->hba_flag & HBA_FCOE_MODE) lso->link_events = (phba->link_events >> 1); else lso->link_events = (phba->fc_eventTag >> 1); -- cgit v1.2.1 From 19ca760979e4be41a3eb215fb8d0e96637161947 Mon Sep 17 00:00:00 2001 From: James Smart Date: Sat, 20 Nov 2010 23:11:55 -0500 Subject: [SCSI] lpfc 8.3.19: Added support for ELS RRQ command Added support for ELS RRQ command - Add new routine lpfc_set_rrq_active() to track XRI qualifier state. - Add new module parameter lpfc_enable_rrq to control RRQ operation. - Add logic to ELS RRQ completion handler and xri qualifier timeout to clear XRI qualifier state. - Use OX_ID from XRI_ABORTED_CQE for RRQ payload. - Tie abort and XRI_ABORTED_CQE andler to RRQ generation. Signed-off-by: Alex Iannicelli Signed-off-by: James Smart Signed-off-by: James Bottomley --- drivers/scsi/lpfc/lpfc_attr.c | 9 +++++++++ 1 file changed, 9 insertions(+) (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 45bd72a9f60e..6be942ae8a07 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -1977,6 +1977,13 @@ lpfc_param_show(enable_npiv); lpfc_param_init(enable_npiv, 1, 0, 1); static DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO, lpfc_enable_npiv_show, NULL); +int lpfc_enable_rrq; +module_param(lpfc_enable_rrq, int, 0); +MODULE_PARM_DESC(lpfc_enable_rrq, "Enable RRQ functionality"); +lpfc_param_show(enable_rrq); +lpfc_param_init(enable_rrq, 0, 0, 1); +static DEVICE_ATTR(lpfc_enable_rrq, S_IRUGO, lpfc_enable_rrq_show, NULL); + /* # lpfc_suppress_link_up: Bring link up at initialization # 0x0 = bring link up (issue MBX_INIT_LINK) @@ -3394,6 +3401,7 @@ struct device_attribute *lpfc_hba_attrs[] = { &dev_attr_lpfc_fdmi_on, &dev_attr_lpfc_max_luns, &dev_attr_lpfc_enable_npiv, + &dev_attr_lpfc_enable_rrq, &dev_attr_nport_evt_cnt, &dev_attr_board_mode, &dev_attr_max_vpi, @@ -4610,6 +4618,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) lpfc_link_speed_init(phba, lpfc_link_speed); lpfc_poll_tmo_init(phba, lpfc_poll_tmo); lpfc_enable_npiv_init(phba, lpfc_enable_npiv); + lpfc_enable_rrq_init(phba, lpfc_enable_rrq); lpfc_use_msi_init(phba, lpfc_use_msi); lpfc_fcp_imax_init(phba, lpfc_fcp_imax); lpfc_fcp_wq_count_init(phba, lpfc_fcp_wq_count); -- cgit v1.2.1 From eb7a339e67dceec30f70a5cbed8e2bf6d8318f20 Mon Sep 17 00:00:00 2001 From: James Smart Date: Sat, 20 Nov 2010 23:12:02 -0500 Subject: [SCSI] lpfc 8.3.19: Change heartbeat to default to disabled Signed-off-by: Alex Iannicelli Signed-off-by: James Smart Signed-off-by: James Bottomley --- drivers/scsi/lpfc/lpfc_attr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 6be942ae8a07..c06491b5862f 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -3305,12 +3305,12 @@ LPFC_ATTR_R(fcp_eq_count, LPFC_FP_EQN_DEF, LPFC_FP_EQN_MIN, LPFC_FP_EQN_MAX, LPFC_ATTR_R(enable_hba_reset, 1, 0, 1, "Enable HBA resets from the driver."); /* -# lpfc_enable_hba_heartbeat: Enable HBA heartbeat timer.. +# lpfc_enable_hba_heartbeat: Disable HBA heartbeat timer.. # 0 = HBA Heartbeat disabled # 1 = HBA Heartbeat enabled (default) # Value range is [0,1]. Default value is 1. */ -LPFC_ATTR_R(enable_hba_heartbeat, 1, 0, 1, "Enable HBA Heartbeat."); +LPFC_ATTR_R(enable_hba_heartbeat, 0, 0, 1, "Enable HBA Heartbeat."); /* # lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF) -- cgit v1.2.1