scsi: lpfc: add Trunking support

Add trunking support to the driver. Trunking is found on more recent
asics. In general, trunking appears as a single "port" to the driver
and overall behavior doesn't differ. Link speed is reported as an
aggregate value, while link speed control is done on a per-physical
link basis with all links in the trunk symmetrical. Some commands
returning port information are updated to additionally provide
trunking information. And new ACQEs are generated to report physical
link events relative to the trunk.

This patch contains the following modifications:

- Added link speed settings of 128GB and 256GB.

- Added handling of trunk-related ACQEs, mainly logging and trapping
  of physical link statuses.

- Added additional bsg interface to query trunk state by applications.

- Augment link_state sysfs attribtute to display trunk link status

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Tento commit je obsažen v:
James Smart
2018-10-23 13:41:11 -07:00
odevzdal Martin K. Petersen
rodič 7ea92eb458
revize 1dc5ec2452
12 změnil soubory, kde provedl 474 přidání a 0 odebrání

Zobrazit soubor

@@ -1035,6 +1035,7 @@ struct mbox_header {
#define LPFC_MBOX_OPCODE_FCOE_SET_FCLINK_SETTINGS 0x21
#define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_STATE 0x22
#define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_LOOPBACK 0x23
#define LPFC_MBOX_OPCODE_FCOE_FC_SET_TRUNK_MODE 0x42
/* Low level Opcodes */
#define LPFC_MBOX_OPCODE_SET_DIAG_LOG_OPTION 0x37
@@ -2781,6 +2782,9 @@ struct lpfc_mbx_read_config {
#define lpfc_mbx_rd_conf_lnk_ldv_SHIFT 8
#define lpfc_mbx_rd_conf_lnk_ldv_MASK 0x00000001
#define lpfc_mbx_rd_conf_lnk_ldv_WORD word2
#define lpfc_mbx_rd_conf_trunk_SHIFT 12
#define lpfc_mbx_rd_conf_trunk_MASK 0x0000000F
#define lpfc_mbx_rd_conf_trunk_WORD word2
#define lpfc_mbx_rd_conf_topology_SHIFT 24
#define lpfc_mbx_rd_conf_topology_MASK 0x000000FF
#define lpfc_mbx_rd_conf_topology_WORD word2
@@ -3516,6 +3520,15 @@ struct lpfc_mbx_set_host_data {
uint8_t data[LPFC_HOST_OS_DRIVER_VERSION_SIZE];
};
struct lpfc_mbx_set_trunk_mode {
struct mbox_header header;
uint32_t word0;
#define lpfc_mbx_set_trunk_mode_WORD word0
#define lpfc_mbx_set_trunk_mode_SHIFT 0
#define lpfc_mbx_set_trunk_mode_MASK 0xFF
uint32_t word1;
uint32_t word2;
};
struct lpfc_mbx_get_sli4_parameters {
struct mbox_header header;
@@ -3915,6 +3928,7 @@ struct lpfc_mqe {
struct lpfc_mbx_set_feature set_feature;
struct lpfc_mbx_memory_dump_type3 mem_dump_type3;
struct lpfc_mbx_set_host_data set_host_data;
struct lpfc_mbx_set_trunk_mode set_trunk_mode;
struct lpfc_mbx_nop nop;
struct lpfc_mbx_set_ras_fwlog ras_fwlog;
} un;
@@ -4051,6 +4065,23 @@ struct lpfc_acqe_grp5 {
uint32_t trailer;
};
static char *const trunk_errmsg[] = { /* map errcode */
"", /* There is no such error code at index 0*/
"link negotiated speed does not match existing"
" trunk - link was \"low\" speed",
"link negotiated speed does not match"
" existing trunk - link was \"middle\" speed",
"link negotiated speed does not match existing"
" trunk - link was \"high\" speed",
"Attached to non-trunking port - F_Port",
"Attached to non-trunking port - N_Port",
"FLOGI response timeout",
"non-FLOGI frame received",
"Invalid FLOGI response",
"Trunking initialization protocol",
"Trunk peer device mismatch",
};
struct lpfc_acqe_fc_la {
uint32_t word0;
#define lpfc_acqe_fc_la_speed_SHIFT 24
@@ -4084,6 +4115,7 @@ struct lpfc_acqe_fc_la {
#define LPFC_FC_LA_TYPE_MDS_LINK_DOWN 0x4
#define LPFC_FC_LA_TYPE_MDS_LOOPBACK 0x5
#define LPFC_FC_LA_TYPE_UNEXP_WWPN 0x6
#define LPFC_FC_LA_TYPE_TRUNKING_EVENT 0x7
#define lpfc_acqe_fc_la_port_type_SHIFT 6
#define lpfc_acqe_fc_la_port_type_MASK 0x00000003
#define lpfc_acqe_fc_la_port_type_WORD word0
@@ -4092,6 +4124,32 @@ struct lpfc_acqe_fc_la {
#define lpfc_acqe_fc_la_port_number_SHIFT 0
#define lpfc_acqe_fc_la_port_number_MASK 0x0000003F
#define lpfc_acqe_fc_la_port_number_WORD word0
/* Attention Type is 0x07 (Trunking Event) word0 */
#define lpfc_acqe_fc_la_trunk_link_status_port0_SHIFT 16
#define lpfc_acqe_fc_la_trunk_link_status_port0_MASK 0x0000001
#define lpfc_acqe_fc_la_trunk_link_status_port0_WORD word0
#define lpfc_acqe_fc_la_trunk_link_status_port1_SHIFT 17
#define lpfc_acqe_fc_la_trunk_link_status_port1_MASK 0x0000001
#define lpfc_acqe_fc_la_trunk_link_status_port1_WORD word0
#define lpfc_acqe_fc_la_trunk_link_status_port2_SHIFT 18
#define lpfc_acqe_fc_la_trunk_link_status_port2_MASK 0x0000001
#define lpfc_acqe_fc_la_trunk_link_status_port2_WORD word0
#define lpfc_acqe_fc_la_trunk_link_status_port3_SHIFT 19
#define lpfc_acqe_fc_la_trunk_link_status_port3_MASK 0x0000001
#define lpfc_acqe_fc_la_trunk_link_status_port3_WORD word0
#define lpfc_acqe_fc_la_trunk_config_port0_SHIFT 20
#define lpfc_acqe_fc_la_trunk_config_port0_MASK 0x0000001
#define lpfc_acqe_fc_la_trunk_config_port0_WORD word0
#define lpfc_acqe_fc_la_trunk_config_port1_SHIFT 21
#define lpfc_acqe_fc_la_trunk_config_port1_MASK 0x0000001
#define lpfc_acqe_fc_la_trunk_config_port1_WORD word0
#define lpfc_acqe_fc_la_trunk_config_port2_SHIFT 22
#define lpfc_acqe_fc_la_trunk_config_port2_MASK 0x0000001
#define lpfc_acqe_fc_la_trunk_config_port2_WORD word0
#define lpfc_acqe_fc_la_trunk_config_port3_SHIFT 23
#define lpfc_acqe_fc_la_trunk_config_port3_MASK 0x0000001
#define lpfc_acqe_fc_la_trunk_config_port3_WORD word0
uint32_t word1;
#define lpfc_acqe_fc_la_llink_spd_SHIFT 16
#define lpfc_acqe_fc_la_llink_spd_MASK 0x0000FFFF
@@ -4099,6 +4157,12 @@ struct lpfc_acqe_fc_la {
#define lpfc_acqe_fc_la_fault_SHIFT 0
#define lpfc_acqe_fc_la_fault_MASK 0x000000FF
#define lpfc_acqe_fc_la_fault_WORD word1
#define lpfc_acqe_fc_la_trunk_fault_SHIFT 0
#define lpfc_acqe_fc_la_trunk_fault_MASK 0x0000000F
#define lpfc_acqe_fc_la_trunk_fault_WORD word1
#define lpfc_acqe_fc_la_trunk_linkmask_SHIFT 4
#define lpfc_acqe_fc_la_trunk_linkmask_MASK 0x000000F
#define lpfc_acqe_fc_la_trunk_linkmask_WORD word1
#define LPFC_FC_LA_FAULT_NONE 0x0
#define LPFC_FC_LA_FAULT_LOCAL 0x1
#define LPFC_FC_LA_FAULT_REMOTE 0x2