aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_attr.c
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2010-11-20 23:11:48 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-21 13:23:59 -0500
commit76a95d75ede64e4f1684ddb8c626fdfdb641bda2 (patch)
tree53420aed0a91873a382b886bf3b3ca828df48edc /drivers/scsi/lpfc/lpfc_attr.c
parent085c647c3377c3e39c8c572278507b1e1c7e7bf7 (diff)
[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 <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c91
1 files changed, 43 insertions, 48 deletions
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 @@
52#define LPFC_MIN_DEVLOSS_TMO 1 52#define LPFC_MIN_DEVLOSS_TMO 1
53#define LPFC_MAX_DEVLOSS_TMO 255 53#define LPFC_MAX_DEVLOSS_TMO 255
54 54
55#define LPFC_MAX_LINK_SPEED 8
56#define LPFC_LINK_SPEED_BITMAP 0x00000117
57#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8"
58
59/** 55/**
60 * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules 56 * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules
61 * @incr: integer to convert. 57 * @incr: integer to convert.
@@ -463,7 +459,7 @@ lpfc_link_state_show(struct device *dev, struct device_attribute *attr,
463 if (phba->sli.sli_flag & LPFC_MENLO_MAINT) 459 if (phba->sli.sli_flag & LPFC_MENLO_MAINT)
464 len += snprintf(buf + len, PAGE_SIZE-len, 460 len += snprintf(buf + len, PAGE_SIZE-len,
465 " Menlo Maint Mode\n"); 461 " Menlo Maint Mode\n");
466 else if (phba->fc_topology == TOPOLOGY_LOOP) { 462 else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
467 if (vport->fc_flag & FC_PUBLIC_LOOP) 463 if (vport->fc_flag & FC_PUBLIC_LOOP)
468 len += snprintf(buf + len, PAGE_SIZE-len, 464 len += snprintf(buf + len, PAGE_SIZE-len,
469 " Public Loop\n"); 465 " Public Loop\n");
@@ -2837,14 +2833,8 @@ static struct bin_attribute sysfs_drvr_stat_data_attr = {
2837/* 2833/*
2838# lpfc_link_speed: Link speed selection for initializing the Fibre Channel 2834# lpfc_link_speed: Link speed selection for initializing the Fibre Channel
2839# connection. 2835# connection.
2840# 0 = auto select (default) 2836# Value range is [0,16]. Default value is 0.
2841# 1 = 1 Gigabaud
2842# 2 = 2 Gigabaud
2843# 4 = 4 Gigabaud
2844# 8 = 8 Gigabaud
2845# Value range is [0,8]. Default value is 0.
2846*/ 2837*/
2847
2848/** 2838/**
2849 * lpfc_link_speed_set - Set the adapters link speed 2839 * lpfc_link_speed_set - Set the adapters link speed
2850 * @phba: lpfc_hba pointer. 2840 * @phba: lpfc_hba pointer.
@@ -2869,7 +2859,7 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
2869 struct Scsi_Host *shost = class_to_shost(dev); 2859 struct Scsi_Host *shost = class_to_shost(dev);
2870 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 2860 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
2871 struct lpfc_hba *phba = vport->phba; 2861 struct lpfc_hba *phba = vport->phba;
2872 int val = 0; 2862 int val = LPFC_USER_LINK_SPEED_AUTO;
2873 int nolip = 0; 2863 int nolip = 0;
2874 const char *val_buf = buf; 2864 const char *val_buf = buf;
2875 int err; 2865 int err;
@@ -2885,15 +2875,20 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
2885 if (sscanf(val_buf, "%i", &val) != 1) 2875 if (sscanf(val_buf, "%i", &val) != 1)
2886 return -EINVAL; 2876 return -EINVAL;
2887 2877
2888 if (((val == LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || 2878 if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) ||
2889 ((val == LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || 2879 ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) ||
2890 ((val == LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || 2880 ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) ||
2891 ((val == LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || 2881 ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) ||
2892 ((val == LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb))) 2882 ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) ||
2883 ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb))) {
2884 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
2885 "2879 lpfc_link_speed attribute cannot be set "
2886 "to %d. Speed is not supported by this port.\n",
2887 val);
2893 return -EINVAL; 2888 return -EINVAL;
2894 2889 }
2895 if ((val >= 0 && val <= 8) 2890 if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) &&
2896 && (LPFC_LINK_SPEED_BITMAP & (1 << val))) { 2891 (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) {
2897 prev_val = phba->cfg_link_speed; 2892 prev_val = phba->cfg_link_speed;
2898 phba->cfg_link_speed = val; 2893 phba->cfg_link_speed = val;
2899 if (nolip) 2894 if (nolip)
@@ -2906,11 +2901,9 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
2906 } else 2901 } else
2907 return strlen(buf); 2902 return strlen(buf);
2908 } 2903 }
2909
2910 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 2904 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
2911 "%d:0469 lpfc_link_speed attribute cannot be set to %d, " 2905 "0469 lpfc_link_speed attribute cannot be set to %d, "
2912 "allowed range is [0, 8]\n", 2906 "allowed values are ["LPFC_LINK_SPEED_STRING"]\n", val);
2913 phba->brd_no, val);
2914 return -EINVAL; 2907 return -EINVAL;
2915} 2908}
2916 2909
@@ -2938,8 +2931,8 @@ lpfc_param_show(link_speed)
2938static int 2931static int
2939lpfc_link_speed_init(struct lpfc_hba *phba, int val) 2932lpfc_link_speed_init(struct lpfc_hba *phba, int val)
2940{ 2933{
2941 if ((val >= 0 && val <= LPFC_MAX_LINK_SPEED) 2934 if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) &&
2942 && (LPFC_LINK_SPEED_BITMAP & (1 << val))) { 2935 (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) {
2943 phba->cfg_link_speed = val; 2936 phba->cfg_link_speed = val;
2944 return 0; 2937 return 0;
2945 } 2938 }
@@ -2947,12 +2940,12 @@ lpfc_link_speed_init(struct lpfc_hba *phba, int val)
2947 "0405 lpfc_link_speed attribute cannot " 2940 "0405 lpfc_link_speed attribute cannot "
2948 "be set to %d, allowed values are " 2941 "be set to %d, allowed values are "
2949 "["LPFC_LINK_SPEED_STRING"]\n", val); 2942 "["LPFC_LINK_SPEED_STRING"]\n", val);
2950 phba->cfg_link_speed = 0; 2943 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO;
2951 return -EINVAL; 2944 return -EINVAL;
2952} 2945}
2953 2946
2954static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR, 2947static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR,
2955 lpfc_link_speed_show, lpfc_link_speed_store); 2948 lpfc_link_speed_show, lpfc_link_speed_store);
2956 2949
2957/* 2950/*
2958# lpfc_aer_support: Support PCIe device Advanced Error Reporting (AER) 2951# lpfc_aer_support: Support PCIe device Advanced Error Reporting (AER)
@@ -3798,8 +3791,7 @@ sysfs_mbox_read(struct file *filp, struct kobject *kobj,
3798 } 3791 }
3799 break; 3792 break;
3800 case MBX_READ_SPARM64: 3793 case MBX_READ_SPARM64:
3801 case MBX_READ_LA: 3794 case MBX_READ_TOPOLOGY:
3802 case MBX_READ_LA64:
3803 case MBX_REG_LOGIN: 3795 case MBX_REG_LOGIN:
3804 case MBX_REG_LOGIN64: 3796 case MBX_REG_LOGIN64:
3805 case MBX_CONFIG_PORT: 3797 case MBX_CONFIG_PORT:
@@ -3989,7 +3981,7 @@ lpfc_get_host_port_type(struct Scsi_Host *shost)
3989 if (vport->port_type == LPFC_NPIV_PORT) { 3981 if (vport->port_type == LPFC_NPIV_PORT) {
3990 fc_host_port_type(shost) = FC_PORTTYPE_NPIV; 3982 fc_host_port_type(shost) = FC_PORTTYPE_NPIV;
3991 } else if (lpfc_is_link_up(phba)) { 3983 } else if (lpfc_is_link_up(phba)) {
3992 if (phba->fc_topology == TOPOLOGY_LOOP) { 3984 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
3993 if (vport->fc_flag & FC_PUBLIC_LOOP) 3985 if (vport->fc_flag & FC_PUBLIC_LOOP)
3994 fc_host_port_type(shost) = FC_PORTTYPE_NLPORT; 3986 fc_host_port_type(shost) = FC_PORTTYPE_NLPORT;
3995 else 3987 else
@@ -4058,23 +4050,26 @@ lpfc_get_host_speed(struct Scsi_Host *shost)
4058 4050
4059 if (lpfc_is_link_up(phba)) { 4051 if (lpfc_is_link_up(phba)) {
4060 switch(phba->fc_linkspeed) { 4052 switch(phba->fc_linkspeed) {
4061 case LA_1GHZ_LINK: 4053 case LPFC_LINK_SPEED_1GHZ:
4062 fc_host_speed(shost) = FC_PORTSPEED_1GBIT; 4054 fc_host_speed(shost) = FC_PORTSPEED_1GBIT;
4063 break; 4055 break;
4064 case LA_2GHZ_LINK: 4056 case LPFC_LINK_SPEED_2GHZ:
4065 fc_host_speed(shost) = FC_PORTSPEED_2GBIT; 4057 fc_host_speed(shost) = FC_PORTSPEED_2GBIT;
4066 break; 4058 break;
4067 case LA_4GHZ_LINK: 4059 case LPFC_LINK_SPEED_4GHZ:
4068 fc_host_speed(shost) = FC_PORTSPEED_4GBIT; 4060 fc_host_speed(shost) = FC_PORTSPEED_4GBIT;
4069 break; 4061 break;
4070 case LA_8GHZ_LINK: 4062 case LPFC_LINK_SPEED_8GHZ:
4071 fc_host_speed(shost) = FC_PORTSPEED_8GBIT; 4063 fc_host_speed(shost) = FC_PORTSPEED_8GBIT;
4072 break; 4064 break;
4073 case LA_10GHZ_LINK: 4065 case LPFC_LINK_SPEED_10GHZ:
4074 fc_host_speed(shost) = FC_PORTSPEED_10GBIT; 4066 fc_host_speed(shost) = FC_PORTSPEED_10GBIT;
4075 break; 4067 break;
4076 default: 4068 case LPFC_LINK_SPEED_16GHZ:
4077 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; 4069 fc_host_speed(shost) = FC_PORTSPEED_16GBIT;
4070 break;
4071 default:
4072 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN;
4078 break; 4073 break;
4079 } 4074 }
4080 } else 4075 } else
@@ -4097,7 +4092,7 @@ lpfc_get_host_fabric_name (struct Scsi_Host *shost)
4097 spin_lock_irq(shost->host_lock); 4092 spin_lock_irq(shost->host_lock);
4098 4093
4099 if ((vport->fc_flag & FC_FABRIC) || 4094 if ((vport->fc_flag & FC_FABRIC) ||
4100 ((phba->fc_topology == TOPOLOGY_LOOP) && 4095 ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) &&
4101 (vport->fc_flag & FC_PUBLIC_LOOP))) 4096 (vport->fc_flag & FC_PUBLIC_LOOP)))
4102 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); 4097 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn);
4103 else 4098 else
@@ -4208,11 +4203,11 @@ lpfc_get_stats(struct Scsi_Host *shost)
4208 hs->invalid_crc_count -= lso->invalid_crc_count; 4203 hs->invalid_crc_count -= lso->invalid_crc_count;
4209 hs->error_frames -= lso->error_frames; 4204 hs->error_frames -= lso->error_frames;
4210 4205
4211 if (phba->hba_flag & HBA_FCOE_SUPPORT) { 4206 if (phba->hba_flag & HBA_FCOE_MODE) {
4212 hs->lip_count = -1; 4207 hs->lip_count = -1;
4213 hs->nos_count = (phba->link_events >> 1); 4208 hs->nos_count = (phba->link_events >> 1);
4214 hs->nos_count -= lso->link_events; 4209 hs->nos_count -= lso->link_events;
4215 } else if (phba->fc_topology == TOPOLOGY_LOOP) { 4210 } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
4216 hs->lip_count = (phba->fc_eventTag >> 1); 4211 hs->lip_count = (phba->fc_eventTag >> 1);
4217 hs->lip_count -= lso->link_events; 4212 hs->lip_count -= lso->link_events;
4218 hs->nos_count = -1; 4213 hs->nos_count = -1;
@@ -4303,7 +4298,7 @@ lpfc_reset_stats(struct Scsi_Host *shost)
4303 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; 4298 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord;
4304 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; 4299 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt;
4305 lso->error_frames = pmb->un.varRdLnk.crcCnt; 4300 lso->error_frames = pmb->un.varRdLnk.crcCnt;
4306 if (phba->hba_flag & HBA_FCOE_SUPPORT) 4301 if (phba->hba_flag & HBA_FCOE_MODE)
4307 lso->link_events = (phba->link_events >> 1); 4302 lso->link_events = (phba->link_events >> 1);
4308 else 4303 else
4309 lso->link_events = (phba->fc_eventTag >> 1); 4304 lso->link_events = (phba->fc_eventTag >> 1);