ocssd: check whether ctrlr support ocssd
There isn't a standardized way to identify Open-Channel SSD, different verdors may have different conditions. Here just take the Qemu simulated OCSSD device as a start. Change-Id: I1aceaac09db438c203875bcf37badd542618bdd7 Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com> Reviewed-on: https://review.gerrithub.io/411590 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ziye Yang <optimistyzy@gmail.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jakub Radtke <jakub.radtke@intel.com>
This commit is contained in:
parent
f22755cfad
commit
5fc12ae9e2
@ -48,6 +48,14 @@ extern "C" {
|
||||
#include "spdk/nvme.h"
|
||||
#include "spdk/nvme_ocssd_spec.h"
|
||||
|
||||
/**
|
||||
* \brief Determine if OpenChannel is supported by the given NVMe controller.
|
||||
* \param ctrlr NVMe controller to check.
|
||||
*
|
||||
* \return true if support OpenChannel
|
||||
*/
|
||||
bool spdk_nvme_ctrlr_is_ocssd_supported(struct spdk_nvme_ctrlr *ctrlr);
|
||||
|
||||
/**
|
||||
* \brief Identify geometry of the given namespace.
|
||||
* \param ctrlr NVMe controller to query.
|
||||
|
@ -34,6 +34,27 @@
|
||||
#include "spdk/nvme_ocssd.h"
|
||||
#include "nvme_internal.h"
|
||||
|
||||
bool
|
||||
spdk_nvme_ctrlr_is_ocssd_supported(struct spdk_nvme_ctrlr *ctrlr)
|
||||
{
|
||||
if (ctrlr->quirks & NVME_QUIRK_OCSSD) {
|
||||
// TODO: There isn't a standardized way to identify Open-Channel SSD
|
||||
// different verdors may have different conditions.
|
||||
|
||||
/*
|
||||
* Current QEMU OpenChannel Device needs to check nsdata->vs[0].
|
||||
* Here check nsdata->vs[0] of the first namespace.
|
||||
*/
|
||||
if (ctrlr->cdata.vid == SPDK_PCI_VID_CNEXLABS) {
|
||||
if (ctrlr->num_ns && ctrlr->nsdata[0].vendor_specific[0] == 0x1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
spdk_nvme_ocssd_ctrlr_cmd_geometry(struct spdk_nvme_ctrlr *ctrlr, uint32_t nsid,
|
||||
void *payload, uint32_t payload_size,
|
||||
|
Loading…
Reference in New Issue
Block a user