^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*******************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * This file is part of the Emulex Linux Device Driver for *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Fibre Channel Host Bus Adapters. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2004-2016 Emulex. All rights reserved. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * EMULEX and SLI are trademarks of Emulex. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * www.broadcom.com *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * This program is free software; you can redistribute it and/or *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * modify it under the terms of version 2 of the GNU General *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Public License as published by the Free Software Foundation. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * This program is distributed in the hope that it will be useful. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * TO BE LEGALLY INVALID. See the GNU General Public License for *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * more details, a copy of which can be found in the file COPYING *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * included with this package. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) *******************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_SCSI_LPFC_DEBUG_FS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define CONFIG_SCSI_LPFC_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* forward declaration for LPFC_IOCB_t's use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct lpfc_hba;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct lpfc_vport;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /* Define the context types that SLI handles for abort and sums. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) typedef enum _lpfc_ctx_cmd {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) LPFC_CTX_LUN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) LPFC_CTX_TGT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) LPFC_CTX_HOST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) } lpfc_ctx_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) struct lpfc_cq_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) uint16_t hdwq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct lpfc_mcqe mcqe_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct lpfc_acqe_link acqe_link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct lpfc_acqe_fip acqe_fip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct lpfc_acqe_dcbx acqe_dcbx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct lpfc_acqe_grp5 acqe_grp5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct lpfc_acqe_fc_la acqe_fc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct lpfc_acqe_sli acqe_sli;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct lpfc_rcqe rcqe_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct sli4_wcqe_xri_aborted wcqe_axri;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) struct lpfc_wcqe_complete wcqe_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) } cqe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) /* This structure is used to handle IOCB requests / responses */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct lpfc_iocbq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) /* lpfc_iocbqs are used in double linked lists */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct list_head clist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) struct list_head dlist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) uint16_t iotag; /* pre-assigned IO tag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) uint16_t sli4_lxritag; /* logical pre-assigned XRI. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) uint16_t sli4_xritag; /* pre-assigned XRI, (OXID) tag. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) uint16_t hba_wqidx; /* index to HBA work queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) struct lpfc_cq_event cq_event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) struct lpfc_wcqe_complete wcqe_cmpl; /* WQE cmpl */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) uint64_t isr_timestamp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) union lpfc_wqe128 wqe; /* SLI-4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) IOCB_t iocb; /* SLI-3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) uint8_t rsvd2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) uint8_t priority; /* OAS priority */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) uint8_t retry; /* retry counter for IOCB cmd - if needed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) uint32_t iocb_flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define LPFC_IO_LIBDFC 1 /* libdfc iocb */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define LPFC_IO_WAKE 2 /* Synchronous I/O completed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #define LPFC_IO_WAKE_TMO LPFC_IO_WAKE /* Synchronous I/O timed out */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define LPFC_IO_FCP 4 /* FCP command -- iocbq in scsi_buf */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define LPFC_DRIVER_ABORTED 8 /* driver aborted this request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #define LPFC_IO_FABRIC 0x10 /* Iocb send using fabric scheduler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #define LPFC_DELAY_MEM_FREE 0x20 /* Defer free'ing of FC data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #define LPFC_EXCHANGE_BUSY 0x40 /* SLI4 hba reported XB in response */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define LPFC_USE_FCPWQIDX 0x80 /* Submit to specified FCPWQ index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #define DSS_SECURITY_OP 0x100 /* security IO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #define LPFC_IO_ON_TXCMPLQ 0x200 /* The IO is still on the TXCMPLQ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define LPFC_IO_DIF_PASS 0x400 /* T10 DIF IO pass-thru prot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #define LPFC_IO_DIF_STRIP 0x800 /* T10 DIF IO strip prot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #define LPFC_IO_DIF_INSERT 0x1000 /* T10 DIF IO insert prot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #define LPFC_IO_CMD_OUTSTANDING 0x2000 /* timeout handler abort window */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #define LPFC_FIP_ELS_ID_MASK 0xc000 /* ELS_ID range 0-3, non-shifted mask */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #define LPFC_FIP_ELS_ID_SHIFT 14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) #define LPFC_IO_OAS 0x10000 /* OAS FCP IO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #define LPFC_IO_FOF 0x20000 /* FOF FCP IO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #define LPFC_IO_LOOPBACK 0x40000 /* Loopback IO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) #define LPFC_PRLI_NVME_REQ 0x80000 /* This is an NVME PRLI. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #define LPFC_PRLI_FCP_REQ 0x100000 /* This is an NVME PRLI. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define LPFC_IO_NVME 0x200000 /* NVME FCP command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #define LPFC_IO_NVME_LS 0x400000 /* NVME LS command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define LPFC_IO_NVMET 0x800000 /* NVMET command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) uint32_t drvrTimeout; /* driver timeout in seconds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) struct lpfc_vport *vport;/* virtual port pointer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) void *context1; /* caller context information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) void *context2; /* caller context information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) void *context3; /* caller context information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) wait_queue_head_t *wait_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) struct lpfc_iocbq *rsp_iocb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) struct lpfcMboxq *mbox;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) struct lpfc_nodelist *ndlp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) struct lpfc_node_rrq *rrq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) } context_un;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) void (*fabric_iocb_cmpl)(struct lpfc_hba *, struct lpfc_iocbq *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) struct lpfc_iocbq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) void (*wait_iocb_cmpl)(struct lpfc_hba *, struct lpfc_iocbq *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) struct lpfc_iocbq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) void (*iocb_cmpl)(struct lpfc_hba *, struct lpfc_iocbq *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) struct lpfc_iocbq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) void (*wqe_cmpl)(struct lpfc_hba *, struct lpfc_iocbq *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) struct lpfc_wcqe_complete *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #define SLI_IOCB_RET_IOCB 1 /* Return IOCB if cmd ring full */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) #define IOCB_SUCCESS 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #define IOCB_BUSY 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) #define IOCB_ERROR 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #define IOCB_TIMEDOUT 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) #define SLI_WQE_RET_WQE 1 /* Return WQE if cmd ring full */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #define WQE_SUCCESS 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) #define WQE_BUSY 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) #define WQE_ERROR 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #define WQE_TIMEDOUT 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #define WQE_ABORTED 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) #define LPFC_MBX_WAKE 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #define LPFC_MBX_IMED_UNREG 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) typedef struct lpfcMboxq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) /* MBOXQs are used in single linked lists */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) struct list_head list; /* ptr to next mailbox command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) MAILBOX_t mb; /* Mailbox cmd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) struct lpfc_mqe mqe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) } u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) struct lpfc_vport *vport; /* virtual port pointer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) void *ctx_ndlp; /* caller ndlp information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) void *ctx_buf; /* caller buffer information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) void *context3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) uint8_t mbox_flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) uint16_t in_ext_byte_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) uint16_t out_ext_byte_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) uint8_t mbox_offset_word;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) struct lpfc_mcqe mcqe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) struct lpfc_mbx_nembed_sge_virt *sge_array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) } LPFC_MBOXQ_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) #define MBX_POLL 1 /* poll mailbox till command done, then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) return */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) #define MBX_NOWAIT 2 /* issue command then return immediately */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) #define LPFC_MAX_RING_MASK 5 /* max num of rctl/type masks allowed per
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) ring */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) #define LPFC_SLI3_MAX_RING 4 /* Max num of SLI3 rings used by driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) For SLI4, an additional ring for each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) FCP WQ will be allocated. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) struct lpfc_sli_ring;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) struct lpfc_sli_ring_mask {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) uint8_t profile; /* profile associated with ring */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) uint8_t rctl; /* rctl / type pair configured for ring */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) uint8_t type; /* rctl / type pair configured for ring */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) uint8_t rsvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) /* rcv'd unsol event */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) void (*lpfc_sli_rcv_unsol_event) (struct lpfc_hba *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) struct lpfc_sli_ring *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) struct lpfc_iocbq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) /* Structure used to hold SLI statistical counters and info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) struct lpfc_sli_ring_stat {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) uint64_t iocb_event; /* IOCB event counters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) uint64_t iocb_cmd; /* IOCB cmd issued */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) uint64_t iocb_rsp; /* IOCB rsp received */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) uint64_t iocb_cmd_delay; /* IOCB cmd ring delay */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) uint64_t iocb_cmd_full; /* IOCB cmd ring full */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) uint64_t iocb_cmd_empty; /* IOCB cmd ring is now empty */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) uint64_t iocb_rsp_full; /* IOCB rsp ring full */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) struct lpfc_sli3_ring {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) uint32_t local_getidx; /* last available cmd index (from cmdGetInx) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) uint32_t next_cmdidx; /* next_cmd index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) uint32_t rspidx; /* current index in response ring */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) uint32_t cmdidx; /* current index in command ring */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) uint16_t numCiocb; /* number of command iocb's per ring */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) uint16_t numRiocb; /* number of rsp iocb's per ring */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) uint16_t sizeCiocb; /* Size of command iocb's in this ring */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) uint16_t sizeRiocb; /* Size of response iocb's in this ring */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) uint32_t *cmdringaddr; /* virtual address for cmd rings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) uint32_t *rspringaddr; /* virtual address for rsp rings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) struct lpfc_sli4_ring {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) struct lpfc_queue *wqp; /* Pointer to associated WQ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) /* Structure used to hold SLI ring information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) struct lpfc_sli_ring {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) uint16_t flag; /* ring flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) #define LPFC_DEFERRED_RING_EVENT 0x001 /* Deferred processing a ring event */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) #define LPFC_CALL_RING_AVAILABLE 0x002 /* indicates cmd was full */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) #define LPFC_STOP_IOCB_EVENT 0x020 /* Stop processing IOCB cmds event */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) uint16_t abtsiotag; /* tracks next iotag to use for ABTS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) uint8_t rsvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) uint8_t ringno; /* ring number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) spinlock_t ring_lock; /* lock for issuing commands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) uint32_t fast_iotag; /* max fastlookup based iotag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) uint32_t iotag_ctr; /* keeps track of the next iotag to use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) uint32_t iotag_max; /* max iotag value to use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) struct list_head txq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) uint16_t txq_cnt; /* current length of queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) uint16_t txq_max; /* max length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) struct list_head txcmplq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) uint16_t txcmplq_cnt; /* current length of queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) uint16_t txcmplq_max; /* max length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) uint32_t missbufcnt; /* keep track of buffers to post */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) struct list_head postbufq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) uint16_t postbufq_cnt; /* current length of queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) uint16_t postbufq_max; /* max length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) struct list_head iocb_continueq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) uint16_t iocb_continueq_cnt; /* current length of queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) uint16_t iocb_continueq_max; /* max length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) struct list_head iocb_continue_saveq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) struct lpfc_sli_ring_mask prt[LPFC_MAX_RING_MASK];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) uint32_t num_mask; /* number of mask entries in prt array */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) void (*lpfc_sli_rcv_async_status) (struct lpfc_hba *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) struct lpfc_sli_ring *, struct lpfc_iocbq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) struct lpfc_sli_ring_stat stats; /* SLI statistical info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) /* cmd ring available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) void (*lpfc_sli_cmd_available) (struct lpfc_hba *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) struct lpfc_sli_ring *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) struct lpfc_sli3_ring sli3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) struct lpfc_sli4_ring sli4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) } sli;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) /* Structure used for configuring rings to a specific profile or rctl / type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) struct lpfc_hbq_init {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) uint32_t rn; /* Receive buffer notification */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) uint32_t entry_count; /* max # of entries in HBQ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) uint32_t headerLen; /* 0 if not profile 4 or 5 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) uint32_t logEntry; /* Set to 1 if this HBQ used for LogEntry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) uint32_t profile; /* Selection profile 0=all, 7=logentry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) uint32_t ring_mask; /* Binds HBQ to a ring e.g. Ring0=b0001,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) * ring2=b0100 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) uint32_t hbq_index; /* index of this hbq in ring .HBQs[] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) uint32_t seqlenoff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) uint32_t maxlen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) uint32_t seqlenbcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) uint32_t cmdcodeoff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) uint32_t cmdmatch[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) uint32_t mask_count; /* number of mask entries in prt array */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) struct hbq_mask hbqMasks[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) /* Non-config rings fields to keep track of buffer allocations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) uint32_t buffer_count; /* number of buffers allocated */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) uint32_t init_count; /* number to allocate when initialized */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) uint32_t add_count; /* number to allocate when starved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) } ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) /* Structure used to hold SLI statistical counters and info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) struct lpfc_sli_stat {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) uint64_t mbox_stat_err; /* Mbox cmds completed status error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) uint64_t mbox_cmd; /* Mailbox commands issued */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) uint64_t sli_intr; /* Count of Host Attention interrupts */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) uint64_t sli_prev_intr; /* Previous cnt of Host Attention interrupts */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) uint64_t sli_ips; /* Host Attention interrupts per sec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) uint32_t err_attn_event; /* Error Attn event counters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) uint32_t link_event; /* Link event counters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) uint32_t mbox_event; /* Mailbox event counters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) uint32_t mbox_busy; /* Mailbox cmd busy */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) /* Structure to store link status values when port stats are reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) struct lpfc_lnk_stat {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) uint32_t link_failure_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) uint32_t loss_of_sync_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) uint32_t loss_of_signal_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) uint32_t prim_seq_protocol_err_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) uint32_t invalid_tx_word_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) uint32_t invalid_crc_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) uint32_t error_frames;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) uint32_t link_events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) /* Structure used to hold SLI information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) struct lpfc_sli {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) uint32_t num_rings;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) uint32_t sli_flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) /* Additional sli_flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) #define LPFC_SLI_MBOX_ACTIVE 0x100 /* HBA mailbox is currently active */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) #define LPFC_SLI_ACTIVE 0x200 /* SLI in firmware is active */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) #define LPFC_PROCESS_LA 0x400 /* Able to process link attention */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) #define LPFC_BLOCK_MGMT_IO 0x800 /* Don't allow mgmt mbx or iocb cmds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) #define LPFC_MENLO_MAINT 0x1000 /* need for menl fw download */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) #define LPFC_SLI_ASYNC_MBX_BLK 0x2000 /* Async mailbox is blocked */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) #define LPFC_SLI_SUPPRESS_RSP 0x4000 /* Suppress RSP feature is supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) #define LPFC_SLI_USE_EQDR 0x8000 /* EQ Delay Register is supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) #define LPFC_QUEUE_FREE_INIT 0x10000 /* Queue freeing is in progress */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) #define LPFC_QUEUE_FREE_WAIT 0x20000 /* Hold Queue free as it is being
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) * used outside worker thread
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) struct lpfc_sli_ring *sli3_ring;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) struct lpfc_sli_stat slistat; /* SLI statistical info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) struct list_head mboxq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) uint16_t mboxq_cnt; /* current length of queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) uint16_t mboxq_max; /* max length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) LPFC_MBOXQ_t *mbox_active; /* active mboxq information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) struct list_head mboxq_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) struct timer_list mbox_tmo; /* Hold clk to timeout active mbox
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) cmd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) #define LPFC_IOCBQ_LOOKUP_INCREMENT 1024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) struct lpfc_iocbq ** iocbq_lookup; /* array to lookup IOCB by IOTAG */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) size_t iocbq_lookup_len; /* current lengs of the array */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) uint16_t last_iotag; /* last allocated IOTAG */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) time64_t stats_start; /* in seconds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) struct lpfc_lnk_stat lnk_stat_offsets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) /* Timeout for normal outstanding mbox command (Seconds) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) #define LPFC_MBOX_TMO 30
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) /* Timeout for non-flash-based outstanding sli_config mbox command (Seconds) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) #define LPFC_MBOX_SLI4_CONFIG_TMO 60
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) /* Timeout for flash-based outstanding sli_config mbox command (Seconds) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) #define LPFC_MBOX_SLI4_CONFIG_EXTENDED_TMO 300
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) /* Timeout for other flash-based outstanding mbox command (Seconds) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) #define LPFC_MBOX_TMO_FLASH_CMD 300
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) struct lpfc_io_buf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) /* Common fields */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) void *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) dma_addr_t dma_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) dma_addr_t dma_phys_sgl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) struct sli4_sge *dma_sgl; /* initial segment chunk */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) /* linked list of extra sli4_hybrid_sge */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) struct list_head dma_sgl_xtra_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) /* list head for fcp_cmd_rsp buf */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) struct list_head dma_cmd_rsp_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) struct lpfc_iocbq cur_iocbq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) struct lpfc_sli4_hdw_queue *hdwq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) uint16_t hdwq_no;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) uint16_t cpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) struct lpfc_nodelist *ndlp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) uint32_t timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) uint16_t flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) #define LPFC_SBUF_XBUSY 0x1 /* SLI4 hba reported XB on WCQE cmpl */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) #define LPFC_SBUF_BUMP_QDEPTH 0x2 /* bumped queue depth counter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) /* External DIF device IO conversions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) #define LPFC_SBUF_NORMAL_DIF 0x4 /* normal mode to insert/strip */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) #define LPFC_SBUF_PASS_DIF 0x8 /* insert/strip mode to passthru */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) #define LPFC_SBUF_NOT_POSTED 0x10 /* SGL failed post to FW. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) uint16_t status; /* From IOCB Word 7- ulpStatus */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) uint32_t result; /* From IOCB Word 4. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) uint32_t seg_cnt; /* Number of scatter-gather segments returned by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) * dma_map_sg. The driver needs this for calls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) * to dma_unmap_sg.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) unsigned long start_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) spinlock_t buf_lock; /* lock used in case of simultaneous abort */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) bool expedite; /* this is an expedite io_buf */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) /* SCSI specific fields */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) struct scsi_cmnd *pCmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) struct lpfc_rport_data *rdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) uint32_t prot_seg_cnt; /* seg_cnt's counterpart for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) * protection data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) * data and dma_handle are the kernel virtual and bus
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) * address of the dma-able buffer containing the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) * fcp_cmd, fcp_rsp and a scatter gather bde list that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) * supports the sg_tablesize value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) struct fcp_cmnd *fcp_cmnd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) struct fcp_rsp *fcp_rsp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) wait_queue_head_t *waitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) /* Used to restore any changes to protection data for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) * error injection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) void *prot_data_segment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) uint32_t prot_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) uint32_t prot_data_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) #define LPFC_INJERR_REFTAG 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) #define LPFC_INJERR_APPTAG 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) #define LPFC_INJERR_GUARD 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) /* NVME specific fields */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) struct nvmefc_fcp_req *nvmeCmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) uint16_t qidx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) uint64_t ts_cmd_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) uint64_t ts_last_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) uint64_t ts_cmd_wqput;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) uint64_t ts_isr_cmpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) uint64_t ts_data_io;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) };