1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * QLogic Fibre Channel HBA Driver
4 * Copyright (c) 2003-2017 QLogic Corporation
9 #include <uapi/scsi/fc/fc_fs.h>
10 #include <uapi/scsi/fc/fc_els.h>
11 #include <linux/nvme-fc-driver.h>
16 #define NVME_ATIO_CMD_OFF 32
17 #define NVME_FIRST_PACKET_CMDLEN (64 - NVME_ATIO_CMD_OFF)
18 #define Q2T_NVME_NUM_TAGS 2048
19 #define QLA_MAX_FC_SEGMENTS 64
28 struct nvmefc_ls_req
*fd
;
29 struct work_struct ls_work
;
30 struct work_struct abort_work
;
35 struct qla_nvme_rport
{
36 struct fc_port
*fcport
;
39 #define COMMAND_NVME 0x88 /* Command Type FC-NVMe IOCB */
41 uint8_t entry_type
; /* Entry type. */
42 uint8_t entry_count
; /* Entry count. */
43 uint8_t sys_define
; /* System defined. */
44 uint8_t entry_status
; /* Entry Status. */
46 uint32_t handle
; /* System handle. */
47 __le16 nport_handle
; /* N_PORT handle. */
48 __le16 timeout
; /* Command timeout. */
50 __le16 dseg_count
; /* Data segment count. */
51 __le16 nvme_rsp_dsd_len
; /* NVMe RSP DSD length */
55 __le16 control_flags
; /* Control Flags */
56 #define CF_ADMIN_ASYNC_EVENT BIT_13
57 #define CF_NVME_FIRST_BURST_ENABLE BIT_11
58 #define CF_DIF_SEG_DESCR_ENABLE BIT_3
59 #define CF_DATA_SEG_DESCR_ENABLE BIT_2
60 #define CF_READ_DATA BIT_1
61 #define CF_WRITE_DATA BIT_0
63 __le16 nvme_cmnd_dseg_len
; /* Data segment length. */
64 __le64 nvme_cmnd_dseg_address __packed
;/* Data segment address. */
65 __le64 nvme_rsp_dseg_address __packed
; /* Data segment address. */
67 __le32 byte_count
; /* Total byte count. */
69 uint8_t port_id
[3]; /* PortID of destination port. */
72 struct dsd64 nvme_dsd
;
75 #define PT_LS4_REQUEST 0x89 /* Link Service pass-through IOCB (request) */
76 struct pt_ls4_request
{
89 #define CF_LS4_SHIFT 13
90 #define CF_LS4_ORIGINATOR 0
91 #define CF_LS4_RESPONDER 1
92 #define CF_LS4_RESPONDER_TERM 2
96 __le32 exchange_address
;
103 #define PT_LS4_UNSOL 0x56 /* pass-up unsolicited rec FC-NVMe request */
104 struct pt_ls4_rx_unsol
{
115 __le32 exchange_address
;
129 #define PT_LS4_PAYLOAD_OFFSET 0x2c
130 #define PT_LS4_FIRST_PACKET_LEN 20
136 * Global functions prototype in qla_nvme.c source file.
138 int qla_nvme_register_hba(struct scsi_qla_host
*);
139 int qla_nvme_register_remote(struct scsi_qla_host
*, struct fc_port
*);
140 void qla_nvme_delete(struct scsi_qla_host
*);
141 void qla24xx_nvme_ls4_iocb(struct scsi_qla_host
*, struct pt_ls4_request
*,
143 void qla24xx_async_gffid_sp_done(struct srb
*sp
, int);