2020-09-08 12:34:48 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2017-06-21 20:48:43 +00:00
|
|
|
/*
|
|
|
|
* QLogic Fibre Channel HBA Driver
|
|
|
|
* Copyright (c) 2003-2017 QLogic Corporation
|
|
|
|
*/
|
|
|
|
#ifndef __QLA_NVME_H
|
|
|
|
#define __QLA_NVME_H
|
|
|
|
|
|
|
|
#include <uapi/scsi/fc/fc_fs.h>
|
|
|
|
#include <uapi/scsi/fc/fc_els.h>
|
|
|
|
#include <linux/nvme-fc-driver.h>
|
|
|
|
|
2017-07-21 16:32:24 +00:00
|
|
|
#include "qla_def.h"
|
2019-04-17 21:44:38 +00:00
|
|
|
#include "qla_dsd.h"
|
2017-07-21 16:32:24 +00:00
|
|
|
|
2017-06-21 20:48:43 +00:00
|
|
|
#define NVME_ATIO_CMD_OFF 32
|
|
|
|
#define NVME_FIRST_PACKET_CMDLEN (64 - NVME_ATIO_CMD_OFF)
|
|
|
|
#define Q2T_NVME_NUM_TAGS 2048
|
|
|
|
#define QLA_MAX_FC_SEGMENTS 64
|
|
|
|
|
2017-07-21 16:32:24 +00:00
|
|
|
struct scsi_qla_host;
|
|
|
|
struct qla_hw_data;
|
|
|
|
struct req_que;
|
2017-06-21 20:48:43 +00:00
|
|
|
struct srb;
|
2017-07-21 16:32:24 +00:00
|
|
|
|
2017-06-21 20:48:43 +00:00
|
|
|
struct nvme_private {
|
|
|
|
struct srb *sp;
|
|
|
|
struct nvmefc_ls_req *fd;
|
|
|
|
struct work_struct ls_work;
|
2018-03-21 06:09:33 +00:00
|
|
|
struct work_struct abort_work;
|
2017-06-21 20:48:43 +00:00
|
|
|
int comp_status;
|
2019-06-21 16:50:24 +00:00
|
|
|
spinlock_t cmd_lock;
|
2017-06-21 20:48:43 +00:00
|
|
|
};
|
|
|
|
|
2018-03-21 06:09:32 +00:00
|
|
|
struct qla_nvme_rport {
|
2017-06-21 20:48:43 +00:00
|
|
|
struct fc_port *fcport;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define COMMAND_NVME 0x88 /* Command Type FC-NVMe IOCB */
|
|
|
|
struct cmd_nvme {
|
|
|
|
uint8_t entry_type; /* Entry type. */
|
|
|
|
uint8_t entry_count; /* Entry count. */
|
|
|
|
uint8_t sys_define; /* System defined. */
|
|
|
|
uint8_t entry_status; /* Entry Status. */
|
|
|
|
|
|
|
|
uint32_t handle; /* System handle. */
|
2020-05-18 21:17:11 +00:00
|
|
|
__le16 nport_handle; /* N_PORT handle. */
|
|
|
|
__le16 timeout; /* Command timeout. */
|
2017-06-21 20:48:43 +00:00
|
|
|
|
2020-05-18 21:17:11 +00:00
|
|
|
__le16 dseg_count; /* Data segment count. */
|
|
|
|
__le16 nvme_rsp_dsd_len; /* NVMe RSP DSD length */
|
2017-06-21 20:48:43 +00:00
|
|
|
|
|
|
|
uint64_t rsvd;
|
|
|
|
|
2020-05-18 21:17:11 +00:00
|
|
|
__le16 control_flags; /* Control Flags */
|
2020-09-04 04:51:27 +00:00
|
|
|
#define CF_ADMIN_ASYNC_EVENT BIT_13
|
2019-02-15 22:37:13 +00:00
|
|
|
#define CF_NVME_FIRST_BURST_ENABLE BIT_11
|
2017-06-21 20:48:43 +00:00
|
|
|
#define CF_DIF_SEG_DESCR_ENABLE BIT_3
|
|
|
|
#define CF_DATA_SEG_DESCR_ENABLE BIT_2
|
|
|
|
#define CF_READ_DATA BIT_1
|
|
|
|
#define CF_WRITE_DATA BIT_0
|
|
|
|
|
2020-05-18 21:17:11 +00:00
|
|
|
__le16 nvme_cmnd_dseg_len; /* Data segment length. */
|
2019-04-17 21:44:39 +00:00
|
|
|
__le64 nvme_cmnd_dseg_address __packed;/* Data segment address. */
|
|
|
|
__le64 nvme_rsp_dseg_address __packed; /* Data segment address. */
|
2017-06-21 20:48:43 +00:00
|
|
|
|
2020-05-18 21:17:11 +00:00
|
|
|
__le32 byte_count; /* Total byte count. */
|
2017-06-21 20:48:43 +00:00
|
|
|
|
|
|
|
uint8_t port_id[3]; /* PortID of destination port. */
|
|
|
|
uint8_t vp_index;
|
|
|
|
|
2019-04-17 21:44:38 +00:00
|
|
|
struct dsd64 nvme_dsd;
|
2017-06-21 20:48:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define PT_LS4_REQUEST 0x89 /* Link Service pass-through IOCB (request) */
|
|
|
|
struct pt_ls4_request {
|
|
|
|
uint8_t entry_type;
|
|
|
|
uint8_t entry_count;
|
|
|
|
uint8_t sys_define;
|
|
|
|
uint8_t entry_status;
|
|
|
|
uint32_t handle;
|
2020-05-18 21:17:11 +00:00
|
|
|
__le16 status;
|
|
|
|
__le16 nport_handle;
|
|
|
|
__le16 tx_dseg_count;
|
2017-06-21 20:48:43 +00:00
|
|
|
uint8_t vp_index;
|
|
|
|
uint8_t rsvd;
|
2020-05-18 21:17:11 +00:00
|
|
|
__le16 timeout;
|
|
|
|
__le16 control_flags;
|
2017-06-21 20:48:43 +00:00
|
|
|
#define CF_LS4_SHIFT 13
|
|
|
|
#define CF_LS4_ORIGINATOR 0
|
|
|
|
#define CF_LS4_RESPONDER 1
|
|
|
|
#define CF_LS4_RESPONDER_TERM 2
|
|
|
|
|
2020-05-18 21:17:11 +00:00
|
|
|
__le16 rx_dseg_count;
|
|
|
|
__le16 rsvd2;
|
|
|
|
__le32 exchange_address;
|
|
|
|
__le32 rsvd3;
|
|
|
|
__le32 rx_byte_count;
|
|
|
|
__le32 tx_byte_count;
|
2019-04-17 21:44:38 +00:00
|
|
|
struct dsd64 dsd[2];
|
2017-06-21 20:48:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define PT_LS4_UNSOL 0x56 /* pass-up unsolicited rec FC-NVMe request */
|
|
|
|
struct pt_ls4_rx_unsol {
|
|
|
|
uint8_t entry_type;
|
|
|
|
uint8_t entry_count;
|
2020-05-18 21:17:11 +00:00
|
|
|
__le16 rsvd0;
|
|
|
|
__le16 rsvd1;
|
2017-06-21 20:48:43 +00:00
|
|
|
uint8_t vp_index;
|
|
|
|
uint8_t rsvd2;
|
2020-05-18 21:17:11 +00:00
|
|
|
__le16 rsvd3;
|
|
|
|
__le16 nport_handle;
|
|
|
|
__le16 frame_size;
|
|
|
|
__le16 rsvd4;
|
|
|
|
__le32 exchange_address;
|
2017-06-21 20:48:43 +00:00
|
|
|
uint8_t d_id[3];
|
|
|
|
uint8_t r_ctl;
|
2019-08-09 03:01:58 +00:00
|
|
|
be_id_t s_id;
|
2017-06-21 20:48:43 +00:00
|
|
|
uint8_t cs_ctl;
|
|
|
|
uint8_t f_ctl[3];
|
|
|
|
uint8_t type;
|
2020-05-18 21:17:11 +00:00
|
|
|
__le16 seq_cnt;
|
2017-06-21 20:48:43 +00:00
|
|
|
uint8_t df_ctl;
|
|
|
|
uint8_t seq_id;
|
2020-05-18 21:17:11 +00:00
|
|
|
__le16 rx_id;
|
|
|
|
__le16 ox_id;
|
|
|
|
__le32 param;
|
|
|
|
__le32 desc0;
|
2017-06-21 20:48:43 +00:00
|
|
|
#define PT_LS4_PAYLOAD_OFFSET 0x2c
|
|
|
|
#define PT_LS4_FIRST_PACKET_LEN 20
|
2020-05-18 21:17:11 +00:00
|
|
|
__le32 desc_len;
|
|
|
|
__le32 payload[3];
|
2017-06-21 20:48:43 +00:00
|
|
|
};
|
2017-07-21 16:32:24 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Global functions prototype in qla_nvme.c source file.
|
|
|
|
*/
|
2018-08-02 20:16:57 +00:00
|
|
|
int qla_nvme_register_hba(struct scsi_qla_host *);
|
2017-07-21 16:32:24 +00:00
|
|
|
int qla_nvme_register_remote(struct scsi_qla_host *, struct fc_port *);
|
|
|
|
void qla_nvme_delete(struct scsi_qla_host *);
|
|
|
|
void qla24xx_nvme_ls4_iocb(struct scsi_qla_host *, struct pt_ls4_request *,
|
|
|
|
struct req_que *);
|
2019-08-09 03:02:04 +00:00
|
|
|
void qla24xx_async_gffid_sp_done(struct srb *sp, int);
|
2017-06-21 20:48:43 +00:00
|
|
|
#endif
|