Commit fbd8a6ba authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: Add 64G link speed support

The G7 adapter supports 64G link speeds. Add support to the driver.

In addition, a small cleanup to replace the odd bitmap logic with
a switch case.
Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent c238b9b6
...@@ -544,16 +544,10 @@ struct unsol_rcv_ct_ctx { ...@@ -544,16 +544,10 @@ struct unsol_rcv_ct_ctx {
#define LPFC_USER_LINK_SPEED_10G 10 /* 10 Gigabaud */ #define LPFC_USER_LINK_SPEED_10G 10 /* 10 Gigabaud */
#define LPFC_USER_LINK_SPEED_16G 16 /* 16 Gigabaud */ #define LPFC_USER_LINK_SPEED_16G 16 /* 16 Gigabaud */
#define LPFC_USER_LINK_SPEED_32G 32 /* 32 Gigabaud */ #define LPFC_USER_LINK_SPEED_32G 32 /* 32 Gigabaud */
#define LPFC_USER_LINK_SPEED_MAX LPFC_USER_LINK_SPEED_32G #define LPFC_USER_LINK_SPEED_64G 64 /* 64 Gigabaud */
#define LPFC_USER_LINK_SPEED_BITMAP ((1ULL << LPFC_USER_LINK_SPEED_32G) | \ #define LPFC_USER_LINK_SPEED_MAX LPFC_USER_LINK_SPEED_64G
(1 << LPFC_USER_LINK_SPEED_16G) | \
(1 << LPFC_USER_LINK_SPEED_10G) | \ #define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8, 10, 16, 32, 64"
(1 << LPFC_USER_LINK_SPEED_8G) | \
(1 << LPFC_USER_LINK_SPEED_4G) | \
(1 << LPFC_USER_LINK_SPEED_2G) | \
(1 << LPFC_USER_LINK_SPEED_1G) | \
(1 << LPFC_USER_LINK_SPEED_AUTO))
#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8, 10, 16, 32"
enum nemb_type { enum nemb_type {
nemb_mse = 1, nemb_mse = 1,
......
...@@ -4115,23 +4115,32 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, ...@@ -4115,23 +4115,32 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || ((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_10G) && !(phba->lmt & LMT_10Gb)) ||
((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb)) || ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb)) ||
((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb))) { ((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb)) ||
((val == LPFC_USER_LINK_SPEED_64G) && !(phba->lmt & LMT_64Gb))) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT, lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"2879 lpfc_link_speed attribute cannot be set " "2879 lpfc_link_speed attribute cannot be set "
"to %d. Speed is not supported by this port.\n", "to %d. Speed is not supported by this port.\n",
val); val);
return -EINVAL; return -EINVAL;
} }
if (val == LPFC_USER_LINK_SPEED_16G && if (val >= LPFC_USER_LINK_SPEED_16G &&
phba->fc_topology == LPFC_TOPOLOGY_LOOP) { phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT, lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"3112 lpfc_link_speed attribute cannot be set " "3112 lpfc_link_speed attribute cannot be set "
"to %d. Speed is not supported in loop mode.\n", "to %d. Speed is not supported in loop mode.\n",
val); val);
return -EINVAL; return -EINVAL;
} }
if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) &&
(LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) { switch (val) {
case LPFC_USER_LINK_SPEED_AUTO:
case LPFC_USER_LINK_SPEED_1G:
case LPFC_USER_LINK_SPEED_2G:
case LPFC_USER_LINK_SPEED_4G:
case LPFC_USER_LINK_SPEED_8G:
case LPFC_USER_LINK_SPEED_16G:
case LPFC_USER_LINK_SPEED_32G:
case LPFC_USER_LINK_SPEED_64G:
prev_val = phba->cfg_link_speed; prev_val = phba->cfg_link_speed;
phba->cfg_link_speed = val; phba->cfg_link_speed = val;
if (nolip) if (nolip)
...@@ -4141,13 +4150,18 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, ...@@ -4141,13 +4150,18 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
if (err) { if (err) {
phba->cfg_link_speed = prev_val; phba->cfg_link_speed = prev_val;
return -EINVAL; return -EINVAL;
} else }
return strlen(buf); return strlen(buf);
default:
break;
} }
lpfc_printf_log(phba, KERN_ERR, LOG_INIT, lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"0469 lpfc_link_speed attribute cannot be set to %d, " "0469 lpfc_link_speed attribute cannot be set to %d, "
"allowed values are ["LPFC_LINK_SPEED_STRING"]\n", val); "allowed values are [%s]\n",
val, LPFC_LINK_SPEED_STRING);
return -EINVAL; return -EINVAL;
} }
static int lpfc_link_speed = 0; static int lpfc_link_speed = 0;
...@@ -4174,24 +4188,33 @@ lpfc_param_show(link_speed) ...@@ -4174,24 +4188,33 @@ lpfc_param_show(link_speed)
static int static int
lpfc_link_speed_init(struct lpfc_hba *phba, int val) lpfc_link_speed_init(struct lpfc_hba *phba, int val)
{ {
if (val == LPFC_USER_LINK_SPEED_16G && phba->cfg_topology == 4) { if (val >= LPFC_USER_LINK_SPEED_16G && phba->cfg_topology == 4) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT, lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"3111 lpfc_link_speed of %d cannot " "3111 lpfc_link_speed of %d cannot "
"support loop mode, setting topology to default.\n", "support loop mode, setting topology to default.\n",
val); val);
phba->cfg_topology = 0; phba->cfg_topology = 0;
} }
if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) &&
(LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) { switch (val) {
case LPFC_USER_LINK_SPEED_AUTO:
case LPFC_USER_LINK_SPEED_1G:
case LPFC_USER_LINK_SPEED_2G:
case LPFC_USER_LINK_SPEED_4G:
case LPFC_USER_LINK_SPEED_8G:
case LPFC_USER_LINK_SPEED_16G:
case LPFC_USER_LINK_SPEED_32G:
case LPFC_USER_LINK_SPEED_64G:
phba->cfg_link_speed = val; phba->cfg_link_speed = val;
return 0; return 0;
default:
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"0405 lpfc_link_speed attribute cannot "
"be set to %d, allowed values are "
"["LPFC_LINK_SPEED_STRING"]\n", val);
phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO;
return -EINVAL;
} }
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"0405 lpfc_link_speed attribute cannot "
"be set to %d, allowed values are "
"["LPFC_LINK_SPEED_STRING"]\n", val);
phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO;
return -EINVAL;
} }
static DEVICE_ATTR_RW(lpfc_link_speed); static DEVICE_ATTR_RW(lpfc_link_speed);
...@@ -5716,6 +5739,9 @@ lpfc_get_host_speed(struct Scsi_Host *shost) ...@@ -5716,6 +5739,9 @@ lpfc_get_host_speed(struct Scsi_Host *shost)
case LPFC_LINK_SPEED_32GHZ: case LPFC_LINK_SPEED_32GHZ:
fc_host_speed(shost) = FC_PORTSPEED_32GBIT; fc_host_speed(shost) = FC_PORTSPEED_32GBIT;
break; break;
case LPFC_LINK_SPEED_64GHZ:
fc_host_speed(shost) = FC_PORTSPEED_64GBIT;
break;
default: default:
fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN;
break; break;
......
...@@ -2130,6 +2130,8 @@ lpfc_fdmi_port_attr_support_speed(struct lpfc_vport *vport, ...@@ -2130,6 +2130,8 @@ lpfc_fdmi_port_attr_support_speed(struct lpfc_vport *vport,
ae->un.AttrInt = 0; ae->un.AttrInt = 0;
if (!(phba->hba_flag & HBA_FCOE_MODE)) { if (!(phba->hba_flag & HBA_FCOE_MODE)) {
if (phba->lmt & LMT_64Gb)
ae->un.AttrInt |= HBA_PORTSPEED_64GFC;
if (phba->lmt & LMT_32Gb) if (phba->lmt & LMT_32Gb)
ae->un.AttrInt |= HBA_PORTSPEED_32GFC; ae->un.AttrInt |= HBA_PORTSPEED_32GFC;
if (phba->lmt & LMT_16Gb) if (phba->lmt & LMT_16Gb)
...@@ -2201,6 +2203,9 @@ lpfc_fdmi_port_attr_speed(struct lpfc_vport *vport, ...@@ -2201,6 +2203,9 @@ lpfc_fdmi_port_attr_speed(struct lpfc_vport *vport,
case LPFC_LINK_SPEED_32GHZ: case LPFC_LINK_SPEED_32GHZ:
ae->un.AttrInt = HBA_PORTSPEED_32GFC; ae->un.AttrInt = HBA_PORTSPEED_32GFC;
break; break;
case LPFC_LINK_SPEED_64GHZ:
ae->un.AttrInt = HBA_PORTSPEED_64GFC;
break;
default: default:
ae->un.AttrInt = HBA_PORTSPEED_UNKNOWN; ae->un.AttrInt = HBA_PORTSPEED_UNKNOWN;
break; break;
......
...@@ -5270,6 +5270,9 @@ lpfc_rdp_res_speed(struct fc_rdp_port_speed_desc *desc, struct lpfc_hba *phba) ...@@ -5270,6 +5270,9 @@ lpfc_rdp_res_speed(struct fc_rdp_port_speed_desc *desc, struct lpfc_hba *phba)
case LPFC_LINK_SPEED_32GHZ: case LPFC_LINK_SPEED_32GHZ:
rdp_speed = RDP_PS_32GB; rdp_speed = RDP_PS_32GB;
break; break;
case LPFC_LINK_SPEED_64GHZ:
rdp_speed = RDP_PS_64GB;
break;
default: default:
rdp_speed = RDP_PS_UNKNOWN; rdp_speed = RDP_PS_UNKNOWN;
break; break;
...@@ -5277,6 +5280,8 @@ lpfc_rdp_res_speed(struct fc_rdp_port_speed_desc *desc, struct lpfc_hba *phba) ...@@ -5277,6 +5280,8 @@ lpfc_rdp_res_speed(struct fc_rdp_port_speed_desc *desc, struct lpfc_hba *phba)
desc->info.port_speed.speed = cpu_to_be16(rdp_speed); desc->info.port_speed.speed = cpu_to_be16(rdp_speed);
if (phba->lmt & LMT_64Gb)
rdp_cap |= RDP_PS_64GB;
if (phba->lmt & LMT_32Gb) if (phba->lmt & LMT_32Gb)
rdp_cap |= RDP_PS_32GB; rdp_cap |= RDP_PS_32GB;
if (phba->lmt & LMT_16Gb) if (phba->lmt & LMT_16Gb)
......
...@@ -3084,6 +3084,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la) ...@@ -3084,6 +3084,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la)
case LPFC_LINK_SPEED_10GHZ: case LPFC_LINK_SPEED_10GHZ:
case LPFC_LINK_SPEED_16GHZ: case LPFC_LINK_SPEED_16GHZ:
case LPFC_LINK_SPEED_32GHZ: case LPFC_LINK_SPEED_32GHZ:
case LPFC_LINK_SPEED_64GHZ:
break; break;
default: default:
phba->fc_linkspeed = LPFC_LINK_SPEED_UNKNOWN; phba->fc_linkspeed = LPFC_LINK_SPEED_UNKNOWN;
......
...@@ -1177,6 +1177,9 @@ struct fc_rdp_link_error_status_desc { ...@@ -1177,6 +1177,9 @@ struct fc_rdp_link_error_status_desc {
#define RDP_PS_8GB 0x0800 #define RDP_PS_8GB 0x0800
#define RDP_PS_16GB 0x0400 #define RDP_PS_16GB 0x0400
#define RDP_PS_32GB 0x0200 #define RDP_PS_32GB 0x0200
#define RDP_PS_64GB 0x0100
#define RDP_PS_128GB 0x0080
#define RDP_PS_256GB 0x0040
#define RDP_CAP_USER_CONFIGURED 0x0002 #define RDP_CAP_USER_CONFIGURED 0x0002
#define RDP_CAP_UNKNOWN 0x0001 #define RDP_CAP_UNKNOWN 0x0001
...@@ -2258,6 +2261,9 @@ typedef struct { ...@@ -2258,6 +2261,9 @@ typedef struct {
#define LINK_SPEED_10G 0x10 /* 10 Gigabaud */ #define LINK_SPEED_10G 0x10 /* 10 Gigabaud */
#define LINK_SPEED_16G 0x11 /* 16 Gigabaud */ #define LINK_SPEED_16G 0x11 /* 16 Gigabaud */
#define LINK_SPEED_32G 0x14 /* 32 Gigabaud */ #define LINK_SPEED_32G 0x14 /* 32 Gigabaud */
#define LINK_SPEED_64G 0x17 /* 64 Gigabaud */
#define LINK_SPEED_128G 0x1A /* 128 Gigabaud */
#define LINK_SPEED_256G 0x1D /* 256 Gigabaud */
} INIT_LINK_VAR; } INIT_LINK_VAR;
...@@ -2442,6 +2448,9 @@ typedef struct { ...@@ -2442,6 +2448,9 @@ typedef struct {
#define LMT_10Gb 0x100 #define LMT_10Gb 0x100
#define LMT_16Gb 0x200 #define LMT_16Gb 0x200
#define LMT_32Gb 0x400 #define LMT_32Gb 0x400
#define LMT_64Gb 0x800
#define LMT_128Gb 0x1000
#define LMT_256Gb 0x2000
uint32_t rsvd2; uint32_t rsvd2;
uint32_t rsvd3; uint32_t rsvd3;
uint32_t max_xri; uint32_t max_xri;
...@@ -2966,6 +2975,9 @@ struct lpfc_mbx_read_top { ...@@ -2966,6 +2975,9 @@ struct lpfc_mbx_read_top {
#define LPFC_LINK_SPEED_10GHZ 0x40 #define LPFC_LINK_SPEED_10GHZ 0x40
#define LPFC_LINK_SPEED_16GHZ 0x80 #define LPFC_LINK_SPEED_16GHZ 0x80
#define LPFC_LINK_SPEED_32GHZ 0x90 #define LPFC_LINK_SPEED_32GHZ 0x90
#define LPFC_LINK_SPEED_64GHZ 0xA0
#define LPFC_LINK_SPEED_128GHZ 0xB0
#define LPFC_LINK_SPEED_256GHZ 0xC0
}; };
/* Structure for MB Command CLEAR_LA (22) */ /* Structure for MB Command CLEAR_LA (22) */
......
...@@ -3961,6 +3961,9 @@ struct lpfc_acqe_fc_la { ...@@ -3961,6 +3961,9 @@ struct lpfc_acqe_fc_la {
#define LPFC_FC_LA_SPEED_10G 0xA #define LPFC_FC_LA_SPEED_10G 0xA
#define LPFC_FC_LA_SPEED_16G 0x10 #define LPFC_FC_LA_SPEED_16G 0x10
#define LPFC_FC_LA_SPEED_32G 0x20 #define LPFC_FC_LA_SPEED_32G 0x20
#define LPFC_FC_LA_SPEED_64G 0x21
#define LPFC_FC_LA_SPEED_128G 0x22
#define LPFC_FC_LA_SPEED_256G 0x23
#define lpfc_acqe_fc_la_topology_SHIFT 16 #define lpfc_acqe_fc_la_topology_SHIFT 16
#define lpfc_acqe_fc_la_topology_MASK 0x000000FF #define lpfc_acqe_fc_la_topology_MASK 0x000000FF
#define lpfc_acqe_fc_la_topology_WORD word0 #define lpfc_acqe_fc_la_topology_WORD word0
......
...@@ -731,7 +731,9 @@ lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology, ...@@ -731,7 +731,9 @@ lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology,
((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) && ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) &&
!(phba->lmt & LMT_16Gb)) || !(phba->lmt & LMT_16Gb)) ||
((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_32G) && ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_32G) &&
!(phba->lmt & LMT_32Gb))) { !(phba->lmt & LMT_32Gb)) ||
((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_64G) &&
!(phba->lmt & LMT_64Gb))) {
/* Reset link speed to auto */ /* Reset link speed to auto */
lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
"1302 Invalid speed for this board:%d " "1302 Invalid speed for this board:%d "
...@@ -2274,7 +2276,9 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) ...@@ -2274,7 +2276,9 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
&& descp && descp[0] != '\0') && descp && descp[0] != '\0')
return; return;
if (phba->lmt & LMT_32Gb) if (phba->lmt & LMT_64Gb)
max_speed = 64;
else if (phba->lmt & LMT_32Gb)
max_speed = 32; max_speed = 32;
else if (phba->lmt & LMT_16Gb) else if (phba->lmt & LMT_16Gb)
max_speed = 16; max_speed = 16;
...@@ -4112,6 +4116,8 @@ void lpfc_host_attrib_init(struct Scsi_Host *shost) ...@@ -4112,6 +4116,8 @@ void lpfc_host_attrib_init(struct Scsi_Host *shost)
sizeof fc_host_symbolic_name(shost)); sizeof fc_host_symbolic_name(shost));
fc_host_supported_speeds(shost) = 0; fc_host_supported_speeds(shost) = 0;
if (phba->lmt & LMT_64Gb)
fc_host_supported_speeds(shost) |= FC_PORTSPEED_64GBIT;
if (phba->lmt & LMT_32Gb) if (phba->lmt & LMT_32Gb)
fc_host_supported_speeds(shost) |= FC_PORTSPEED_32GBIT; fc_host_supported_speeds(shost) |= FC_PORTSPEED_32GBIT;
if (phba->lmt & LMT_16Gb) if (phba->lmt & LMT_16Gb)
...@@ -4448,6 +4454,9 @@ lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, ...@@ -4448,6 +4454,9 @@ lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code,
case LPFC_FC_LA_SPEED_32G: case LPFC_FC_LA_SPEED_32G:
port_speed = 32000; port_speed = 32000;
break; break;
case LPFC_FC_LA_SPEED_64G:
port_speed = 64000;
break;
default: default:
port_speed = 0; port_speed = 0;
} }
...@@ -7814,6 +7823,10 @@ lpfc_sli4_read_config(struct lpfc_hba *phba) ...@@ -7814,6 +7823,10 @@ lpfc_sli4_read_config(struct lpfc_hba *phba)
phba->cfg_link_speed = phba->cfg_link_speed =
LPFC_USER_LINK_SPEED_32G; LPFC_USER_LINK_SPEED_32G;
break; break;
case LINK_SPEED_64G:
phba->cfg_link_speed =
LPFC_USER_LINK_SPEED_64G;
break;
case 0xffff: case 0xffff:
phba->cfg_link_speed = phba->cfg_link_speed =
LPFC_USER_LINK_SPEED_AUTO; LPFC_USER_LINK_SPEED_AUTO;
......
...@@ -557,6 +557,10 @@ lpfc_init_link(struct lpfc_hba * phba, ...@@ -557,6 +557,10 @@ lpfc_init_link(struct lpfc_hba * phba,
mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
mb->un.varInitLnk.link_speed = LINK_SPEED_32G; mb->un.varInitLnk.link_speed = LINK_SPEED_32G;
break; break;
case LPFC_USER_LINK_SPEED_64G:
mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
mb->un.varInitLnk.link_speed = LINK_SPEED_64G;
break;
case LPFC_USER_LINK_SPEED_AUTO: case LPFC_USER_LINK_SPEED_AUTO:
default: default:
mb->un.varInitLnk.link_speed = LINK_SPEED_AUTO; mb->un.varInitLnk.link_speed = LINK_SPEED_AUTO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment