Skip to content

Commit

Permalink
nvmf: support oacs in cdata_init callback
Browse files Browse the repository at this point in the history
Later, we'll advertise shadow doorbell support; add this to the
->cdata_init() callback.

Signed-off-by: John Levon <[email protected]>
Change-Id: Id00ba82508b323902493fe108d7a2561e8c859cc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11785
Tested-by: SPDK CI Jenkins <[email protected]>
Community-CI: Broadcom CI <[email protected]>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <[email protected]>
Reviewed-by: Changpeng Liu <[email protected]>
  • Loading branch information
jlevon authored and tomzawadzki committed Mar 24, 2022
1 parent f25c4c8 commit 7d8bbf0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 33 deletions.
68 changes: 35 additions & 33 deletions include/spdk/nvme_spec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions include/spdk/nvmf_transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions lib/nvmf/ctrlr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7d8bbf0

Please sign in to comment.