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>
17 /* default dev loss time (seconds) before transport tears down ctrl */
18 #define NVME_FC_DEV_LOSS_TMO 30
20 #define NVME_ATIO_CMD_OFF 32
21 #define NVME_FIRST_PACKET_CMDLEN (64 - NVME_ATIO_CMD_OFF)
22 #define Q2T_NVME_NUM_TAGS 2048
23 #define QLA_MAX_FC_SEGMENTS 64
32 struct nvmefc_ls_req
*fd
;
33 struct work_struct ls_work
;
34 struct work_struct abort_work
;
38 struct qla_nvme_rport
{
39 struct list_head list
;
40 struct fc_port
*fcport
;
43 #define COMMAND_NVME 0x88 /* Command Type FC-NVMe IOCB */
45 uint8_t entry_type
; /* Entry type. */
46 uint8_t entry_count
; /* Entry count. */
47 uint8_t sys_define
; /* System defined. */
48 uint8_t entry_status
; /* Entry Status. */
50 uint32_t handle
; /* System handle. */
51 uint16_t nport_handle
; /* N_PORT handle. */
52 uint16_t timeout
; /* Command timeout. */
54 uint16_t dseg_count
; /* Data segment count. */
55 uint16_t nvme_rsp_dsd_len
; /* NVMe RSP DSD length */
59 uint16_t control_flags
; /* Control Flags */
60 #define CF_NVME_FIRST_BURST_ENABLE BIT_11
61 #define CF_DIF_SEG_DESCR_ENABLE BIT_3
62 #define CF_DATA_SEG_DESCR_ENABLE BIT_2
63 #define CF_READ_DATA BIT_1
64 #define CF_WRITE_DATA BIT_0
66 uint16_t nvme_cmnd_dseg_len
; /* Data segment length. */
67 uint32_t nvme_cmnd_dseg_address
[2]; /* Data segment address. */
68 uint32_t nvme_rsp_dseg_address
[2]; /* Data segment address. */
70 uint32_t byte_count
; /* Total byte count. */
72 uint8_t port_id
[3]; /* PortID of destination port. */
75 uint32_t nvme_data_dseg_address
[2]; /* Data segment address. */
76 uint32_t nvme_data_dseg_len
; /* Data segment length. */
79 #define PT_LS4_REQUEST 0x89 /* Link Service pass-through IOCB (request) */
80 struct pt_ls4_request
{
87 uint16_t nport_handle
;
88 uint16_t tx_dseg_count
;
92 uint16_t control_flags
;
93 #define CF_LS4_SHIFT 13
94 #define CF_LS4_ORIGINATOR 0
95 #define CF_LS4_RESPONDER 1
96 #define CF_LS4_RESPONDER_TERM 2
98 uint16_t rx_dseg_count
;
100 uint32_t exchange_address
;
102 uint32_t rx_byte_count
;
103 uint32_t tx_byte_count
;
104 uint32_t dseg0_address
[2];
106 uint32_t dseg1_address
[2];
110 #define PT_LS4_UNSOL 0x56 /* pass-up unsolicited rec FC-NVMe request */
111 struct pt_ls4_rx_unsol
{
119 uint16_t nport_handle
;
122 uint32_t exchange_address
;
136 #define PT_LS4_PAYLOAD_OFFSET 0x2c
137 #define PT_LS4_FIRST_PACKET_LEN 20
143 * Global functions prototype in qla_nvme.c source file.
145 int qla_nvme_register_hba(struct scsi_qla_host
*);
146 int qla_nvme_register_remote(struct scsi_qla_host
*, struct fc_port
*);
147 void qla_nvme_delete(struct scsi_qla_host
*);
148 void qla_nvme_abort(struct qla_hw_data
*, struct srb
*sp
, int res
);
149 void qla24xx_nvme_ls4_iocb(struct scsi_qla_host
*, struct pt_ls4_request
*,
151 void qla24xx_async_gffid_sp_done(void *, int);