nvme: Make the nvme_transport_ctrlr_scan() could scan a specific device.

Change-Id: I74f7582f5175742e96268dc9c0cc83db2e1eaea0
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
This commit is contained in:
Cunyin Chang 2016-11-24 11:54:51 +08:00
parent 6ab28a201b
commit d1a37e98e6
7 changed files with 14 additions and 10 deletions

View File

@ -292,7 +292,7 @@ _spdk_nvme_probe(const struct spdk_nvme_discover_info *info, void *cb_ctx,
transport = (uint8_t)info->trtype;
}
rc = nvme_transport_ctrlr_scan(transport, probe_cb, cb_ctx, (void *)info);
rc = nvme_transport_ctrlr_scan(transport, probe_cb, cb_ctx, (void *)info, NULL);
/*
* Keep going even if one or more nvme_attach() calls failed,

View File

@ -545,7 +545,7 @@ struct spdk_nvme_ctrlr *nvme_attach(enum spdk_nvme_transport transport,
struct spdk_nvme_ctrlr *nvme_ ## name ## _ctrlr_construct(enum spdk_nvme_transport transport, const struct spdk_nvme_ctrlr_opts *opts, \
const struct spdk_nvme_probe_info *probe_info, void *devhandle); \
int nvme_ ## name ## _ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr); \
int nvme_ ## name ## _ctrlr_scan(enum spdk_nvme_transport transport, spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle); \
int nvme_ ## name ## _ctrlr_scan(enum spdk_nvme_transport transport, spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle, void *pci_address); \
int nvme_ ## name ## _ctrlr_enable(struct spdk_nvme_ctrlr *ctrlr); \
int nvme_ ## name ## _ctrlr_get_pci_id(struct spdk_nvme_ctrlr *ctrlr, struct spdk_pci_id *pci_id); \
int nvme_ ## name ## _ctrlr_set_reg_4(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint32_t value); \

View File

@ -545,14 +545,18 @@ pcie_nvme_enum_cb(void *ctx, struct spdk_pci_device *pci_dev)
int
nvme_pcie_ctrlr_scan(enum spdk_nvme_transport transport,
spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle)
spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle, void *pci_address)
{
struct nvme_pcie_enum_ctx enum_ctx;
enum_ctx.probe_cb = probe_cb;
enum_ctx.cb_ctx = cb_ctx;
return spdk_pci_enumerate(SPDK_PCI_DEVICE_NVME, pcie_nvme_enum_cb, &enum_ctx);
if (!pci_address) {
return spdk_pci_enumerate(SPDK_PCI_DEVICE_NVME, pcie_nvme_enum_cb, &enum_ctx);
} else {
return spdk_pci_device_attach(SPDK_PCI_DEVICE_NVME, pcie_nvme_enum_cb, &enum_ctx,
(struct spdk_pci_addr *)pci_address);
}
}
struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(enum spdk_nvme_transport transport,

View File

@ -1046,7 +1046,7 @@ nvme_fabrics_get_log_discovery_page(struct spdk_nvme_ctrlr *ctrlr,
/* This function must only be called while holding g_spdk_nvme_driver->lock */
int
nvme_rdma_ctrlr_scan(enum spdk_nvme_transport transport,
spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle)
spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle, void *pci_address)
{
struct spdk_nvme_discover_info *discover_info = devhandle;
struct spdk_nvme_probe_info probe_info;

View File

@ -94,9 +94,9 @@ struct spdk_nvme_ctrlr *nvme_transport_ctrlr_construct(enum spdk_nvme_transport
int
nvme_transport_ctrlr_scan(enum spdk_nvme_transport transport,
spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle)
spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle, void *pci_address)
{
NVME_TRANSPORT_CALL(transport, ctrlr_scan, (transport, probe_cb, cb_ctx, devhandle));
NVME_TRANSPORT_CALL(transport, ctrlr_scan, (transport, probe_cb, cb_ctx, devhandle, pci_address));
}
int

View File

@ -73,7 +73,7 @@ struct spdk_nvme_ctrlr *nvme_transport_ctrlr_construct(enum spdk_nvme_transport
int
nvme_transport_ctrlr_scan(enum spdk_nvme_transport transport,
spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle)
spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle, void *pci_address)
{
return 0;
}

View File

@ -164,7 +164,7 @@ nvme_ctrlr_get_ref_count(struct spdk_nvme_ctrlr *ctrlr)
int
nvme_transport_ctrlr_scan(enum spdk_nvme_transport transport,
spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle)
spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle, void *pci_address)
{
return 0;
}