aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c104
1 files changed, 54 insertions, 50 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index c1cbec01345..c06491b5862 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");
@@ -1981,6 +1977,13 @@ lpfc_param_show(enable_npiv);
1981lpfc_param_init(enable_npiv, 1, 0, 1); 1977lpfc_param_init(enable_npiv, 1, 0, 1);
1982static DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO, lpfc_enable_npiv_show, NULL); 1978static DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO, lpfc_enable_npiv_show, NULL);
1983 1979
1980int lpfc_enable_rrq;
1981module_param(lpfc_enable_rrq, int, 0);
1982MODULE_PARM_DESC(lpfc_enable_rrq, "Enable RRQ functionality");
1983lpfc_param_show(enable_rrq);
1984lpfc_param_init(enable_rrq, 0, 0, 1);
1985static DEVICE_ATTR(lpfc_enable_rrq, S_IRUGO, lpfc_enable_rrq_show, NULL);
1986
1984/* 1987/*
1985# lpfc_suppress_link_up: Bring link up at initialization 1988# lpfc_suppress_link_up: Bring link up at initialization
1986# 0x0 = bring link up (issue MBX_INIT_LINK) 1989# 0x0 = bring link up (issue MBX_INIT_LINK)
@@ -2837,14 +2840,8 @@ static struct bin_attribute sysfs_drvr_stat_data_attr = {
2837/* 2840/*
2838# lpfc_link_speed: Link speed selection for initializing the Fibre Channel 2841# lpfc_link_speed: Link speed selection for initializing the Fibre Channel
2839# connection. 2842# connection.
2840# 0 = auto select (default) 2843# 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*/ 2844*/
2847
2848/** 2845/**
2849 * lpfc_link_speed_set - Set the adapters link speed 2846 * lpfc_link_speed_set - Set the adapters link speed
2850 * @phba: lpfc_hba pointer. 2847 * @phba: lpfc_hba pointer.
@@ -2869,7 +2866,7 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
2869 struct Scsi_Host *shost = class_to_shost(dev); 2866 struct Scsi_Host *shost = class_to_shost(dev);
2870 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 2867 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
2871 struct lpfc_hba *phba = vport->phba; 2868 struct lpfc_hba *phba = vport->phba;
2872 int val = 0; 2869 int val = LPFC_USER_LINK_SPEED_AUTO;
2873 int nolip = 0; 2870 int nolip = 0;
2874 const char *val_buf = buf; 2871 const char *val_buf = buf;
2875 int err; 2872 int err;
@@ -2885,15 +2882,20 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
2885 if (sscanf(val_buf, "%i", &val) != 1) 2882 if (sscanf(val_buf, "%i", &val) != 1)
2886 return -EINVAL; 2883 return -EINVAL;
2887 2884
2888 if (((val == LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || 2885 if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) ||
2889 ((val == LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || 2886 ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) ||
2890 ((val == LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || 2887 ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) ||
2891 ((val == LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || 2888 ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) ||
2892 ((val == LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb))) 2889 ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) ||
2890 ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb))) {
2891 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
2892 "2879 lpfc_link_speed attribute cannot be set "
2893 "to %d. Speed is not supported by this port.\n",
2894 val);
2893 return -EINVAL; 2895 return -EINVAL;
2894 2896 }
2895 if ((val >= 0 && val <= 8) 2897 if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) &&
2896 && (LPFC_LINK_SPEED_BITMAP & (1 << val))) { 2898 (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) {
2897 prev_val = phba->cfg_link_speed; 2899 prev_val = phba->cfg_link_speed;
2898 phba->cfg_link_speed = val; 2900 phba->cfg_link_speed = val;
2899 if (nolip) 2901 if (nolip)
@@ -2906,11 +2908,9 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
2906 } else 2908 } else
2907 return strlen(buf); 2909 return strlen(buf);
2908 } 2910 }
2909
2910 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 2911 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
2911 "%d:0469 lpfc_link_speed attribute cannot be set to %d, " 2912 "0469 lpfc_link_speed attribute cannot be set to %d, "
2912 "allowed range is [0, 8]\n", 2913 "allowed values are ["LPFC_LINK_SPEED_STRING"]\n", val);
2913 phba->brd_no, val);
2914 return -EINVAL; 2914 return -EINVAL;
2915} 2915}
2916 2916
@@ -2938,8 +2938,8 @@ lpfc_param_show(link_speed)
2938static int 2938static int
2939lpfc_link_speed_init(struct lpfc_hba *phba, int val) 2939lpfc_link_speed_init(struct lpfc_hba *phba, int val)
2940{ 2940{
2941 if ((val >= 0 && val <= LPFC_MAX_LINK_SPEED) 2941 if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) &&
2942 && (LPFC_LINK_SPEED_BITMAP & (1 << val))) { 2942 (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) {
2943 phba->cfg_link_speed = val; 2943 phba->cfg_link_speed = val;
2944 return 0; 2944 return 0;
2945 } 2945 }
@@ -2947,12 +2947,12 @@ lpfc_link_speed_init(struct lpfc_hba *phba, int val)
2947 "0405 lpfc_link_speed attribute cannot " 2947 "0405 lpfc_link_speed attribute cannot "
2948 "be set to %d, allowed values are " 2948 "be set to %d, allowed values are "
2949 "["LPFC_LINK_SPEED_STRING"]\n", val); 2949 "["LPFC_LINK_SPEED_STRING"]\n", val);
2950 phba->cfg_link_speed = 0; 2950 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO;
2951 return -EINVAL; 2951 return -EINVAL;
2952} 2952}
2953 2953
2954static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR, 2954static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR,
2955 lpfc_link_speed_show, lpfc_link_speed_store); 2955 lpfc_link_speed_show, lpfc_link_speed_store);
2956 2956
2957/* 2957/*
2958# lpfc_aer_support: Support PCIe device Advanced Error Reporting (AER) 2958# lpfc_aer_support: Support PCIe device Advanced Error Reporting (AER)
@@ -3305,12 +3305,12 @@ LPFC_ATTR_R(fcp_eq_count, LPFC_FP_EQN_DEF, LPFC_FP_EQN_MIN, LPFC_FP_EQN_MAX,
3305LPFC_ATTR_R(enable_hba_reset, 1, 0, 1, "Enable HBA resets from the driver."); 3305LPFC_ATTR_R(enable_hba_reset, 1, 0, 1, "Enable HBA resets from the driver.");
3306 3306
3307/* 3307/*
3308# lpfc_enable_hba_heartbeat: Enable HBA heartbeat timer.. 3308# lpfc_enable_hba_heartbeat: Disable HBA heartbeat timer..
3309# 0 = HBA Heartbeat disabled 3309# 0 = HBA Heartbeat disabled
3310# 1 = HBA Heartbeat enabled (default) 3310# 1 = HBA Heartbeat enabled (default)
3311# Value range is [0,1]. Default value is 1. 3311# Value range is [0,1]. Default value is 1.
3312*/ 3312*/
3313LPFC_ATTR_R(enable_hba_heartbeat, 1, 0, 1, "Enable HBA Heartbeat."); 3313LPFC_ATTR_R(enable_hba_heartbeat, 0, 0, 1, "Enable HBA Heartbeat.");
3314 3314
3315/* 3315/*
3316# lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF) 3316# lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF)
@@ -3401,6 +3401,7 @@ struct device_attribute *lpfc_hba_attrs[] = {
3401 &dev_attr_lpfc_fdmi_on, 3401 &dev_attr_lpfc_fdmi_on,
3402 &dev_attr_lpfc_max_luns, 3402 &dev_attr_lpfc_max_luns,
3403 &dev_attr_lpfc_enable_npiv, 3403 &dev_attr_lpfc_enable_npiv,
3404 &dev_attr_lpfc_enable_rrq,
3404 &dev_attr_nport_evt_cnt, 3405 &dev_attr_nport_evt_cnt,
3405 &dev_attr_board_mode, 3406 &dev_attr_board_mode,
3406 &dev_attr_max_vpi, 3407 &dev_attr_max_vpi,
@@ -3798,8 +3799,7 @@ sysfs_mbox_read(struct file *filp, struct kobject *kobj,
3798 } 3799 }
3799 break; 3800 break;
3800 case MBX_READ_SPARM64: 3801 case MBX_READ_SPARM64:
3801 case MBX_READ_LA: 3802 case MBX_READ_TOPOLOGY:
3802 case MBX_READ_LA64:
3803 case MBX_REG_LOGIN: 3803 case MBX_REG_LOGIN:
3804 case MBX_REG_LOGIN64: 3804 case MBX_REG_LOGIN64:
3805 case MBX_CONFIG_PORT: 3805 case MBX_CONFIG_PORT:
@@ -3989,7 +3989,7 @@ lpfc_get_host_port_type(struct Scsi_Host *shost)
3989 if (vport->port_type == LPFC_NPIV_PORT) { 3989 if (vport->port_type == LPFC_NPIV_PORT) {
3990 fc_host_port_type(shost) = FC_PORTTYPE_NPIV; 3990 fc_host_port_type(shost) = FC_PORTTYPE_NPIV;
3991 } else if (lpfc_is_link_up(phba)) { 3991 } else if (lpfc_is_link_up(phba)) {
3992 if (phba->fc_topology == TOPOLOGY_LOOP) { 3992 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
3993 if (vport->fc_flag & FC_PUBLIC_LOOP) 3993 if (vport->fc_flag & FC_PUBLIC_LOOP)
3994 fc_host_port_type(shost) = FC_PORTTYPE_NLPORT; 3994 fc_host_port_type(shost) = FC_PORTTYPE_NLPORT;
3995 else 3995 else
@@ -4058,23 +4058,26 @@ lpfc_get_host_speed(struct Scsi_Host *shost)
4058 4058
4059 if (lpfc_is_link_up(phba)) { 4059 if (lpfc_is_link_up(phba)) {
4060 switch(phba->fc_linkspeed) { 4060 switch(phba->fc_linkspeed) {
4061 case LA_1GHZ_LINK: 4061 case LPFC_LINK_SPEED_1GHZ:
4062 fc_host_speed(shost) = FC_PORTSPEED_1GBIT; 4062 fc_host_speed(shost) = FC_PORTSPEED_1GBIT;
4063 break; 4063 break;
4064 case LA_2GHZ_LINK: 4064 case LPFC_LINK_SPEED_2GHZ:
4065 fc_host_speed(shost) = FC_PORTSPEED_2GBIT; 4065 fc_host_speed(shost) = FC_PORTSPEED_2GBIT;
4066 break; 4066 break;
4067 case LA_4GHZ_LINK: 4067 case LPFC_LINK_SPEED_4GHZ:
4068 fc_host_speed(shost) = FC_PORTSPEED_4GBIT; 4068 fc_host_speed(shost) = FC_PORTSPEED_4GBIT;
4069 break; 4069 break;
4070 case LA_8GHZ_LINK: 4070 case LPFC_LINK_SPEED_8GHZ:
4071 fc_host_speed(shost) = FC_PORTSPEED_8GBIT; 4071 fc_host_speed(shost) = FC_PORTSPEED_8GBIT;
4072 break; 4072 break;
4073 case LA_10GHZ_LINK: 4073 case LPFC_LINK_SPEED_10GHZ:
4074 fc_host_speed(shost) = FC_PORTSPEED_10GBIT; 4074 fc_host_speed(shost) = FC_PORTSPEED_10GBIT;
4075 break; 4075 break;
4076 default: 4076 case LPFC_LINK_SPEED_16GHZ:
4077 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; 4077 fc_host_speed(shost) = FC_PORTSPEED_16GBIT;
4078 break;
4079 default:
4080 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN;
4078 break; 4081 break;
4079 } 4082 }
4080 } else 4083 } else
@@ -4097,7 +4100,7 @@ lpfc_get_host_fabric_name (struct Scsi_Host *shost)
4097 spin_lock_irq(shost->host_lock); 4100 spin_lock_irq(shost->host_lock);
4098 4101
4099 if ((vport->fc_flag & FC_FABRIC) || 4102 if ((vport->fc_flag & FC_FABRIC) ||
4100 ((phba->fc_topology == TOPOLOGY_LOOP) && 4103 ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) &&
4101 (vport->fc_flag & FC_PUBLIC_LOOP))) 4104 (vport->fc_flag & FC_PUBLIC_LOOP)))
4102 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); 4105 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn);
4103 else 4106 else
@@ -4208,11 +4211,11 @@ lpfc_get_stats(struct Scsi_Host *shost)
4208 hs->invalid_crc_count -= lso->invalid_crc_count; 4211 hs->invalid_crc_count -= lso->invalid_crc_count;
4209 hs->error_frames -= lso->error_frames; 4212 hs->error_frames -= lso->error_frames;
4210 4213
4211 if (phba->hba_flag & HBA_FCOE_SUPPORT) { 4214 if (phba->hba_flag & HBA_FCOE_MODE) {
4212 hs->lip_count = -1; 4215 hs->lip_count = -1;
4213 hs->nos_count = (phba->link_events >> 1); 4216 hs->nos_count = (phba->link_events >> 1);
4214 hs->nos_count -= lso->link_events; 4217 hs->nos_count -= lso->link_events;
4215 } else if (phba->fc_topology == TOPOLOGY_LOOP) { 4218 } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
4216 hs->lip_count = (phba->fc_eventTag >> 1); 4219 hs->lip_count = (phba->fc_eventTag >> 1);
4217 hs->lip_count -= lso->link_events; 4220 hs->lip_count -= lso->link_events;
4218 hs->nos_count = -1; 4221 hs->nos_count = -1;
@@ -4303,7 +4306,7 @@ lpfc_reset_stats(struct Scsi_Host *shost)
4303 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; 4306 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord;
4304 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; 4307 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt;
4305 lso->error_frames = pmb->un.varRdLnk.crcCnt; 4308 lso->error_frames = pmb->un.varRdLnk.crcCnt;
4306 if (phba->hba_flag & HBA_FCOE_SUPPORT) 4309 if (phba->hba_flag & HBA_FCOE_MODE)
4307 lso->link_events = (phba->link_events >> 1); 4310 lso->link_events = (phba->link_events >> 1);
4308 else 4311 else
4309 lso->link_events = (phba->fc_eventTag >> 1); 4312 lso->link_events = (phba->fc_eventTag >> 1);
@@ -4615,6 +4618,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
4615 lpfc_link_speed_init(phba, lpfc_link_speed); 4618 lpfc_link_speed_init(phba, lpfc_link_speed);
4616 lpfc_poll_tmo_init(phba, lpfc_poll_tmo); 4619 lpfc_poll_tmo_init(phba, lpfc_poll_tmo);
4617 lpfc_enable_npiv_init(phba, lpfc_enable_npiv); 4620 lpfc_enable_npiv_init(phba, lpfc_enable_npiv);
4621 lpfc_enable_rrq_init(phba, lpfc_enable_rrq);
4618 lpfc_use_msi_init(phba, lpfc_use_msi); 4622 lpfc_use_msi_init(phba, lpfc_use_msi);
4619 lpfc_fcp_imax_init(phba, lpfc_fcp_imax); 4623 lpfc_fcp_imax_init(phba, lpfc_fcp_imax);
4620 lpfc_fcp_wq_count_init(phba, lpfc_fcp_wq_count); 4624 lpfc_fcp_wq_count_init(phba, lpfc_fcp_wq_count);