Commit 6669f9bb authored by James Smart's avatar James Smart Committed by James Bottomley

[SCSI] lpfc 8.3.5: fix VPI registration, error clean up and add support for vlink events

This patch includes the following fixes and new features:
- Fix mask size for CT field in WQE
- Fix VPI base not used when unregistering VPI on port 1.
- Fix UNREG_VPI mailbox command to unreg the correct VPI
- Fixed Check for aborted els command
- Fix error when trying to load driver with wrong firmware on FCoE HBA.
- Fix bug with probe_one routines not putting the Scsi_Host back upon error
- Add support for Clear Virtual Link Async Events
- Add support for unsolicited CT exchange sequence abort
- Add 0x0714 OCeXXXXX PCI ID
Signed-off-by: default avatarJames Smart <james.smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 4d9ab994
...@@ -144,6 +144,8 @@ void lpfc_hb_timeout_handler(struct lpfc_hba *); ...@@ -144,6 +144,8 @@ void lpfc_hb_timeout_handler(struct lpfc_hba *);
void lpfc_ct_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *, void lpfc_ct_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
struct lpfc_iocbq *); struct lpfc_iocbq *);
void lpfc_sli4_ct_abort_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
struct lpfc_iocbq *);
int lpfc_ns_cmd(struct lpfc_vport *, int, uint8_t, uint32_t); int lpfc_ns_cmd(struct lpfc_vport *, int, uint8_t, uint32_t);
int lpfc_fdmi_cmd(struct lpfc_vport *, struct lpfc_nodelist *, int); int lpfc_fdmi_cmd(struct lpfc_vport *, struct lpfc_nodelist *, int);
void lpfc_fdmi_tmo(unsigned long); void lpfc_fdmi_tmo(unsigned long);
...@@ -188,7 +190,7 @@ int lpfc_mbox_tmo_val(struct lpfc_hba *, int); ...@@ -188,7 +190,7 @@ int lpfc_mbox_tmo_val(struct lpfc_hba *, int);
void lpfc_init_vfi(struct lpfcMboxq *, struct lpfc_vport *); void lpfc_init_vfi(struct lpfcMboxq *, struct lpfc_vport *);
void lpfc_reg_vfi(struct lpfcMboxq *, struct lpfc_vport *, dma_addr_t); void lpfc_reg_vfi(struct lpfcMboxq *, struct lpfc_vport *, dma_addr_t);
void lpfc_init_vpi(struct lpfc_hba *, struct lpfcMboxq *, uint16_t); void lpfc_init_vpi(struct lpfc_hba *, struct lpfcMboxq *, uint16_t);
void lpfc_unreg_vfi(struct lpfcMboxq *, uint16_t); void lpfc_unreg_vfi(struct lpfcMboxq *, struct lpfc_vport *);
void lpfc_reg_fcfi(struct lpfc_hba *, struct lpfcMboxq *); void lpfc_reg_fcfi(struct lpfc_hba *, struct lpfcMboxq *);
void lpfc_unreg_fcfi(struct lpfcMboxq *, uint16_t); void lpfc_unreg_fcfi(struct lpfcMboxq *, uint16_t);
void lpfc_resume_rpi(struct lpfcMboxq *, struct lpfc_nodelist *); void lpfc_resume_rpi(struct lpfcMboxq *, struct lpfc_nodelist *);
...@@ -361,6 +363,7 @@ void lpfc_stop_port(struct lpfc_hba *); ...@@ -361,6 +363,7 @@ void lpfc_stop_port(struct lpfc_hba *);
void lpfc_parse_fcoe_conf(struct lpfc_hba *, uint8_t *, uint32_t); void lpfc_parse_fcoe_conf(struct lpfc_hba *, uint8_t *, uint32_t);
int lpfc_parse_vpd(struct lpfc_hba *, uint8_t *, int); int lpfc_parse_vpd(struct lpfc_hba *, uint8_t *, int);
void lpfc_start_fdiscs(struct lpfc_hba *phba); void lpfc_start_fdiscs(struct lpfc_hba *phba);
struct lpfc_vport *lpfc_find_vport_by_vpid(struct lpfc_hba *, uint16_t);
#define ScsiResult(host_code, scsi_code) (((host_code) << 16) | scsi_code) #define ScsiResult(host_code, scsi_code) (((host_code) << 16) | scsi_code)
#define HBA_EVENT_RSCN 5 #define HBA_EVENT_RSCN 5
......
...@@ -87,7 +87,6 @@ void ...@@ -87,7 +87,6 @@ void
lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
struct lpfc_iocbq *piocbq) struct lpfc_iocbq *piocbq)
{ {
struct lpfc_dmabuf *mp = NULL; struct lpfc_dmabuf *mp = NULL;
IOCB_t *icmd = &piocbq->iocb; IOCB_t *icmd = &piocbq->iocb;
int i; int i;
...@@ -160,6 +159,39 @@ lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, ...@@ -160,6 +159,39 @@ lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
} }
} }
/**
* lpfc_sli4_ct_abort_unsol_event - Default handle for sli4 unsol abort
* @phba: Pointer to HBA context object.
* @pring: Pointer to the driver internal I/O ring.
* @piocbq: Pointer to the IOCBQ.
*
* This function serves as the default handler for the sli4 unsolicited
* abort event. It shall be invoked when there is no application interface
* registered unsolicited abort handler. This handler does nothing but
* just simply releases the dma buffer used by the unsol abort event.
**/
void
lpfc_sli4_ct_abort_unsol_event(struct lpfc_hba *phba,
struct lpfc_sli_ring *pring,
struct lpfc_iocbq *piocbq)
{
IOCB_t *icmd = &piocbq->iocb;
struct lpfc_dmabuf *bdeBuf;
uint32_t size;
/* Forward abort event to any process registered to receive ct event */
lpfc_bsg_ct_unsol_event(phba, pring, piocbq);
/* If there is no BDE associated with IOCB, there is nothing to do */
if (icmd->ulpBdeCount == 0)
return;
bdeBuf = piocbq->context2;
piocbq->context2 = NULL;
size = icmd->un.cont64[0].tus.f.bdeSize;
lpfc_ct_unsol_buffer(phba, piocbq, bdeBuf, size);
lpfc_in_buf_free(phba, bdeBuf);
}
static void static void
lpfc_free_ct_rsp(struct lpfc_hba *phba, struct lpfc_dmabuf *mlist) lpfc_free_ct_rsp(struct lpfc_hba *phba, struct lpfc_dmabuf *mlist)
{ {
......
...@@ -2712,12 +2712,16 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -2712,12 +2712,16 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
!lpfc_error_lost_link(irsp)) { !lpfc_error_lost_link(irsp)) {
/* FLOGI retry policy */ /* FLOGI retry policy */
retry = 1; retry = 1;
maxretry = 48; /* retry forever */
if (cmdiocb->retry >= 32) maxretry = 0;
if (cmdiocb->retry >= 100)
delay = 5000;
else if (cmdiocb->retry >= 32)
delay = 1000; delay = 1000;
} }
if ((++cmdiocb->retry) >= maxretry) { cmdiocb->retry++;
if (maxretry && (cmdiocb->retry >= maxretry)) {
phba->fc_stat.elsRetryExceeded++; phba->fc_stat.elsRetryExceeded++;
retry = 0; retry = 0;
} }
...@@ -5671,7 +5675,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, ...@@ -5671,7 +5675,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
* NULL - No vport with the matching @vpi found * NULL - No vport with the matching @vpi found
* Otherwise - Address to the vport with the matching @vpi. * Otherwise - Address to the vport with the matching @vpi.
**/ **/
static struct lpfc_vport * struct lpfc_vport *
lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi) lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi)
{ {
struct lpfc_vport *vport; struct lpfc_vport *vport;
......
...@@ -4474,7 +4474,7 @@ lpfc_unregister_unused_fcf(struct lpfc_hba *phba) ...@@ -4474,7 +4474,7 @@ lpfc_unregister_unused_fcf(struct lpfc_hba *phba)
return; return;
} }
lpfc_unreg_vfi(mbox, phba->pport->vfi); lpfc_unreg_vfi(mbox, phba->pport);
mbox->vport = phba->pport; mbox->vport = phba->pport;
mbox->mbox_cmpl = lpfc_unregister_vfi_cmpl; mbox->mbox_cmpl = lpfc_unregister_vfi_cmpl;
......
...@@ -1183,6 +1183,7 @@ typedef struct { ...@@ -1183,6 +1183,7 @@ typedef struct {
#define PCI_DEVICE_ID_ZEPHYR_DCSP 0xfe12 #define PCI_DEVICE_ID_ZEPHYR_DCSP 0xfe12
#define PCI_VENDOR_ID_SERVERENGINE 0x19a2 #define PCI_VENDOR_ID_SERVERENGINE 0x19a2
#define PCI_DEVICE_ID_TIGERSHARK 0x0704 #define PCI_DEVICE_ID_TIGERSHARK 0x0704
#define PCI_DEVICE_ID_TS_BE3 0x0714
#define JEDEC_ID_ADDRESS 0x0080001c #define JEDEC_ID_ADDRESS 0x0080001c
#define FIREFLY_JEDEC_ID 0x1ACC #define FIREFLY_JEDEC_ID 0x1ACC
...@@ -1444,6 +1445,7 @@ typedef struct { /* FireFly BIU registers */ ...@@ -1444,6 +1445,7 @@ typedef struct { /* FireFly BIU registers */
#define CMD_ABORT_MXRI64_CN 0x8C #define CMD_ABORT_MXRI64_CN 0x8C
#define CMD_RCV_ELS_REQ64_CX 0x8D #define CMD_RCV_ELS_REQ64_CX 0x8D
#define CMD_XMIT_ELS_RSP64_CX 0x95 #define CMD_XMIT_ELS_RSP64_CX 0x95
#define CMD_XMIT_BLS_RSP64_CX 0x97
#define CMD_FCP_IWRITE64_CR 0x98 #define CMD_FCP_IWRITE64_CR 0x98
#define CMD_FCP_IWRITE64_CX 0x99 #define CMD_FCP_IWRITE64_CX 0x99
#define CMD_FCP_IREAD64_CR 0x9A #define CMD_FCP_IREAD64_CR 0x9A
...@@ -2326,7 +2328,13 @@ typedef struct { ...@@ -2326,7 +2328,13 @@ typedef struct {
/* Structure for MB Command UNREG_VPI (0x97) */ /* Structure for MB Command UNREG_VPI (0x97) */
typedef struct { typedef struct {
uint32_t rsvd1; uint32_t rsvd1;
uint32_t rsvd2; #ifdef __BIG_ENDIAN_BITFIELD
uint16_t rsvd2;
uint16_t sli4_vpi;
#else /* __LITTLE_ENDIAN */
uint16_t sli4_vpi;
uint16_t rsvd2;
#endif
uint32_t rsvd3; uint32_t rsvd3;
uint32_t rsvd4; uint32_t rsvd4;
uint32_t rsvd5; uint32_t rsvd5;
......
...@@ -425,7 +425,7 @@ struct lpfc_wqe_generic{ ...@@ -425,7 +425,7 @@ struct lpfc_wqe_generic{
#define lpfc_wqe_gen_status_MASK 0x0000000F #define lpfc_wqe_gen_status_MASK 0x0000000F
#define lpfc_wqe_gen_status_WORD word7 #define lpfc_wqe_gen_status_WORD word7
#define lpfc_wqe_gen_ct_SHIFT 2 #define lpfc_wqe_gen_ct_SHIFT 2
#define lpfc_wqe_gen_ct_MASK 0x00000007 #define lpfc_wqe_gen_ct_MASK 0x00000003
#define lpfc_wqe_gen_ct_WORD word7 #define lpfc_wqe_gen_ct_WORD word7
uint32_t abort_tag; uint32_t abort_tag;
uint32_t word9; uint32_t word9;
...@@ -760,6 +760,7 @@ struct mbox_header { ...@@ -760,6 +760,7 @@ struct mbox_header {
#define LPFC_MBOX_OPCODE_MQ_DESTROY 0x35 #define LPFC_MBOX_OPCODE_MQ_DESTROY 0x35
#define LPFC_MBOX_OPCODE_CQ_DESTROY 0x36 #define LPFC_MBOX_OPCODE_CQ_DESTROY 0x36
#define LPFC_MBOX_OPCODE_EQ_DESTROY 0x37 #define LPFC_MBOX_OPCODE_EQ_DESTROY 0x37
#define LPFC_MBOX_OPCODE_QUERY_FW_CFG 0x3A
#define LPFC_MBOX_OPCODE_FUNCTION_RESET 0x3D #define LPFC_MBOX_OPCODE_FUNCTION_RESET 0x3D
/* FCoE Opcodes */ /* FCoE Opcodes */
...@@ -1273,6 +1274,51 @@ struct lpfc_mbx_del_fcf_tbl_entry { ...@@ -1273,6 +1274,51 @@ struct lpfc_mbx_del_fcf_tbl_entry {
#define lpfc_mbx_del_fcf_tbl_index_WORD word10 #define lpfc_mbx_del_fcf_tbl_index_WORD word10
}; };
struct lpfc_mbx_query_fw_cfg {
struct mbox_header header;
uint32_t config_number;
uint32_t asic_rev;
uint32_t phys_port;
uint32_t function_mode;
/* firmware Function Mode */
#define lpfc_function_mode_toe_SHIFT 0
#define lpfc_function_mode_toe_MASK 0x00000001
#define lpfc_function_mode_toe_WORD function_mode
#define lpfc_function_mode_nic_SHIFT 1
#define lpfc_function_mode_nic_MASK 0x00000001
#define lpfc_function_mode_nic_WORD function_mode
#define lpfc_function_mode_rdma_SHIFT 2
#define lpfc_function_mode_rdma_MASK 0x00000001
#define lpfc_function_mode_rdma_WORD function_mode
#define lpfc_function_mode_vm_SHIFT 3
#define lpfc_function_mode_vm_MASK 0x00000001
#define lpfc_function_mode_vm_WORD function_mode
#define lpfc_function_mode_iscsi_i_SHIFT 4
#define lpfc_function_mode_iscsi_i_MASK 0x00000001
#define lpfc_function_mode_iscsi_i_WORD function_mode
#define lpfc_function_mode_iscsi_t_SHIFT 5
#define lpfc_function_mode_iscsi_t_MASK 0x00000001
#define lpfc_function_mode_iscsi_t_WORD function_mode
#define lpfc_function_mode_fcoe_i_SHIFT 6
#define lpfc_function_mode_fcoe_i_MASK 0x00000001
#define lpfc_function_mode_fcoe_i_WORD function_mode
#define lpfc_function_mode_fcoe_t_SHIFT 7
#define lpfc_function_mode_fcoe_t_MASK 0x00000001
#define lpfc_function_mode_fcoe_t_WORD function_mode
#define lpfc_function_mode_dal_SHIFT 8
#define lpfc_function_mode_dal_MASK 0x00000001
#define lpfc_function_mode_dal_WORD function_mode
#define lpfc_function_mode_lro_SHIFT 9
#define lpfc_function_mode_lro_MASK 0x00000001
#define lpfc_function_mode_lro_WORD function_mode9
#define lpfc_function_mode_flex10_SHIFT 10
#define lpfc_function_mode_flex10_MASK 0x00000001
#define lpfc_function_mode_flex10_WORD function_mode
#define lpfc_function_mode_ncsi_SHIFT 11
#define lpfc_function_mode_ncsi_MASK 0x00000001
#define lpfc_function_mode_ncsi_WORD function_mode
};
/* Status field for embedded SLI_CONFIG mailbox command */ /* Status field for embedded SLI_CONFIG mailbox command */
#define STATUS_SUCCESS 0x0 #define STATUS_SUCCESS 0x0
#define STATUS_FAILED 0x1 #define STATUS_FAILED 0x1
...@@ -1804,6 +1850,7 @@ struct lpfc_mqe { ...@@ -1804,6 +1850,7 @@ struct lpfc_mqe {
struct lpfc_mbx_read_config rd_config; struct lpfc_mbx_read_config rd_config;
struct lpfc_mbx_request_features req_ftrs; struct lpfc_mbx_request_features req_ftrs;
struct lpfc_mbx_post_hdr_tmpl hdr_tmpl; struct lpfc_mbx_post_hdr_tmpl hdr_tmpl;
struct lpfc_mbx_query_fw_cfg query_fw_cfg;
struct lpfc_mbx_nop nop; struct lpfc_mbx_nop nop;
} un; } un;
}; };
...@@ -1885,7 +1932,7 @@ struct lpfc_acqe_link { ...@@ -1885,7 +1932,7 @@ struct lpfc_acqe_link {
}; };
struct lpfc_acqe_fcoe { struct lpfc_acqe_fcoe {
uint32_t fcf_index; uint32_t index;
uint32_t word1; uint32_t word1;
#define lpfc_acqe_fcoe_fcf_count_SHIFT 0 #define lpfc_acqe_fcoe_fcf_count_SHIFT 0
#define lpfc_acqe_fcoe_fcf_count_MASK 0x0000FFFF #define lpfc_acqe_fcoe_fcf_count_MASK 0x0000FFFF
...@@ -1896,6 +1943,7 @@ struct lpfc_acqe_fcoe { ...@@ -1896,6 +1943,7 @@ struct lpfc_acqe_fcoe {
#define LPFC_FCOE_EVENT_TYPE_NEW_FCF 0x1 #define LPFC_FCOE_EVENT_TYPE_NEW_FCF 0x1
#define LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL 0x2 #define LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL 0x2
#define LPFC_FCOE_EVENT_TYPE_FCF_DEAD 0x3 #define LPFC_FCOE_EVENT_TYPE_FCF_DEAD 0x3
#define LPFC_FCOE_EVENT_TYPE_CVL 0x4
uint32_t event_tag; uint32_t event_tag;
uint32_t trailer; uint32_t trailer;
}; };
...@@ -1924,9 +1972,9 @@ struct lpfc_bmbx_create { ...@@ -1924,9 +1972,9 @@ struct lpfc_bmbx_create {
#define NO_XRI ((uint16_t)-1) #define NO_XRI ((uint16_t)-1)
struct wqe_common { struct wqe_common {
uint32_t word6; uint32_t word6;
#define wqe_xri_SHIFT 0 #define wqe_xri_tag_SHIFT 0
#define wqe_xri_MASK 0x0000FFFF #define wqe_xri_tag_MASK 0x0000FFFF
#define wqe_xri_WORD word6 #define wqe_xri_tag_WORD word6
#define wqe_ctxt_tag_SHIFT 16 #define wqe_ctxt_tag_SHIFT 16
#define wqe_ctxt_tag_MASK 0x0000FFFF #define wqe_ctxt_tag_MASK 0x0000FFFF
#define wqe_ctxt_tag_WORD word6 #define wqe_ctxt_tag_WORD word6
...@@ -1987,7 +2035,7 @@ struct wqe_common { ...@@ -1987,7 +2035,7 @@ struct wqe_common {
#define wqe_wqec_MASK 0x00000001 #define wqe_wqec_MASK 0x00000001
#define wqe_wqec_WORD word11 #define wqe_wqec_WORD word11
#define wqe_cqid_SHIFT 16 #define wqe_cqid_SHIFT 16
#define wqe_cqid_MASK 0x000003ff #define wqe_cqid_MASK 0x0000ffff
#define wqe_cqid_WORD word11 #define wqe_cqid_WORD word11
}; };
...@@ -1996,6 +2044,9 @@ struct wqe_did { ...@@ -1996,6 +2044,9 @@ struct wqe_did {
#define wqe_els_did_SHIFT 0 #define wqe_els_did_SHIFT 0
#define wqe_els_did_MASK 0x00FFFFFF #define wqe_els_did_MASK 0x00FFFFFF
#define wqe_els_did_WORD word5 #define wqe_els_did_WORD word5
#define wqe_xmit_bls_pt_SHIFT 28
#define wqe_xmit_bls_pt_MASK 0x00000003
#define wqe_xmit_bls_pt_WORD word5
#define wqe_xmit_bls_ar_SHIFT 30 #define wqe_xmit_bls_ar_SHIFT 30
#define wqe_xmit_bls_ar_MASK 0x00000001 #define wqe_xmit_bls_ar_MASK 0x00000001
#define wqe_xmit_bls_ar_WORD word5 #define wqe_xmit_bls_ar_WORD word5
...@@ -2044,6 +2095,23 @@ struct xmit_els_rsp64_wqe { ...@@ -2044,6 +2095,23 @@ struct xmit_els_rsp64_wqe {
struct xmit_bls_rsp64_wqe { struct xmit_bls_rsp64_wqe {
uint32_t payload0; uint32_t payload0;
/* Payload0 for BA_ACC */
#define xmit_bls_rsp64_acc_seq_id_SHIFT 16
#define xmit_bls_rsp64_acc_seq_id_MASK 0x000000ff
#define xmit_bls_rsp64_acc_seq_id_WORD payload0
#define xmit_bls_rsp64_acc_seq_id_vald_SHIFT 24
#define xmit_bls_rsp64_acc_seq_id_vald_MASK 0x000000ff
#define xmit_bls_rsp64_acc_seq_id_vald_WORD payload0
/* Payload0 for BA_RJT */
#define xmit_bls_rsp64_rjt_vspec_SHIFT 0
#define xmit_bls_rsp64_rjt_vspec_MASK 0x000000ff
#define xmit_bls_rsp64_rjt_vspec_WORD payload0
#define xmit_bls_rsp64_rjt_expc_SHIFT 8
#define xmit_bls_rsp64_rjt_expc_MASK 0x000000ff
#define xmit_bls_rsp64_rjt_expc_WORD payload0
#define xmit_bls_rsp64_rjt_rsnc_SHIFT 16
#define xmit_bls_rsp64_rjt_rsnc_MASK 0x000000ff
#define xmit_bls_rsp64_rjt_rsnc_WORD payload0
uint32_t word1; uint32_t word1;
#define xmit_bls_rsp64_rxid_SHIFT 0 #define xmit_bls_rsp64_rxid_SHIFT 0
#define xmit_bls_rsp64_rxid_MASK 0x0000ffff #define xmit_bls_rsp64_rxid_MASK 0x0000ffff
...@@ -2052,18 +2120,19 @@ struct xmit_bls_rsp64_wqe { ...@@ -2052,18 +2120,19 @@ struct xmit_bls_rsp64_wqe {
#define xmit_bls_rsp64_oxid_MASK 0x0000ffff #define xmit_bls_rsp64_oxid_MASK 0x0000ffff
#define xmit_bls_rsp64_oxid_WORD word1 #define xmit_bls_rsp64_oxid_WORD word1
uint32_t word2; uint32_t word2;
#define xmit_bls_rsp64_seqcntlo_SHIFT 0 #define xmit_bls_rsp64_seqcnthi_SHIFT 0
#define xmit_bls_rsp64_seqcntlo_MASK 0x0000ffff
#define xmit_bls_rsp64_seqcntlo_WORD word2
#define xmit_bls_rsp64_seqcnthi_SHIFT 16
#define xmit_bls_rsp64_seqcnthi_MASK 0x0000ffff #define xmit_bls_rsp64_seqcnthi_MASK 0x0000ffff
#define xmit_bls_rsp64_seqcnthi_WORD word2 #define xmit_bls_rsp64_seqcnthi_WORD word2
#define xmit_bls_rsp64_seqcntlo_SHIFT 16
#define xmit_bls_rsp64_seqcntlo_MASK 0x0000ffff
#define xmit_bls_rsp64_seqcntlo_WORD word2
uint32_t rsrvd3; uint32_t rsrvd3;
uint32_t rsrvd4; uint32_t rsrvd4;
struct wqe_did wqe_dest; struct wqe_did wqe_dest;
struct wqe_common wqe_com; /* words 6-11 */ struct wqe_common wqe_com; /* words 6-11 */
uint32_t rsvd_12_15[4]; uint32_t rsvd_12_15[4];
}; };
struct wqe_rctl_dfctl { struct wqe_rctl_dfctl {
uint32_t word5; uint32_t word5;
#define wqe_si_SHIFT 2 #define wqe_si_SHIFT 2
......
...@@ -1669,6 +1669,10 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) ...@@ -1669,6 +1669,10 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
oneConnect = 1; oneConnect = 1;
m = (typeof(m)) {"OCe10100-F", max_speed, "PCIe"}; m = (typeof(m)) {"OCe10100-F", max_speed, "PCIe"};
break; break;
case PCI_DEVICE_ID_TS_BE3:
oneConnect = 1;
m = (typeof(m)) {"OCeXXXXX-F", max_speed, "PCIe"};
break;
default: default:
m = (typeof(m)){ NULL }; m = (typeof(m)){ NULL };
break; break;
...@@ -2698,6 +2702,63 @@ lpfc_sli_remove_dflt_fcf(struct lpfc_hba *phba) ...@@ -2698,6 +2702,63 @@ lpfc_sli_remove_dflt_fcf(struct lpfc_hba *phba)
mempool_free(mboxq, phba->mbox_mem_pool); mempool_free(mboxq, phba->mbox_mem_pool);
} }
/**
* lpfc_sli4_fw_cfg_check - Read the firmware config and verify FCoE support
* @phba: pointer to lpfc hba data structure.
*
* This function uses the QUERY_FW_CFG mailbox command to determine if the
* firmware loaded supports FCoE. A return of zero indicates that the mailbox
* was successful and the firmware supports FCoE. Any other return indicates
* a error. It is assumed that this function will be called before interrupts
* are enabled.
**/
static int
lpfc_sli4_fw_cfg_check(struct lpfc_hba *phba)
{
int rc = 0;
LPFC_MBOXQ_t *mboxq;
struct lpfc_mbx_query_fw_cfg *query_fw_cfg;
uint32_t length;
uint32_t shdr_status, shdr_add_status;
mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mboxq) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"2621 Failed to allocate mbox for "
"query firmware config cmd\n");
return -ENOMEM;
}
query_fw_cfg = &mboxq->u.mqe.un.query_fw_cfg;
length = (sizeof(struct lpfc_mbx_query_fw_cfg) -
sizeof(struct lpfc_sli4_cfg_mhdr));
lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON,
LPFC_MBOX_OPCODE_QUERY_FW_CFG,
length, LPFC_SLI4_MBX_EMBED);
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
/* The IOCTL status is embedded in the mailbox subheader. */
shdr_status = bf_get(lpfc_mbox_hdr_status,
&query_fw_cfg->header.cfg_shdr.response);
shdr_add_status = bf_get(lpfc_mbox_hdr_add_status,
&query_fw_cfg->header.cfg_shdr.response);
if (shdr_status || shdr_add_status || rc != MBX_SUCCESS) {
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
"2622 Query Firmware Config failed "
"mbx status x%x, status x%x add_status x%x\n",
rc, shdr_status, shdr_add_status);
return -EINVAL;
}
if (!bf_get(lpfc_function_mode_fcoe_i, query_fw_cfg)) {
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
"2623 FCoE Function not supported by firmware. "
"Function mode = %08x\n",
query_fw_cfg->function_mode);
return -EINVAL;
}
if (rc != MBX_TIMEOUT)
mempool_free(mboxq, phba->mbox_mem_pool);
return 0;
}
/** /**
* lpfc_sli4_parse_latt_fault - Parse sli4 link-attention link fault code * lpfc_sli4_parse_latt_fault - Parse sli4 link-attention link fault code
* @phba: pointer to lpfc hba data structure. * @phba: pointer to lpfc hba data structure.
...@@ -2918,6 +2979,9 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, ...@@ -2918,6 +2979,9 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
{ {
uint8_t event_type = bf_get(lpfc_acqe_fcoe_event_type, acqe_fcoe); uint8_t event_type = bf_get(lpfc_acqe_fcoe_event_type, acqe_fcoe);
int rc; int rc;
struct lpfc_vport *vport;
struct lpfc_nodelist *ndlp;
struct Scsi_Host *shost;
phba->fc_eventTag = acqe_fcoe->event_tag; phba->fc_eventTag = acqe_fcoe->event_tag;
phba->fcoe_eventtag = acqe_fcoe->event_tag; phba->fcoe_eventtag = acqe_fcoe->event_tag;
...@@ -2925,7 +2989,7 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, ...@@ -2925,7 +2989,7 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
case LPFC_FCOE_EVENT_TYPE_NEW_FCF: case LPFC_FCOE_EVENT_TYPE_NEW_FCF:
lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
"2546 New FCF found index 0x%x tag 0x%x\n", "2546 New FCF found index 0x%x tag 0x%x\n",
acqe_fcoe->fcf_index, acqe_fcoe->index,
acqe_fcoe->event_tag); acqe_fcoe->event_tag);
/* /*
* If the current FCF is in discovered state, or * If the current FCF is in discovered state, or
...@@ -2958,10 +3022,10 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, ...@@ -2958,10 +3022,10 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
case LPFC_FCOE_EVENT_TYPE_FCF_DEAD: case LPFC_FCOE_EVENT_TYPE_FCF_DEAD:
lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
"2549 FCF disconnected fron network index 0x%x" "2549 FCF disconnected fron network index 0x%x"
" tag 0x%x\n", acqe_fcoe->fcf_index, " tag 0x%x\n", acqe_fcoe->index,
acqe_fcoe->event_tag); acqe_fcoe->event_tag);
/* If the event is not for currently used fcf do nothing */ /* If the event is not for currently used fcf do nothing */
if (phba->fcf.fcf_indx != acqe_fcoe->fcf_index) if (phba->fcf.fcf_indx != acqe_fcoe->index)
break; break;
/* /*
* Currently, driver support only one FCF - so treat this as * Currently, driver support only one FCF - so treat this as
...@@ -2971,7 +3035,28 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, ...@@ -2971,7 +3035,28 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
/* Unregister FCF if no devices connected to it */ /* Unregister FCF if no devices connected to it */
lpfc_unregister_unused_fcf(phba); lpfc_unregister_unused_fcf(phba);
break; break;
case LPFC_FCOE_EVENT_TYPE_CVL:
lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
"2718 Clear Virtual Link Received for VPI 0x%x"
" tag 0x%x\n", acqe_fcoe->index, acqe_fcoe->event_tag);
vport = lpfc_find_vport_by_vpid(phba,
acqe_fcoe->index /*- phba->vpi_base*/);
if (!vport)
break;
ndlp = lpfc_findnode_did(vport, Fabric_DID);
if (!ndlp)
break;
shost = lpfc_shost_from_vport(vport);
lpfc_linkdown_port(vport);
if (vport->port_type != LPFC_NPIV_PORT) {
mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ);
spin_lock_irq(shost->host_lock);
ndlp->nlp_flag |= NLP_DELAY_TMO;
spin_unlock_irq(shost->host_lock);
ndlp->nlp_last_elscmd = ELS_CMD_FLOGI;
vport->port_state = LPFC_FLOGI;
}
break;
default: default:
lpfc_printf_log(phba, KERN_ERR, LOG_SLI, lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
"0288 Unknown FCoE event type 0x%x event tag " "0288 Unknown FCoE event type 0x%x event tag "
...@@ -3463,6 +3548,10 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) ...@@ -3463,6 +3548,10 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
if (unlikely(rc)) if (unlikely(rc))
goto out_free_bsmbx; goto out_free_bsmbx;
rc = lpfc_sli4_fw_cfg_check(phba);
if (unlikely(rc))
goto out_free_bsmbx;
/* Set up the hba's configuration parameters. */ /* Set up the hba's configuration parameters. */
rc = lpfc_sli4_read_config(phba); rc = lpfc_sli4_read_config(phba);
if (unlikely(rc)) if (unlikely(rc))
...@@ -6687,6 +6776,7 @@ lpfc_pci_probe_one_s3(struct pci_dev *pdev, const struct pci_device_id *pid) ...@@ -6687,6 +6776,7 @@ lpfc_pci_probe_one_s3(struct pci_dev *pdev, const struct pci_device_id *pid)
{ {
struct lpfc_hba *phba; struct lpfc_hba *phba;
struct lpfc_vport *vport = NULL; struct lpfc_vport *vport = NULL;
struct Scsi_Host *shost = NULL;
int error; int error;
uint32_t cfg_mode, intr_mode; uint32_t cfg_mode, intr_mode;
...@@ -6765,6 +6855,7 @@ lpfc_pci_probe_one_s3(struct pci_dev *pdev, const struct pci_device_id *pid) ...@@ -6765,6 +6855,7 @@ lpfc_pci_probe_one_s3(struct pci_dev *pdev, const struct pci_device_id *pid)
goto out_destroy_shost; goto out_destroy_shost;
} }
shost = lpfc_shost_from_vport(vport); /* save shost for error cleanup */
/* Now, trying to enable interrupt and bring up the device */ /* Now, trying to enable interrupt and bring up the device */
cfg_mode = phba->cfg_use_msi; cfg_mode = phba->cfg_use_msi;
while (true) { while (true) {
...@@ -6831,6 +6922,8 @@ lpfc_pci_probe_one_s3(struct pci_dev *pdev, const struct pci_device_id *pid) ...@@ -6831,6 +6922,8 @@ lpfc_pci_probe_one_s3(struct pci_dev *pdev, const struct pci_device_id *pid)
lpfc_sli_pci_mem_unset(phba); lpfc_sli_pci_mem_unset(phba);
out_disable_pci_dev: out_disable_pci_dev:
lpfc_disable_pci_dev(phba); lpfc_disable_pci_dev(phba);
if (shost)
scsi_host_put(shost);
out_free_phba: out_free_phba:
lpfc_hba_free(phba); lpfc_hba_free(phba);
return error; return error;
...@@ -7214,6 +7307,7 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) ...@@ -7214,6 +7307,7 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
{ {
struct lpfc_hba *phba; struct lpfc_hba *phba;
struct lpfc_vport *vport = NULL; struct lpfc_vport *vport = NULL;
struct Scsi_Host *shost = NULL;
int error; int error;
uint32_t cfg_mode, intr_mode; uint32_t cfg_mode, intr_mode;
int mcnt; int mcnt;
...@@ -7294,6 +7388,7 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) ...@@ -7294,6 +7388,7 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
goto out_destroy_shost; goto out_destroy_shost;
} }
shost = lpfc_shost_from_vport(vport); /* save shost for error cleanup */
/* Now, trying to enable interrupt and bring up the device */ /* Now, trying to enable interrupt and bring up the device */
cfg_mode = phba->cfg_use_msi; cfg_mode = phba->cfg_use_msi;
while (true) { while (true) {
...@@ -7362,6 +7457,8 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) ...@@ -7362,6 +7457,8 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
lpfc_sli4_pci_mem_unset(phba); lpfc_sli4_pci_mem_unset(phba);
out_disable_pci_dev: out_disable_pci_dev:
lpfc_disable_pci_dev(phba); lpfc_disable_pci_dev(phba);
if (shost)
scsi_host_put(shost);
out_free_phba: out_free_phba:
lpfc_hba_free(phba); lpfc_hba_free(phba);
return error; return error;
...@@ -7936,6 +8033,8 @@ static struct pci_device_id lpfc_id_table[] = { ...@@ -7936,6 +8033,8 @@ static struct pci_device_id lpfc_id_table[] = {
PCI_ANY_ID, PCI_ANY_ID, }, PCI_ANY_ID, PCI_ANY_ID, },
{PCI_VENDOR_ID_SERVERENGINE, PCI_DEVICE_ID_TIGERSHARK, {PCI_VENDOR_ID_SERVERENGINE, PCI_DEVICE_ID_TIGERSHARK,
PCI_ANY_ID, PCI_ANY_ID, }, PCI_ANY_ID, PCI_ANY_ID, },
{PCI_VENDOR_ID_SERVERENGINE, PCI_DEVICE_ID_TS_BE3,
PCI_ANY_ID, PCI_ANY_ID, },
{ 0 } { 0 }
}; };
......
...@@ -849,7 +849,10 @@ lpfc_unreg_vpi(struct lpfc_hba *phba, uint16_t vpi, LPFC_MBOXQ_t *pmb) ...@@ -849,7 +849,10 @@ lpfc_unreg_vpi(struct lpfc_hba *phba, uint16_t vpi, LPFC_MBOXQ_t *pmb)
MAILBOX_t *mb = &pmb->u.mb; MAILBOX_t *mb = &pmb->u.mb;
memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
mb->un.varUnregVpi.vpi = vpi + phba->vpi_base; if (phba->sli_rev < LPFC_SLI_REV4)
mb->un.varUnregVpi.vpi = vpi + phba->vpi_base;
else
mb->un.varUnregVpi.sli4_vpi = vpi + phba->vpi_base;
mb->mbxCommand = MBX_UNREG_VPI; mb->mbxCommand = MBX_UNREG_VPI;
mb->mbxOwner = OWN_HOST; mb->mbxOwner = OWN_HOST;
...@@ -1850,7 +1853,7 @@ lpfc_init_vpi(struct lpfc_hba *phba, struct lpfcMboxq *mbox, uint16_t vpi) ...@@ -1850,7 +1853,7 @@ lpfc_init_vpi(struct lpfc_hba *phba, struct lpfcMboxq *mbox, uint16_t vpi)
/** /**
* lpfc_unreg_vfi - Initialize the UNREG_VFI mailbox command * lpfc_unreg_vfi - Initialize the UNREG_VFI mailbox command
* @mbox: pointer to lpfc mbox command to initialize. * @mbox: pointer to lpfc mbox command to initialize.
* @vfi: VFI to be unregistered. * @vport: vport associated with the VF.
* *
* The UNREG_VFI mailbox command causes the SLI Host to put a virtual fabric * The UNREG_VFI mailbox command causes the SLI Host to put a virtual fabric
* (logical NPort) into the inactive state. The SLI Host must have logged out * (logical NPort) into the inactive state. The SLI Host must have logged out
...@@ -1859,11 +1862,12 @@ lpfc_init_vpi(struct lpfc_hba *phba, struct lpfcMboxq *mbox, uint16_t vpi) ...@@ -1859,11 +1862,12 @@ lpfc_init_vpi(struct lpfc_hba *phba, struct lpfcMboxq *mbox, uint16_t vpi)
* fabric inactive. * fabric inactive.
**/ **/
void void
lpfc_unreg_vfi(struct lpfcMboxq *mbox, uint16_t vfi) lpfc_unreg_vfi(struct lpfcMboxq *mbox, struct lpfc_vport *vport)
{ {
memset(mbox, 0, sizeof(*mbox)); memset(mbox, 0, sizeof(*mbox));
bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_UNREG_VFI); bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_UNREG_VFI);
bf_set(lpfc_unreg_vfi_vfi, &mbox->u.mqe.un.unreg_vfi, vfi); bf_set(lpfc_unreg_vfi_vfi, &mbox->u.mqe.un.unreg_vfi,
vport->vfi + vport->phba->vfi_base);
} }
/** /**
......
This diff is collapsed.
...@@ -113,7 +113,7 @@ typedef struct lpfcMboxq { ...@@ -113,7 +113,7 @@ typedef struct lpfcMboxq {
return */ return */
#define MBX_NOWAIT 2 /* issue command then return immediately */ #define MBX_NOWAIT 2 /* issue command then return immediately */
#define LPFC_MAX_RING_MASK 4 /* max num of rctl/type masks allowed per #define LPFC_MAX_RING_MASK 5 /* max num of rctl/type masks allowed per
ring */ ring */
#define LPFC_MAX_RING 4 /* max num of SLI rings used by driver */ #define LPFC_MAX_RING 4 /* max num of SLI rings used by driver */
......
...@@ -58,6 +58,11 @@ ...@@ -58,6 +58,11 @@
#define LPFC_FCOE_FKA_ADV_PER 0 #define LPFC_FCOE_FKA_ADV_PER 0
#define LPFC_FCOE_FIP_PRIORITY 0x80 #define LPFC_FCOE_FIP_PRIORITY 0x80
#define sli4_sid_from_fc_hdr(fc_hdr) \
((fc_hdr)->fh_s_id[0] << 16 | \
(fc_hdr)->fh_s_id[1] << 8 | \
(fc_hdr)->fh_s_id[2])
enum lpfc_sli4_queue_type { enum lpfc_sli4_queue_type {
LPFC_EQ, LPFC_EQ,
LPFC_GCQ, LPFC_GCQ,
......
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