nvmf/fc: FC Priority tagging and VMID support.
Add support for FC priority tagging and VMID. Signed-off-by: Naresh Gottumukkala <raju.gottumukkala@broadcom.com> Change-Id: Ic3b67e4a9bf33308fb08dedd0e2f39344d979f34 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5822 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
cfc716feb8
commit
61dfdd2a48
@ -53,6 +53,8 @@ Change the return type of function `spdk_nbd_stop` from void to int. And update
|
||||
|
||||
### nvmf
|
||||
|
||||
FC transport supported primary tagging and VMID.
|
||||
|
||||
Broadcom FC LLD driver and SPDK NVMe-oF FC transport consolidated one LLD API,
|
||||
`nvmf_fc_init_poller_queues` into another LLD API `nvmf_fc_init_q`.
|
||||
Hence updating Broadcom FC LLD driver to the latest is required.
|
||||
|
@ -55,6 +55,13 @@
|
||||
|
||||
/* END_SEQ | LAST_SEQ | Exchange Responder | SEQ init */
|
||||
#define FCNVME_F_CTL_RSP 0x990000
|
||||
#define FCNVME_F_CTL_PRIORITY_ENABLE 0x020000
|
||||
|
||||
#define FCNVME_D_FCTL_DEVICE_HDR_16_MASK 0x1
|
||||
#define FCNVME_D_FCTL_NETWORK_HDR_MASK 0x20
|
||||
#define FCNVME_D_FCTL_NETWORK_HDR_SIZE 16
|
||||
#define FCNVME_D_FCTL_ESP_HDR_MASK 0x40
|
||||
#define FCNVME_D_FCTL_ESP_HDR_SIZE 8
|
||||
|
||||
#define FCNVME_TYPE_BLS 0x0
|
||||
#define FCNVME_TYPE_FC_EXCHANGE 0x08
|
||||
@ -195,6 +202,16 @@ struct spdk_nvmf_fc_xfer_rdy_iu {
|
||||
};
|
||||
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_fc_xfer_rdy_iu) == 12, "size_mismatch");
|
||||
|
||||
/*
|
||||
* FC VM header
|
||||
*/
|
||||
struct spdk_nvmf_fc_vm_header {
|
||||
FCNVME_BE32 dst_vmid;
|
||||
FCNVME_BE32 src_vmid;
|
||||
FCNVME_BE32 rsvd0;
|
||||
FCNVME_BE32 rsvd1;
|
||||
};
|
||||
|
||||
/*
|
||||
* FC NVME Frame Header
|
||||
*/
|
||||
|
@ -1393,7 +1393,7 @@ static int
|
||||
nvmf_fc_request_execute(struct spdk_nvmf_fc_request *fc_req)
|
||||
{
|
||||
/* Allocate an XCHG if we dont use send frame for this command. */
|
||||
if (!nvmf_fc_use_send_frame(&fc_req->req)) {
|
||||
if (!nvmf_fc_use_send_frame(fc_req)) {
|
||||
fc_req->xchg = nvmf_fc_get_xri(fc_req->hwqp);
|
||||
if (!fc_req->xchg) {
|
||||
fc_req->hwqp->counters.no_xchg++;
|
||||
@ -1437,6 +1437,37 @@ nvmf_fc_request_execute(struct spdk_nvmf_fc_request *fc_req)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
nvmf_fc_set_vmid_priority(struct spdk_nvmf_fc_request *fc_req,
|
||||
struct spdk_nvmf_fc_frame_hdr *fchdr)
|
||||
{
|
||||
uint8_t df_ctl = fchdr->df_ctl;
|
||||
uint32_t f_ctl = fchdr->f_ctl;
|
||||
|
||||
/* VMID */
|
||||
if (df_ctl & FCNVME_D_FCTL_DEVICE_HDR_16_MASK) {
|
||||
struct spdk_nvmf_fc_vm_header *vhdr;
|
||||
uint32_t vmhdr_offset = 0;
|
||||
|
||||
if (df_ctl & FCNVME_D_FCTL_ESP_HDR_MASK) {
|
||||
vmhdr_offset += FCNVME_D_FCTL_ESP_HDR_SIZE;
|
||||
}
|
||||
|
||||
if (df_ctl & FCNVME_D_FCTL_NETWORK_HDR_MASK) {
|
||||
vmhdr_offset += FCNVME_D_FCTL_NETWORK_HDR_SIZE;
|
||||
}
|
||||
|
||||
vhdr = (struct spdk_nvmf_fc_vm_header *)((char *)fchdr +
|
||||
sizeof(struct spdk_nvmf_fc_frame_hdr) + vmhdr_offset);
|
||||
fc_req->app_id = from_be32(&vhdr->src_vmid);
|
||||
}
|
||||
|
||||
/* Priority */
|
||||
if ((from_be32(&f_ctl) >> 8) & FCNVME_F_CTL_PRIORITY_ENABLE) {
|
||||
fc_req->csctl = fchdr->cs_ctl;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
nvmf_fc_hwqp_handle_request(struct spdk_nvmf_fc_hwqp *hwqp, struct spdk_nvmf_fc_frame_hdr *frame,
|
||||
struct spdk_nvmf_fc_buffer_desc *buffer, uint32_t plen)
|
||||
@ -1544,6 +1575,7 @@ nvmf_fc_hwqp_handle_request(struct spdk_nvmf_fc_hwqp *hwqp, struct spdk_nvmf_fc_
|
||||
fc_req->s_id = s_id;
|
||||
fc_req->d_id = d_id;
|
||||
fc_req->csn = from_be32(&cmd_iu->cmnd_seq_num);
|
||||
nvmf_fc_set_vmid_priority(fc_req, frame);
|
||||
|
||||
nvmf_fc_record_req_trace_point(fc_req, SPDK_NVMF_FC_REQ_INIT);
|
||||
|
||||
|
@ -380,6 +380,8 @@ struct spdk_nvmf_fc_request {
|
||||
uint32_t s_id;
|
||||
uint32_t d_id;
|
||||
uint32_t csn;
|
||||
uint32_t app_id;
|
||||
uint8_t csctl;
|
||||
TAILQ_ENTRY(spdk_nvmf_fc_request) link;
|
||||
TAILQ_ENTRY(spdk_nvmf_fc_request) conn_link;
|
||||
TAILQ_ENTRY(spdk_nvmf_fc_request) fused_link;
|
||||
@ -1018,8 +1020,14 @@ nvmf_fc_advance_conn_sqhead(struct spdk_nvmf_qpair *qpair)
|
||||
}
|
||||
|
||||
static inline bool
|
||||
nvmf_fc_use_send_frame(struct spdk_nvmf_request *req)
|
||||
nvmf_fc_use_send_frame(struct spdk_nvmf_fc_request *fc_req)
|
||||
{
|
||||
struct spdk_nvmf_request *req = &fc_req->req;
|
||||
|
||||
if (fc_req->app_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For now use for only keepalives. */
|
||||
if (req->qpair->qid == 0 &&
|
||||
(req->cmd->nvme_cmd.opc == SPDK_NVME_OPC_KEEP_ALIVE)) {
|
||||
|
Loading…
Reference in New Issue
Block a user