nvmf: support oacs in cdata_init callback

Later, we'll advertise shadow doorbell support; add this to the
->cdata_init() callback.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: Id00ba82508b323902493fe108d7a2561e8c859cc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11785
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
John Levon 2021-09-02 09:37:25 +00:00 committed by Tomasz Zawadzki
parent f25c4c822c
commit 7d8bbf0007
3 changed files with 38 additions and 33 deletions

View File

@ -1872,6 +1872,40 @@ struct spdk_nvme_cdata_oncs {
uint16_t reserved9: 7;
};
struct spdk_nvme_cdata_oacs {
/* supports security send/receive commands */
uint16_t security : 1;
/* supports format nvm command */
uint16_t format : 1;
/* supports firmware activate/download commands */
uint16_t firmware : 1;
/* supports ns manage/ns attach commands */
uint16_t ns_manage : 1;
/** Supports device self-test command (SPDK_NVME_OPC_DEVICE_SELF_TEST) */
uint16_t device_self_test : 1;
/** Supports SPDK_NVME_OPC_DIRECTIVE_SEND and SPDK_NVME_OPC_DIRECTIVE_RECEIVE */
uint16_t directives : 1;
/** Supports NVMe-MI (SPDK_NVME_OPC_NVME_MI_SEND, SPDK_NVME_OPC_NVME_MI_RECEIVE) */
uint16_t nvme_mi : 1;
/** Supports SPDK_NVME_OPC_VIRTUALIZATION_MANAGEMENT */
uint16_t virtualization_management : 1;
/** Supports SPDK_NVME_OPC_DOORBELL_BUFFER_CONFIG */
uint16_t doorbell_buffer_config : 1;
/** Supports SPDK_NVME_OPC_GET_LBA_STATUS */
uint16_t get_lba_status : 1;
uint16_t oacs_rsvd : 6;
};
struct __attribute__((packed)) spdk_nvme_ctrlr_data {
/* bytes 0-255: controller capabilities and features */
@ -1966,39 +2000,7 @@ struct __attribute__((packed)) spdk_nvme_ctrlr_data {
/* bytes 256-511: admin command set attributes */
/** optional admin command support */
struct {
/* supports security send/receive commands */
uint16_t security : 1;
/* supports format nvm command */
uint16_t format : 1;
/* supports firmware activate/download commands */
uint16_t firmware : 1;
/* supports ns manage/ns attach commands */
uint16_t ns_manage : 1;
/** Supports device self-test command (SPDK_NVME_OPC_DEVICE_SELF_TEST) */
uint16_t device_self_test : 1;
/** Supports SPDK_NVME_OPC_DIRECTIVE_SEND and SPDK_NVME_OPC_DIRECTIVE_RECEIVE */
uint16_t directives : 1;
/** Supports NVMe-MI (SPDK_NVME_OPC_NVME_MI_SEND, SPDK_NVME_OPC_NVME_MI_RECEIVE) */
uint16_t nvme_mi : 1;
/** Supports SPDK_NVME_OPC_VIRTUALIZATION_MANAGEMENT */
uint16_t virtualization_management : 1;
/** Supports SPDK_NVME_OPC_DOORBELL_BUFFER_CONFIG */
uint16_t doorbell_buffer_config : 1;
/** Supports SPDK_NVME_OPC_GET_LBA_STATUS */
uint16_t get_lba_status : 1;
uint16_t oacs_rsvd : 6;
} oacs;
struct spdk_nvme_cdata_oacs oacs;
/** abort command limit */
uint8_t acl;

View File

@ -203,6 +203,7 @@ struct spdk_nvmf_ctrlr_data {
uint16_t ssvid;
/** ieee oui identifier */
uint8_t ieee[3];
struct spdk_nvme_cdata_oacs oacs;
struct spdk_nvme_cdata_oncs oncs;
struct spdk_nvme_cdata_sgls sgls;
struct spdk_nvme_cdata_nvmf_specific nvmf_specific;

View File

@ -2611,6 +2611,8 @@ static void
nvmf_ctrlr_populate_oacs(struct spdk_nvmf_ctrlr *ctrlr,
struct spdk_nvme_ctrlr_data *cdata)
{
cdata->oacs = ctrlr->cdata.oacs;
cdata->oacs.virtualization_management =
g_nvmf_custom_admin_cmd_hdlrs[SPDK_NVME_OPC_VIRTUALIZATION_MANAGEMENT].hdlr != NULL;
cdata->oacs.nvme_mi = g_nvmf_custom_admin_cmd_hdlrs[SPDK_NVME_OPC_NVME_MI_SEND].hdlr != NULL