nvme: Add getting supported flag for controllers

New API added for upper level to get controllers'
supported flags.

Change-Id: I51e9d0e57c355fa37f092602a94f4c08deb8898c
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446091
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Chunyang Hui 2019-02-26 01:15:52 +08:00 committed by Jim Harris
parent d92a1fb4ac
commit 51ab378862
4 changed files with 31 additions and 7 deletions

View File

@ -11,6 +11,8 @@ spdk_app_start() now only accepts a single context argument.
Added asynchronous probe support. New APIs spdk_nvme_probe_async() and
spdk_nvme_probe_poll_async() were added to enable this feature.
New API spdk_nvme_ctrlr_get_flags() was added.
### raid
Added new strip_size_kb rpc param on create to replace the more ambiguous

View File

@ -308,6 +308,16 @@ struct spdk_nvme_host_id {
char hostsvcid[SPDK_NVMF_TRSVCID_MAX_LEN + 1];
};
/*
* Controller support flags
*
* Used for identifying if the controller supports these flags.
*/
enum spdk_nvme_ctrlr_flags {
SPDK_NVME_CTRLR_SGL_SUPPORTED = 0x1, /**< The SGL is supported */
SPDK_NVME_CTRLR_SECURITY_SEND_RECV_SUPPORTED = 0x2, /**< security send/receive is supported */
};
/**
* Parse the string representation of a transport ID.
*
@ -1309,6 +1319,15 @@ int spdk_nvme_ctrlr_security_receive(struct spdk_nvme_ctrlr *ctrlr, uint8_t secp
int spdk_nvme_ctrlr_security_send(struct spdk_nvme_ctrlr *ctrlr, uint8_t secp,
uint16_t spsp, uint8_t nssf, void *payload, size_t size);
/**
* Get supported flags of the controller.
*
* \param ctrlr NVMe controller to get flags.
*
* \return supported flags of this controller.
*/
uint64_t spdk_nvme_ctrlr_get_flags(struct spdk_nvme_ctrlr *ctrlr);
/**
* Attach the specified namespace to controllers.
*

View File

@ -908,6 +908,10 @@ nvme_ctrlr_identify_done(void *arg, const struct spdk_nvme_cpl *cpl)
ctrlr->max_sges = nvme_transport_ctrlr_get_max_sges(ctrlr);
}
if (ctrlr->cdata.oacs.security) {
ctrlr->flags |= SPDK_NVME_CTRLR_SECURITY_SEND_RECV_SUPPORTED;
}
nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_SET_NUM_QUEUES,
ctrlr->opts.admin_timeout_ms);
}
@ -2812,3 +2816,9 @@ spdk_nvme_ctrlr_security_send(struct spdk_nvme_ctrlr *ctrlr, uint8_t secp,
return 0;
}
uint64_t
spdk_nvme_ctrlr_get_flags(struct spdk_nvme_ctrlr *ctrlr)
{
return ctrlr->flags;
}

View File

@ -160,13 +160,6 @@ enum nvme_payload_type {
NVME_PAYLOAD_TYPE_SGL,
};
/*
* Controller support flags.
*/
enum spdk_nvme_ctrlr_flags {
SPDK_NVME_CTRLR_SGL_SUPPORTED = 0x1, /**< The SGL is supported */
};
/**
* Descriptor for a request data payload.
*/