2 * QLogic Fibre Channel HBA Driver
3 * Copyright (c) 2003-2017 QLogic Corporation
5 * See LICENSE.qla2xxx for copyright and licensing details.
10 #include <linux/blk-mq.h>
11 #include <uapi/scsi/fc/fc_fs.h>
12 #include <uapi/scsi/fc/fc_els.h>
13 #include <linux/nvme-fc-driver.h>
15 #define NVME_ATIO_CMD_OFF 32
16 #define NVME_FIRST_PACKET_CMDLEN (64 - NVME_ATIO_CMD_OFF)
17 #define Q2T_NVME_NUM_TAGS 2048
18 #define QLA_MAX_FC_SEGMENTS 64
23 struct nvmefc_ls_req *fd;
24 struct work_struct ls_work;
29 struct nvme_fc_port_info req;
30 struct list_head list;
31 struct fc_port *fcport;
34 #define COMMAND_NVME 0x88 /* Command Type FC-NVMe IOCB */
36 uint8_t entry_type; /* Entry type. */
37 uint8_t entry_count; /* Entry count. */
38 uint8_t sys_define; /* System defined. */
39 uint8_t entry_status; /* Entry Status. */
41 uint32_t handle; /* System handle. */
42 uint16_t nport_handle; /* N_PORT handle. */
43 uint16_t timeout; /* Command timeout. */
45 uint16_t dseg_count; /* Data segment count. */
46 uint16_t nvme_rsp_dsd_len; /* NVMe RSP DSD length */
50 uint16_t control_flags; /* Control Flags */
51 #define CF_NVME_ENABLE BIT_9
52 #define CF_DIF_SEG_DESCR_ENABLE BIT_3
53 #define CF_DATA_SEG_DESCR_ENABLE BIT_2
54 #define CF_READ_DATA BIT_1
55 #define CF_WRITE_DATA BIT_0
57 uint16_t nvme_cmnd_dseg_len; /* Data segment length. */
58 uint32_t nvme_cmnd_dseg_address[2]; /* Data segment address. */
59 uint32_t nvme_rsp_dseg_address[2]; /* Data segment address. */
61 uint32_t byte_count; /* Total byte count. */
63 uint8_t port_id[3]; /* PortID of destination port. */
66 uint32_t nvme_data_dseg_address[2]; /* Data segment address. */
67 uint32_t nvme_data_dseg_len; /* Data segment length. */
70 #define PT_LS4_REQUEST 0x89 /* Link Service pass-through IOCB (request) */
71 struct pt_ls4_request {
78 uint16_t nport_handle;
79 uint16_t tx_dseg_count;
83 uint16_t control_flags;
84 #define CF_LS4_SHIFT 13
85 #define CF_LS4_ORIGINATOR 0
86 #define CF_LS4_RESPONDER 1
87 #define CF_LS4_RESPONDER_TERM 2
89 uint16_t rx_dseg_count;
91 uint32_t exchange_address;
93 uint32_t rx_byte_count;
94 uint32_t tx_byte_count;
95 uint32_t dseg0_address[2];
97 uint32_t dseg1_address[2];
101 #define PT_LS4_UNSOL 0x56 /* pass-up unsolicited rec FC-NVMe request */
102 struct pt_ls4_rx_unsol {
110 uint16_t nport_handle;
113 uint32_t exchange_address;
127 #define PT_LS4_PAYLOAD_OFFSET 0x2c
128 #define PT_LS4_FIRST_PACKET_LEN 20