提交 7ad20aa9 编写于 作者: J James Smart 提交者: James Bottomley

[SCSI] lpfc 8.3.24: Extend BSG infrastructure and add link diagnostics

Extend BSG infrastructure and add link diagnostics:
- Removed unnecessary copies in handling pass-through mbox cmds.
- Add embedded SLI_CONFIG support for BSG.
- Add multibuffer support.
- Implemented the setting up and tearing down Lancer FC device for performing
  internal and external loopback diagnostic tests.
- Implemented the driver support for performing new link diagnostic tests
Signed-off-by: NAlex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: NJames Smart <james.smart@emulex.com>
Signed-off-by: NJames Bottomley <jbottomley@parallels.com>
上级 6d368e53
......@@ -487,6 +487,42 @@ struct unsol_rcv_ct_ctx {
(1 << LPFC_USER_LINK_SPEED_AUTO))
#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8, 10, 16"
enum nemb_type {
nemb_mse = 1,
nemb_hbd
};
enum mbox_type {
mbox_rd = 1,
mbox_wr
};
enum dma_type {
dma_mbox = 1,
dma_ebuf
};
enum sta_type {
sta_pre_addr = 1,
sta_pos_addr
};
struct lpfc_mbox_ext_buf_ctx {
uint32_t state;
#define LPFC_BSG_MBOX_IDLE 0
#define LPFC_BSG_MBOX_HOST 1
#define LPFC_BSG_MBOX_PORT 2
#define LPFC_BSG_MBOX_DONE 3
#define LPFC_BSG_MBOX_ABTS 4
enum nemb_type nembType;
enum mbox_type mboxType;
uint32_t numBuf;
uint32_t mbxTag;
uint32_t seqNum;
struct lpfc_dmabuf *mbx_dmabuf;
struct list_head ext_dmabuf_list;
};
struct lpfc_hba {
/* SCSI interface function jump table entries */
int (*lpfc_new_scsi_buf)
......@@ -590,6 +626,7 @@ struct lpfc_hba {
MAILBOX_t *mbox;
uint32_t *mbox_ext;
struct lpfc_mbox_ext_buf_ctx mbox_ext_buf_ctx;
uint32_t ha_copy;
struct _PCB *pcb;
struct _IOCB *IOCBs;
......@@ -708,7 +745,6 @@ struct lpfc_hba {
uint32_t *hbq_get; /* Host mem address of HBQ get ptrs */
int brd_no; /* FC board number */
char SerialNumber[32]; /* adapter Serial Number */
char OptionROMVersion[32]; /* adapter BIOS / Fcode version */
char ModelDesc[256]; /* Model Description */
......
此差异已折叠。
......@@ -24,15 +24,17 @@
* These are the vendor unique structures passed in using the bsg
* FC_BSG_HST_VENDOR message code type.
*/
#define LPFC_BSG_VENDOR_SET_CT_EVENT 1
#define LPFC_BSG_VENDOR_GET_CT_EVENT 2
#define LPFC_BSG_VENDOR_SEND_MGMT_RESP 3
#define LPFC_BSG_VENDOR_DIAG_MODE 4
#define LPFC_BSG_VENDOR_DIAG_TEST 5
#define LPFC_BSG_VENDOR_GET_MGMT_REV 6
#define LPFC_BSG_VENDOR_MBOX 7
#define LPFC_BSG_VENDOR_MENLO_CMD 8
#define LPFC_BSG_VENDOR_MENLO_DATA 9
#define LPFC_BSG_VENDOR_SET_CT_EVENT 1
#define LPFC_BSG_VENDOR_GET_CT_EVENT 2
#define LPFC_BSG_VENDOR_SEND_MGMT_RESP 3
#define LPFC_BSG_VENDOR_DIAG_MODE 4
#define LPFC_BSG_VENDOR_DIAG_RUN_LOOPBACK 5
#define LPFC_BSG_VENDOR_GET_MGMT_REV 6
#define LPFC_BSG_VENDOR_MBOX 7
#define LPFC_BSG_VENDOR_MENLO_CMD 8
#define LPFC_BSG_VENDOR_MENLO_DATA 9
#define LPFC_BSG_VENDOR_DIAG_MODE_END 10
#define LPFC_BSG_VENDOR_LINK_DIAG_TEST 11
struct set_ct_event {
uint32_t command;
......@@ -67,10 +69,25 @@ struct diag_mode_set {
uint32_t timeout;
};
struct sli4_link_diag {
uint32_t command;
uint32_t timeout;
uint32_t test_id;
uint32_t loops;
uint32_t test_version;
uint32_t error_action;
};
struct diag_mode_test {
uint32_t command;
};
struct diag_status {
uint32_t mbox_status;
uint32_t shdr_status;
uint32_t shdr_add_status;
};
#define LPFC_WWNN_TYPE 0
#define LPFC_WWPN_TYPE 1
......@@ -92,11 +109,15 @@ struct get_mgmt_rev_reply {
};
#define BSG_MBOX_SIZE 4096 /* mailbox command plus extended data */
/* BSG mailbox request header */
struct dfc_mbox_req {
uint32_t command;
uint32_t mbOffset;
uint32_t inExtWLen;
uint32_t outExtWLen;
uint32_t extMboxTag;
uint32_t extSeqNum;
};
/* Used for menlo command or menlo data. The xri is only used for menlo data */
......@@ -171,7 +192,7 @@ struct lpfc_sli_config_mse {
#define lpfc_mbox_sli_config_mse_len_WORD buf_len
};
struct lpfc_sli_config_subcmd_hbd {
struct lpfc_sli_config_hbd {
uint32_t buf_len;
#define lpfc_mbox_sli_config_ecmn_hbd_len_SHIFT 0
#define lpfc_mbox_sli_config_ecmn_hbd_len_MASK 0xffffff
......@@ -194,21 +215,39 @@ struct lpfc_sli_config_hdr {
uint32_t reserved5;
};
struct lpfc_sli_config_generic {
struct lpfc_sli_config_emb0_subsys {
struct lpfc_sli_config_hdr sli_config_hdr;
#define LPFC_MBX_SLI_CONFIG_MAX_MSE 19
struct lpfc_sli_config_mse mse[LPFC_MBX_SLI_CONFIG_MAX_MSE];
uint32_t padding;
uint32_t word64;
#define lpfc_emb0_subcmnd_opcode_SHIFT 0
#define lpfc_emb0_subcmnd_opcode_MASK 0xff
#define lpfc_emb0_subcmnd_opcode_WORD word64
#define lpfc_emb0_subcmnd_subsys_SHIFT 8
#define lpfc_emb0_subcmnd_subsys_MASK 0xff
#define lpfc_emb0_subcmnd_subsys_WORD word64
/* Subsystem FCOE (0x0C) OpCodes */
#define SLI_CONFIG_SUBSYS_FCOE 0x0C
#define FCOE_OPCODE_READ_FCF 0x08
#define FCOE_OPCODE_ADD_FCF 0x09
};
struct lpfc_sli_config_subcmnd {
struct lpfc_sli_config_emb1_subsys {
struct lpfc_sli_config_hdr sli_config_hdr;
uint32_t word6;
#define lpfc_subcmnd_opcode_SHIFT 0
#define lpfc_subcmnd_opcode_MASK 0xff
#define lpfc_subcmnd_opcode_WORD word6
#define lpfc_subcmnd_subsys_SHIFT 8
#define lpfc_subcmnd_subsys_MASK 0xff
#define lpfc_subcmnd_subsys_WORD word6
#define lpfc_emb1_subcmnd_opcode_SHIFT 0
#define lpfc_emb1_subcmnd_opcode_MASK 0xff
#define lpfc_emb1_subcmnd_opcode_WORD word6
#define lpfc_emb1_subcmnd_subsys_SHIFT 8
#define lpfc_emb1_subcmnd_subsys_MASK 0xff
#define lpfc_emb1_subcmnd_subsys_WORD word6
/* Subsystem COMN (0x01) OpCodes */
#define SLI_CONFIG_SUBSYS_COMN 0x01
#define COMN_OPCODE_READ_OBJECT 0xAB
#define COMN_OPCODE_WRITE_OBJECT 0xAC
#define COMN_OPCODE_READ_OBJECT_LIST 0xAD
#define COMN_OPCODE_DELETE_OBJECT 0xAE
uint32_t timeout;
uint32_t request_length;
uint32_t word9;
......@@ -222,8 +261,8 @@ struct lpfc_sli_config_subcmnd {
uint32_t rd_offset;
uint32_t obj_name[26];
uint32_t hbd_count;
#define LPFC_MBX_SLI_CONFIG_MAX_HBD 10
struct lpfc_sli_config_subcmd_hbd hbd[LPFC_MBX_SLI_CONFIG_MAX_HBD];
#define LPFC_MBX_SLI_CONFIG_MAX_HBD 8
struct lpfc_sli_config_hbd hbd[LPFC_MBX_SLI_CONFIG_MAX_HBD];
};
struct lpfc_sli_config_mbox {
......@@ -235,7 +274,11 @@ struct lpfc_sli_config_mbox {
#define lpfc_mqe_command_MASK 0x000000FF
#define lpfc_mqe_command_WORD word0
union {
struct lpfc_sli_config_generic sli_config_generic;
struct lpfc_sli_config_subcmnd sli_config_subcmnd;
struct lpfc_sli_config_emb0_subsys sli_config_emb0_subsys;
struct lpfc_sli_config_emb1_subsys sli_config_emb1_subsys;
} un;
};
/* driver only */
#define SLI_CONFIG_NOT_HANDLED 0
#define SLI_CONFIG_HANDLED 1
......@@ -867,6 +867,8 @@ struct mbox_header {
#define LPFC_MBOX_OPCODE_FCOE_DELETE_FCF 0x0A
#define LPFC_MBOX_OPCODE_FCOE_POST_HDR_TEMPLATE 0x0B
#define LPFC_MBOX_OPCODE_FCOE_REDISCOVER_FCF 0x10
#define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_STATE 0x22
#define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_LOOPBACK 0x23
/* Mailbox command structures */
struct eq_context {
......@@ -1308,6 +1310,83 @@ struct lpfc_id_range {
#define lpfc_mbx_rsrc_id_word4_1_WORD word5
};
struct lpfc_mbx_set_link_diag_state {
struct mbox_header header;
union {
struct {
uint32_t word0;
#define lpfc_mbx_set_diag_state_diag_SHIFT 0
#define lpfc_mbx_set_diag_state_diag_MASK 0x00000001
#define lpfc_mbx_set_diag_state_diag_WORD word0
#define lpfc_mbx_set_diag_state_link_num_SHIFT 16
#define lpfc_mbx_set_diag_state_link_num_MASK 0x0000003F
#define lpfc_mbx_set_diag_state_link_num_WORD word0
#define lpfc_mbx_set_diag_state_link_type_SHIFT 22
#define lpfc_mbx_set_diag_state_link_type_MASK 0x00000003
#define lpfc_mbx_set_diag_state_link_type_WORD word0
} req;
struct {
uint32_t word0;
} rsp;
} u;
};
struct lpfc_mbx_set_link_diag_loopback {
struct mbox_header header;
union {
struct {
uint32_t word0;
#define lpfc_mbx_set_diag_lpbk_type_SHIFT 0
#define lpfc_mbx_set_diag_lpbk_type_MASK 0x00000001
#define lpfc_mbx_set_diag_lpbk_type_WORD word0
#define LPFC_DIAG_LOOPBACK_TYPE_DISABLE 0x0
#define LPFC_DIAG_LOOPBACK_TYPE_INTERNAL 0x1
#define LPFC_DIAG_LOOPBACK_TYPE_EXTERNAL 0x2
#define lpfc_mbx_set_diag_lpbk_link_num_SHIFT 16
#define lpfc_mbx_set_diag_lpbk_link_num_MASK 0x0000003F
#define lpfc_mbx_set_diag_lpbk_link_num_WORD word0
#define lpfc_mbx_set_diag_lpbk_link_type_SHIFT 22
#define lpfc_mbx_set_diag_lpbk_link_type_MASK 0x00000003
#define lpfc_mbx_set_diag_lpbk_link_type_WORD word0
} req;
struct {
uint32_t word0;
} rsp;
} u;
};
struct lpfc_mbx_run_link_diag_test {
struct mbox_header header;
union {
struct {
uint32_t word0;
#define lpfc_mbx_run_diag_test_link_num_SHIFT 16
#define lpfc_mbx_run_diag_test_link_num_MASK 0x0000003F
#define lpfc_mbx_run_diag_test_link_num_WORD word0
#define lpfc_mbx_run_diag_test_link_type_SHIFT 22
#define lpfc_mbx_run_diag_test_link_type_MASK 0x00000003
#define lpfc_mbx_run_diag_test_link_type_WORD word0
uint32_t word1;
#define lpfc_mbx_run_diag_test_test_id_SHIFT 0
#define lpfc_mbx_run_diag_test_test_id_MASK 0x0000FFFF
#define lpfc_mbx_run_diag_test_test_id_WORD word1
#define lpfc_mbx_run_diag_test_loops_SHIFT 16
#define lpfc_mbx_run_diag_test_loops_MASK 0x0000FFFF
#define lpfc_mbx_run_diag_test_loops_WORD word1
uint32_t word2;
#define lpfc_mbx_run_diag_test_test_ver_SHIFT 0
#define lpfc_mbx_run_diag_test_test_ver_MASK 0x0000FFFF
#define lpfc_mbx_run_diag_test_test_ver_WORD word2
#define lpfc_mbx_run_diag_test_err_act_SHIFT 16
#define lpfc_mbx_run_diag_test_err_act_MASK 0x000000FF
#define lpfc_mbx_run_diag_test_err_act_WORD word2
} req;
struct {
uint32_t word0;
} rsp;
} u;
};
/*
* struct lpfc_mbx_alloc_rsrc_extents:
* A mbox is generically 256 bytes long. An SLI4_CONFIG mailbox requires
......@@ -2553,6 +2632,9 @@ struct lpfc_mqe {
struct lpfc_mbx_supp_pages supp_pages;
struct lpfc_mbx_pc_sli4_params sli4_params;
struct lpfc_mbx_get_sli4_parameters get_sli4_parameters;
struct lpfc_mbx_set_link_diag_state link_diag_state;
struct lpfc_mbx_set_link_diag_loopback link_diag_loopback;
struct lpfc_mbx_run_link_diag_test link_diag_test;
struct lpfc_mbx_get_func_cfg get_func_cfg;
struct lpfc_mbx_get_prof_cfg get_prof_cfg;
struct lpfc_mbx_nop nop;
......
......@@ -4246,6 +4246,14 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
phba->fcf.redisc_wait.function = lpfc_sli4_fcf_redisc_wait_tmo;
phba->fcf.redisc_wait.data = (unsigned long)phba;
/*
* Control structure for handling external multi-buffer mailbox
* command pass-through.
*/
memset((uint8_t *)&phba->mbox_ext_buf_ctx, 0,
sizeof(struct lpfc_mbox_ext_buf_ctx));
INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list);
/*
* We need to do a READ_CONFIG mailbox command here before
* calling lpfc_get_cfgparam. For VFs this will report the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册