nvmf/ctrlr: let transport can set VID SSVID and IEEE values

The nvmf library will use INTEL VID/SSVID/IEEE values by default,
each transport can overwrite them if needed.

Change-Id: I9dad521c4d080b6f0cc1aaeb4b5d5f6863c6846d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10095
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2021-11-03 22:05:41 +08:00 committed by Jim Harris
parent 632c8d5613
commit b023e638a1
4 changed files with 25 additions and 2 deletions

View File

@ -200,6 +200,12 @@ struct spdk_nvmf_listener {
*/
struct spdk_nvmf_ctrlr_data {
uint16_t kas;
/** pci vendor id */
uint16_t vid;
/** pci subsystem vendor id */
uint16_t ssvid;
/** ieee oui identifier */
uint8_t ieee[3];
struct spdk_nvme_cdata_oncs oncs;
struct spdk_nvme_cdata_sgls sgls;
struct spdk_nvme_cdata_nvmf_specific nvmf_specific;

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 10
SO_VER := 11
SO_MINOR := 0
C_SRCS = ctrlr.c ctrlr_discovery.c ctrlr_bdev.c \

View File

@ -305,6 +305,12 @@ nvmf_ctrlr_cdata_init(struct spdk_nvmf_transport *transport, struct spdk_nvmf_su
struct spdk_nvmf_ctrlr_data *cdata)
{
cdata->kas = KAS_DEFAULT_VALUE;
cdata->vid = SPDK_PCI_VID_INTEL;
cdata->ssvid = SPDK_PCI_VID_INTEL;
/* INTEL OUI */
cdata->ieee[0] = 0xe4;
cdata->ieee[1] = 0xd2;
cdata->ieee[2] = 0x5c;
cdata->oncs.reservations = 1;
cdata->sgls.supported = 1;
cdata->sgls.keyed_sgl = 1;
@ -2514,6 +2520,12 @@ spdk_nvmf_ctrlr_identify_ctrlr(struct spdk_nvmf_ctrlr *ctrlr, struct spdk_nvme_c
*/
cdata->oaes.discovery_log_change_notices = 1;
} else {
cdata->vid = ctrlr->cdata.vid;
cdata->ssvid = ctrlr->cdata.ssvid;
cdata->ieee[0] = ctrlr->cdata.ieee[0];
cdata->ieee[1] = ctrlr->cdata.ieee[1];
cdata->ieee[2] = ctrlr->cdata.ieee[2];
/*
* NVM subsystem fields (reserved for discovery subsystems)
*/

View File

@ -1884,7 +1884,7 @@ vfio_user_dev_info_fill(struct nvmf_vfio_user_transport *vu_transport,
SPDK_ERRLOG("vfu_ctx %p failed to initialize PCI\n", vfu_ctx);
return ret;
}
vfu_pci_set_id(vfu_ctx, 0x4e58, 0x0001, 0, 0);
vfu_pci_set_id(vfu_ctx, 0x4e58, 0x0001, 0x4e58, 0);
/*
* 0x02, controller uses the NVM Express programming interface
* 0x08, non-volatile memory controller
@ -2185,6 +2185,11 @@ nvmf_vfio_user_cdata_init(struct spdk_nvmf_transport *transport,
struct spdk_nvmf_subsystem *subsystem,
struct spdk_nvmf_ctrlr_data *cdata)
{
cdata->vid = 0x4e58;
cdata->ssvid = 0x4e58;
cdata->ieee[0] = 0x8d;
cdata->ieee[1] = 0x6b;
cdata->ieee[2] = 0x50;
memset(&cdata->sgls, 0, sizeof(struct spdk_nvme_cdata_sgls));
cdata->sgls.supported = SPDK_NVME_SGLS_SUPPORTED_DWORD_ALIGNED;
/* libvfio-user can only support 1 connection for now */