nvme: Remove probe_info, just use transport_id

The probe_info was reduced to just containing a
transport_id, so remove probe_info entirely.

Change-Id: Ica9a22d126cd14e282decd3eea1a0afe0460f099
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2016-12-09 15:09:28 -07:00 committed by Daniel Verkamp
parent 6c2e170dc7
commit 32e838af3c
25 changed files with 129 additions and 143 deletions

View File

@ -334,13 +334,13 @@ spdk_nvmf_parse_addr(char *listen_addr, char **host, char **port)
} }
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
struct spdk_nvmf_probe_ctx *ctx = cb_ctx; struct spdk_nvmf_probe_ctx *ctx = cb_ctx;
struct spdk_pci_addr pci_addr; struct spdk_pci_addr pci_addr;
if (spdk_pci_addr_parse(&pci_addr, probe_info->trid.traddr)) { if (spdk_pci_addr_parse(&pci_addr, trid->traddr)) {
return false; return false;
} }
@ -358,7 +358,7 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
struct spdk_nvmf_probe_ctx *ctx = cb_ctx; struct spdk_nvmf_probe_ctx *ctx = cb_ctx;
@ -367,15 +367,15 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
int numa_node = -1; int numa_node = -1;
struct spdk_pci_addr pci_addr; struct spdk_pci_addr pci_addr;
spdk_pci_addr_parse(&pci_addr, probe_info->trid.traddr); spdk_pci_addr_parse(&pci_addr, trid->traddr);
SPDK_NOTICELOG("Attaching NVMe device %p at %s to subsystem %s\n", SPDK_NOTICELOG("Attaching NVMe device %p at %s to subsystem %s\n",
ctrlr, ctrlr,
probe_info->trid.traddr, trid->traddr,
spdk_nvmf_subsystem_get_nqn(ctx->app_subsystem->subsystem)); spdk_nvmf_subsystem_get_nqn(ctx->app_subsystem->subsystem));
snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/numa_node", snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/numa_node",
probe_info->trid.traddr); trid->traddr);
numa_node = spdk_get_numa_node_value(path); numa_node = spdk_get_numa_node_value(path);
if (numa_node >= 0) { if (numa_node >= 0) {

View File

@ -853,22 +853,22 @@ register_workers(void)
} }
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
/* Update with user specified arbitration configuration */ /* Update with user specified arbitration configuration */
opts->arb_mechanism = g_arbitration.arbitration_mechanism; opts->arb_mechanism = g_arbitration.arbitration_mechanism;
printf("Attaching to %s\n", probe_info->trid.traddr); printf("Attaching to %s\n", trid->traddr);
return true; return true;
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
printf("Attached to %s\n", probe_info->trid.traddr); printf("Attached to %s\n", trid->traddr);
/* Update with actual arbitration configuration in use */ /* Update with actual arbitration configuration in use */
g_arbitration.arbitration_mechanism = opts->arb_mechanism; g_arbitration.arbitration_mechanism = opts->arb_mechanism;

View File

@ -87,7 +87,7 @@ struct spdk_fio_thread {
}; };
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
struct fio_file *f; struct fio_file *f;
@ -96,7 +96,7 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
int rc; int rc;
struct spdk_pci_addr pci_addr; struct spdk_pci_addr pci_addr;
if (spdk_pci_addr_parse(&pci_addr, probe_info->trid.traddr)) { if (spdk_pci_addr_parse(&pci_addr, trid->traddr)) {
return false; return false;
} }
@ -119,7 +119,7 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
struct thread_data *td = cb_ctx; struct thread_data *td = cb_ctx;
@ -130,7 +130,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
unsigned int i; unsigned int i;
struct spdk_pci_addr pci_addr; struct spdk_pci_addr pci_addr;
spdk_pci_addr_parse(&pci_addr, probe_info->trid.traddr); spdk_pci_addr_parse(&pci_addr, trid->traddr);
/* Create an fio_ctrlr and add it to the list */ /* Create an fio_ctrlr and add it to the list */
fio_ctrlr = calloc(1, sizeof(*fio_ctrlr)); fio_ctrlr = calloc(1, sizeof(*fio_ctrlr));

View File

@ -238,16 +238,16 @@ hello_world(void)
} }
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
printf("Attaching to %s\n", probe_info->trid.traddr); printf("Attaching to %s\n", trid->traddr);
return true; return true;
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
int nsid, num_ns; int nsid, num_ns;
@ -260,7 +260,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
exit(1); exit(1);
} }
printf("Attached to %s\n", probe_info->trid.traddr); printf("Attached to %s\n", trid->traddr);
snprintf(entry->name, sizeof(entry->name), "%-20.20s (%-20.20s)", cdata->mn, cdata->sn); snprintf(entry->name, sizeof(entry->name), "%-20.20s (%-20.20s)", cdata->mn, cdata->sn);

View File

@ -262,19 +262,19 @@ print_stats(void)
} }
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
printf("Attaching to %s\n", probe_info->trid.traddr); printf("Attaching to %s\n", trid->traddr);
return true; return true;
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
printf("Attached to %s\n", probe_info->trid.traddr); printf("Attached to %s\n", trid->traddr);
register_dev(ctrlr); register_dev(ctrlr);
} }

View File

@ -388,7 +388,7 @@ print_namespace(struct spdk_nvme_ns *ns)
} }
static void static void
print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_probe_info *probe_info) print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport_id *trid)
{ {
const struct spdk_nvme_ctrlr_data *cdata; const struct spdk_nvme_ctrlr_data *cdata;
union spdk_nvme_cap_register cap; union spdk_nvme_cap_register cap;
@ -409,11 +409,11 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_probe_inf
cdata = spdk_nvme_ctrlr_get_data(ctrlr); cdata = spdk_nvme_ctrlr_get_data(ctrlr);
printf("=====================================================\n"); printf("=====================================================\n");
if (probe_info->trid.trtype != SPDK_NVME_TRANSPORT_PCIE) { if (trid->trtype != SPDK_NVME_TRANSPORT_PCIE) {
printf("NVMe over Fabrics controller at %s:%s: %s\n", printf("NVMe over Fabrics controller at %s:%s: %s\n",
probe_info->trid.traddr, probe_info->trid.trsvcid, probe_info->trid.subnqn); trid->traddr, trid->trsvcid, trid->subnqn);
} else { } else {
if (spdk_pci_addr_parse(&pci_addr, probe_info->trid.traddr) != 0) { if (spdk_pci_addr_parse(&pci_addr, trid->traddr) != 0) {
return; return;
} }
@ -947,17 +947,17 @@ parse_args(int argc, char **argv)
} }
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
return true; return true;
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
print_controller(ctrlr, probe_info); print_controller(ctrlr, trid);
spdk_nvme_detach(ctrlr); spdk_nvme_detach(ctrlr);
} }

View File

@ -78,7 +78,7 @@ cmp_devs(const void *ap, const void *bp)
} }
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
return true; return true;
@ -99,7 +99,7 @@ identify_common_ns_cb(void *cb_arg, const struct spdk_nvme_cpl *cpl)
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
struct dev *dev; struct dev *dev;
@ -107,7 +107,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
/* add to dev list */ /* add to dev list */
dev = &devs[num_devs++]; dev = &devs[num_devs++];
spdk_pci_addr_parse(&dev->pci_addr, probe_info->trid.traddr); spdk_pci_addr_parse(&dev->pci_addr, trid->traddr);
dev->ctrlr = ctrlr; dev->ctrlr = ctrlr;
/* Retrieve controller data */ /* Retrieve controller data */

View File

@ -973,19 +973,19 @@ unregister_workers(void)
} }
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
struct spdk_pci_addr pci_addr; struct spdk_pci_addr pci_addr;
struct spdk_pci_device *pci_dev; struct spdk_pci_device *pci_dev;
struct spdk_pci_id pci_id; struct spdk_pci_id pci_id;
if (probe_info->trid.trtype != SPDK_NVME_TRANSPORT_PCIE) { if (trid->trtype != SPDK_NVME_TRANSPORT_PCIE) {
printf("Attaching to NVMe over Fabrics controller at %s:%s: %s\n", printf("Attaching to NVMe over Fabrics controller at %s:%s: %s\n",
probe_info->trid.traddr, probe_info->trid.trsvcid, trid->traddr, trid->trsvcid,
probe_info->trid.subnqn); trid->subnqn);
} else { } else {
if (spdk_pci_addr_parse(&pci_addr, probe_info->trid.traddr)) { if (spdk_pci_addr_parse(&pci_addr, trid->traddr)) {
return false; return false;
} }
@ -997,7 +997,7 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
pci_id = spdk_pci_device_get_id(pci_dev); pci_id = spdk_pci_device_get_id(pci_dev);
printf("Attaching to NVMe Controller at %s [%04x:%04x]\n", printf("Attaching to NVMe Controller at %s [%04x:%04x]\n",
probe_info->trid.traddr, trid->traddr,
pci_id.vendor_id, pci_id.device_id); pci_id.vendor_id, pci_id.device_id);
} }
@ -1005,19 +1005,19 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
struct spdk_pci_addr pci_addr; struct spdk_pci_addr pci_addr;
struct spdk_pci_device *pci_dev; struct spdk_pci_device *pci_dev;
struct spdk_pci_id pci_id; struct spdk_pci_id pci_id;
if (probe_info->trid.trtype != SPDK_NVME_TRANSPORT_PCIE) { if (trid->trtype != SPDK_NVME_TRANSPORT_PCIE) {
printf("Attached to NVMe over Fabrics controller at %s:%s: %s\n", printf("Attached to NVMe over Fabrics controller at %s:%s: %s\n",
probe_info->trid.traddr, probe_info->trid.trsvcid, trid->traddr, trid->trsvcid,
probe_info->trid.subnqn); trid->subnqn);
} else { } else {
if (spdk_pci_addr_parse(&pci_addr, probe_info->trid.traddr)) { if (spdk_pci_addr_parse(&pci_addr, trid->traddr)) {
return; return;
} }
@ -1029,7 +1029,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
pci_id = spdk_pci_device_get_id(pci_dev); pci_id = spdk_pci_device_get_id(pci_dev);
printf("Attached to NVMe Controller at %s [%04x:%04x]\n", printf("Attached to NVMe Controller at %s [%04x:%04x]\n",
probe_info->trid.traddr, trid->traddr,
pci_id.vendor_id, pci_id.device_id); pci_id.vendor_id, pci_id.device_id);
} }

View File

@ -362,21 +362,21 @@ reserve_controller(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair,
} }
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
return true; return true;
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
struct dev *dev; struct dev *dev;
/* add to dev list */ /* add to dev list */
dev = &devs[num_devs++]; dev = &devs[num_devs++];
spdk_pci_addr_parse(&dev->pci_addr, probe_info->trid.traddr); spdk_pci_addr_parse(&dev->pci_addr, trid->traddr);
dev->ctrlr = ctrlr; dev->ctrlr = ctrlr;
} }

View File

@ -162,14 +162,6 @@ struct spdk_nvme_transport_id {
char subnqn[SPDK_NVMF_NQN_MAX_LEN + 1]; char subnqn[SPDK_NVMF_NQN_MAX_LEN + 1];
}; };
/**
* NVMe controller information provided during spdk_nvme_probe().
*/
struct spdk_nvme_probe_info {
/* The transport identifier */
struct spdk_nvme_transport_id trid;
};
/** /**
* Determine whether the NVMe library can handle a specific NVMe over Fabrics transport type. * Determine whether the NVMe library can handle a specific NVMe over Fabrics transport type.
* *
@ -188,7 +180,7 @@ bool spdk_nvme_transport_available(enum spdk_nvme_transport_type trtype);
* provided during the attach callback. * provided during the attach callback.
* \return true to attach to this device. * \return true to attach to this device.
*/ */
typedef bool (*spdk_nvme_probe_cb)(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, typedef bool (*spdk_nvme_probe_cb)(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts); struct spdk_nvme_ctrlr_opts *opts);
/** /**
@ -197,7 +189,7 @@ typedef bool (*spdk_nvme_probe_cb)(void *cb_ctx, const struct spdk_nvme_probe_in
* \param opts NVMe controller initialization options that were actually used. Options may differ * \param opts NVMe controller initialization options that were actually used. Options may differ
* from the requested options from the probe call depending on what the controller supports. * from the requested options from the probe call depending on what the controller supports.
*/ */
typedef void (*spdk_nvme_attach_cb)(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, typedef void (*spdk_nvme_attach_cb)(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ctrlr *ctrlr,
const struct spdk_nvme_ctrlr_opts *opts); const struct spdk_nvme_ctrlr_opts *opts);

View File

@ -407,7 +407,7 @@ static const struct spdk_bdev_fn_table nvmelib_fn_table = {
}; };
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
struct nvme_probe_ctx *ctx = cb_ctx; struct nvme_probe_ctx *ctx = cb_ctx;
@ -415,12 +415,12 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
bool claim_device = false; bool claim_device = false;
struct spdk_pci_addr pci_addr; struct spdk_pci_addr pci_addr;
if (spdk_pci_addr_parse(&pci_addr, probe_info->trid.traddr)) { if (spdk_pci_addr_parse(&pci_addr, trid->traddr)) {
return false; return false;
} }
SPDK_NOTICELOG("Probing device %s\n", SPDK_NOTICELOG("Probing device %s\n",
probe_info->trid.traddr); trid->traddr);
if (ctx->controllers_remaining == 0) { if (ctx->controllers_remaining == 0) {
return false; return false;
@ -464,7 +464,7 @@ blockdev_nvme_timeout_cb(struct spdk_nvme_ctrlr *ctrlr,
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
struct nvme_probe_ctx *ctx = cb_ctx; struct nvme_probe_ctx *ctx = cb_ctx;
@ -477,7 +477,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
} }
dev->ctrlr = ctrlr; dev->ctrlr = ctrlr;
spdk_pci_addr_parse(&dev->pci_addr, probe_info->trid.traddr); spdk_pci_addr_parse(&dev->pci_addr, trid->traddr);
dev->id = nvme_controller_index++; dev->id = nvme_controller_index++;
nvme_ctrlr_initialize_blockdevs(dev, nvme_luns_per_ns, dev->id); nvme_ctrlr_initialize_blockdevs(dev, nvme_luns_per_ns, dev->id);

View File

@ -302,7 +302,7 @@ nvme_driver_init(void)
} }
int int
nvme_ctrlr_probe(struct spdk_nvme_probe_info *probe_info, void *devhandle, nvme_ctrlr_probe(const struct spdk_nvme_transport_id *trid, void *devhandle,
spdk_nvme_probe_cb probe_cb, void *cb_ctx) spdk_nvme_probe_cb probe_cb, void *cb_ctx)
{ {
struct spdk_nvme_ctrlr *ctrlr; struct spdk_nvme_ctrlr *ctrlr;
@ -310,8 +310,8 @@ nvme_ctrlr_probe(struct spdk_nvme_probe_info *probe_info, void *devhandle,
spdk_nvme_ctrlr_opts_set_defaults(&opts); spdk_nvme_ctrlr_opts_set_defaults(&opts);
if (probe_cb(cb_ctx, probe_info, &opts)) { if (probe_cb(cb_ctx, trid, &opts)) {
ctrlr = nvme_transport_ctrlr_construct(probe_info->trid.trtype, &opts, probe_info, devhandle); ctrlr = nvme_transport_ctrlr_construct(trid->trtype, &opts, trid, devhandle);
if (ctrlr == NULL) { if (ctrlr == NULL) {
SPDK_ERRLOG("Failed to construct NVMe controller\n"); SPDK_ERRLOG("Failed to construct NVMe controller\n");
return -1; return -1;
@ -375,7 +375,7 @@ nvme_init_controllers(void *cb_ctx, spdk_nvme_attach_cb attach_cb)
* that may take the driver lock, like nvme_detach(). * that may take the driver lock, like nvme_detach().
*/ */
nvme_robust_mutex_unlock(&g_spdk_nvme_driver->lock); nvme_robust_mutex_unlock(&g_spdk_nvme_driver->lock);
attach_cb(cb_ctx, &ctrlr->probe_info, ctrlr, &ctrlr->opts); attach_cb(cb_ctx, &ctrlr->trid, ctrlr, &ctrlr->opts);
nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock); nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock);
break; break;
@ -438,7 +438,7 @@ _spdk_nvme_probe(const struct spdk_nvme_transport_id *trid, void *cb_ctx,
* that may take the driver lock, like nvme_detach(). * that may take the driver lock, like nvme_detach().
*/ */
nvme_robust_mutex_unlock(&g_spdk_nvme_driver->lock); nvme_robust_mutex_unlock(&g_spdk_nvme_driver->lock);
attach_cb(cb_ctx, &ctrlr->probe_info, ctrlr, &ctrlr->opts); attach_cb(cb_ctx, &ctrlr->trid, ctrlr, &ctrlr->opts);
nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock); nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock);
} }
@ -492,7 +492,7 @@ nvme_hotplug_monitor(void *cb_ctx, spdk_nvme_probe_cb probe_cb,
bool in_list = false; bool in_list = false;
TAILQ_FOREACH(ctrlr, &g_spdk_nvme_driver->attached_ctrlrs, tailq) { TAILQ_FOREACH(ctrlr, &g_spdk_nvme_driver->attached_ctrlrs, tailq) {
if (strcmp(event.traddr, ctrlr->probe_info.trid.traddr) == 0) { if (strcmp(event.traddr, ctrlr->trid.traddr) == 0) {
in_list = true; in_list = true;
break; break;
} }

View File

@ -337,7 +337,7 @@ struct spdk_nvme_ctrlr {
/** Array of namespaces indexed by nsid - 1 */ /** Array of namespaces indexed by nsid - 1 */
struct spdk_nvme_ns *ns; struct spdk_nvme_ns *ns;
enum spdk_nvme_transport_type trtype; struct spdk_nvme_transport_id trid;
uint32_t num_ns; uint32_t num_ns;
@ -402,8 +402,6 @@ struct spdk_nvme_ctrlr {
struct spdk_nvme_ctrlr_opts opts; struct spdk_nvme_ctrlr_opts opts;
struct spdk_nvme_probe_info probe_info;
uint64_t quirks; uint64_t quirks;
/* Extra sleep time during controller initialization */ /* Extra sleep time during controller initialization */
@ -518,7 +516,7 @@ void nvme_completion_poll_cb(void *arg, const struct spdk_nvme_cpl *cpl);
int nvme_ctrlr_add_process(struct spdk_nvme_ctrlr *ctrlr, void *devhandle); int nvme_ctrlr_add_process(struct spdk_nvme_ctrlr *ctrlr, void *devhandle);
void nvme_ctrlr_free_processes(struct spdk_nvme_ctrlr *ctrlr); void nvme_ctrlr_free_processes(struct spdk_nvme_ctrlr *ctrlr);
int nvme_ctrlr_probe(struct spdk_nvme_probe_info *probe_info, void *devhandle, int nvme_ctrlr_probe(const struct spdk_nvme_transport_id *trid, void *devhandle,
spdk_nvme_probe_cb probe_cb, void *cb_ctx); spdk_nvme_probe_cb probe_cb, void *cb_ctx);
int nvme_ctrlr_construct(struct spdk_nvme_ctrlr *ctrlr); int nvme_ctrlr_construct(struct spdk_nvme_ctrlr *ctrlr);
@ -567,7 +565,7 @@ void nvme_qpair_print_completion(struct spdk_nvme_qpair *qpair, struct spdk_nvme
/* Transport specific functions */ /* Transport specific functions */
#define DECLARE_TRANSPORT(name) \ #define DECLARE_TRANSPORT(name) \
struct spdk_nvme_ctrlr *nvme_ ## name ## _ctrlr_construct(enum spdk_nvme_transport_type trtype, const struct spdk_nvme_ctrlr_opts *opts, \ struct spdk_nvme_ctrlr *nvme_ ## name ## _ctrlr_construct(enum spdk_nvme_transport_type trtype, const struct spdk_nvme_ctrlr_opts *opts, \
const struct spdk_nvme_probe_info *probe_info, void *devhandle); \ const struct spdk_nvme_transport_id *trid, void *devhandle); \
int nvme_ ## name ## _ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr); \ int nvme_ ## name ## _ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr); \
int nvme_ ## name ## _ctrlr_scan(const struct spdk_nvme_transport_id *trid, void *cb_ctx, spdk_nvme_probe_cb probe_cb, spdk_nvme_remove_cb remove_cb); \ int nvme_ ## name ## _ctrlr_scan(const struct spdk_nvme_transport_id *trid, void *cb_ctx, spdk_nvme_probe_cb probe_cb, spdk_nvme_remove_cb remove_cb); \
int nvme_ ## name ## _ctrlr_attach(enum spdk_nvme_transport_type trtype, spdk_nvme_probe_cb probe_cb, void *cb_ctx, struct spdk_pci_addr *addr); \ int nvme_ ## name ## _ctrlr_attach(enum spdk_nvme_transport_type trtype, spdk_nvme_probe_cb probe_cb, void *cb_ctx, struct spdk_pci_addr *addr); \

View File

@ -228,7 +228,7 @@ nvme_pcie_ctrlr_setup_signal(void)
static inline struct nvme_pcie_ctrlr * static inline struct nvme_pcie_ctrlr *
nvme_pcie_ctrlr(struct spdk_nvme_ctrlr *ctrlr) nvme_pcie_ctrlr(struct spdk_nvme_ctrlr *ctrlr)
{ {
assert(ctrlr->trtype == SPDK_NVME_TRANSPORT_PCIE); assert(ctrlr->trid.trtype == SPDK_NVME_TRANSPORT_PCIE);
return (struct nvme_pcie_ctrlr *)((uintptr_t)ctrlr - offsetof(struct nvme_pcie_ctrlr, ctrlr)); return (struct nvme_pcie_ctrlr *)((uintptr_t)ctrlr - offsetof(struct nvme_pcie_ctrlr, ctrlr));
} }
@ -526,7 +526,7 @@ nvme_pcie_ctrlr_construct_admin_qpair(struct spdk_nvme_ctrlr *ctrlr)
static int static int
pcie_nvme_enum_cb(void *ctx, struct spdk_pci_device *pci_dev) pcie_nvme_enum_cb(void *ctx, struct spdk_pci_device *pci_dev)
{ {
struct spdk_nvme_probe_info probe_info = {}; struct spdk_nvme_transport_id trid = {};
struct nvme_pcie_enum_ctx *enum_ctx = ctx; struct nvme_pcie_enum_ctx *enum_ctx = ctx;
struct spdk_nvme_ctrlr *ctrlr; struct spdk_nvme_ctrlr *ctrlr;
int rc = 0; int rc = 0;
@ -534,8 +534,8 @@ pcie_nvme_enum_cb(void *ctx, struct spdk_pci_device *pci_dev)
pci_addr = spdk_pci_device_get_addr(pci_dev); pci_addr = spdk_pci_device_get_addr(pci_dev);
probe_info.trid.trtype = SPDK_NVME_TRANSPORT_PCIE; trid.trtype = SPDK_NVME_TRANSPORT_PCIE;
spdk_pci_addr_fmt(probe_info.trid.traddr, sizeof(probe_info.trid.traddr), &pci_addr); spdk_pci_addr_fmt(trid.traddr, sizeof(trid.traddr), &pci_addr);
/* Verify that this controller is not already attached */ /* Verify that this controller is not already attached */
TAILQ_FOREACH(ctrlr, &g_spdk_nvme_driver->attached_ctrlrs, tailq) { TAILQ_FOREACH(ctrlr, &g_spdk_nvme_driver->attached_ctrlrs, tailq) {
@ -543,7 +543,7 @@ pcie_nvme_enum_cb(void *ctx, struct spdk_pci_device *pci_dev)
* different per each process, we compare by BDF to determine whether it is the * different per each process, we compare by BDF to determine whether it is the
* same controller. * same controller.
*/ */
if (strcmp(probe_info.trid.traddr, ctrlr->probe_info.trid.traddr) == 0) { if (strcmp(trid.traddr, ctrlr->trid.traddr) == 0) {
if (!spdk_process_is_primary()) { if (!spdk_process_is_primary()) {
rc = nvme_ctrlr_add_process(ctrlr, pci_dev); rc = nvme_ctrlr_add_process(ctrlr, pci_dev);
} }
@ -551,7 +551,7 @@ pcie_nvme_enum_cb(void *ctx, struct spdk_pci_device *pci_dev)
} }
} }
return nvme_ctrlr_probe(&probe_info, pci_dev, return nvme_ctrlr_probe(&trid, pci_dev,
enum_ctx->probe_cb, enum_ctx->cb_ctx); enum_ctx->probe_cb, enum_ctx->cb_ctx);
} }
@ -584,7 +584,7 @@ nvme_pcie_ctrlr_attach(enum spdk_nvme_transport_type trtype,
struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(enum spdk_nvme_transport_type trtype, struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(enum spdk_nvme_transport_type trtype,
const struct spdk_nvme_ctrlr_opts *opts, const struct spdk_nvme_ctrlr_opts *opts,
const struct spdk_nvme_probe_info *probe_info, const struct spdk_nvme_transport_id *trid,
void *devhandle) void *devhandle)
{ {
struct spdk_pci_device *pci_dev = devhandle; struct spdk_pci_device *pci_dev = devhandle;
@ -602,10 +602,10 @@ struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(enum spdk_nvme_transport_type
pctrlr->is_remapped = false; pctrlr->is_remapped = false;
pctrlr->ctrlr.is_removed = false; pctrlr->ctrlr.is_removed = false;
pctrlr->ctrlr.trtype = SPDK_NVME_TRANSPORT_PCIE; pctrlr->ctrlr.trid.trtype = SPDK_NVME_TRANSPORT_PCIE;
pctrlr->devhandle = devhandle; pctrlr->devhandle = devhandle;
pctrlr->ctrlr.opts = *opts; pctrlr->ctrlr.opts = *opts;
pctrlr->ctrlr.probe_info = *probe_info; memcpy(&pctrlr->ctrlr.trid, trid, sizeof(pctrlr->ctrlr.trid));
rc = nvme_pcie_ctrlr_allocate_bars(pctrlr); rc = nvme_pcie_ctrlr_allocate_bars(pctrlr);
if (rc != 0) { if (rc != 0) {

View File

@ -352,7 +352,7 @@ nvme_qpair_construct(struct spdk_nvme_qpair *qpair, uint16_t id,
qpair->qprio = qprio; qpair->qprio = qprio;
qpair->ctrlr = ctrlr; qpair->ctrlr = ctrlr;
qpair->trtype = ctrlr->trtype; qpair->trtype = ctrlr->trid.trtype;
STAILQ_INIT(&qpair->queued_req); STAILQ_INIT(&qpair->queued_req);

View File

@ -135,7 +135,7 @@ nvme_rdma_qpair(struct spdk_nvme_qpair *qpair)
static inline struct nvme_rdma_ctrlr * static inline struct nvme_rdma_ctrlr *
nvme_rdma_ctrlr(struct spdk_nvme_ctrlr *ctrlr) nvme_rdma_ctrlr(struct spdk_nvme_ctrlr *ctrlr)
{ {
assert(ctrlr->trtype == SPDK_NVME_TRANSPORT_RDMA); assert(ctrlr->trid.trtype == SPDK_NVME_TRANSPORT_RDMA);
return (struct nvme_rdma_ctrlr *)((uintptr_t)ctrlr - offsetof(struct nvme_rdma_ctrlr, ctrlr)); return (struct nvme_rdma_ctrlr *)((uintptr_t)ctrlr - offsetof(struct nvme_rdma_ctrlr, ctrlr));
} }
@ -640,8 +640,8 @@ nvme_rdma_qpair_connect(struct nvme_rdma_qpair *rqpair)
ctrlr = rqpair->qpair.ctrlr; ctrlr = rqpair->qpair.ctrlr;
memset(&sin, 0, sizeof(struct sockaddr_storage)); memset(&sin, 0, sizeof(struct sockaddr_storage));
SPDK_TRACELOG(SPDK_TRACE_DEBUG, "trsvcid is %s\n", ctrlr->probe_info.trid.trsvcid); SPDK_TRACELOG(SPDK_TRACE_DEBUG, "trsvcid is %s\n", ctrlr->trid.trsvcid);
rc = nvme_rdma_parse_addr(&sin, ctrlr->probe_info.trid.traddr, ctrlr->probe_info.trid.trsvcid); rc = nvme_rdma_parse_addr(&sin, ctrlr->trid.traddr, ctrlr->trid.trsvcid);
if (rc != 0) { if (rc != 0) {
SPDK_ERRLOG("nvme_rdma_parse_addr() failed\n"); SPDK_ERRLOG("nvme_rdma_parse_addr() failed\n");
return -1; return -1;
@ -776,7 +776,7 @@ nvme_rdma_qpair_fabric_connect(struct nvme_rdma_qpair *rqpair)
strncpy((char *)&nvmf_data->hostid, (char *)NVME_HOST_ID_DEFAULT, strncpy((char *)&nvmf_data->hostid, (char *)NVME_HOST_ID_DEFAULT,
strlen((char *)NVME_HOST_ID_DEFAULT)); strlen((char *)NVME_HOST_ID_DEFAULT));
strncpy((char *)nvmf_data->hostnqn, ctrlr->opts.hostnqn, sizeof(nvmf_data->hostnqn)); strncpy((char *)nvmf_data->hostnqn, ctrlr->opts.hostnqn, sizeof(nvmf_data->hostnqn));
strncpy((char *)nvmf_data->subnqn, ctrlr->probe_info.trid.subnqn, sizeof(nvmf_data->subnqn)); strncpy((char *)nvmf_data->subnqn, ctrlr->trid.subnqn, sizeof(nvmf_data->subnqn));
if (nvme_qpair_is_admin_queue(&rqpair->qpair)) { if (nvme_qpair_is_admin_queue(&rqpair->qpair)) {
rc = spdk_nvme_ctrlr_cmd_admin_raw(ctrlr, rc = spdk_nvme_ctrlr_cmd_admin_raw(ctrlr,
@ -1051,12 +1051,12 @@ nvme_fabrics_get_log_discovery_page(struct spdk_nvme_ctrlr *ctrlr,
/* This function must only be called while holding g_spdk_nvme_driver->lock */ /* This function must only be called while holding g_spdk_nvme_driver->lock */
int int
nvme_rdma_ctrlr_scan(const struct spdk_nvme_transport_id *trid, nvme_rdma_ctrlr_scan(const struct spdk_nvme_transport_id *discovery_trid,
void *cb_ctx, void *cb_ctx,
spdk_nvme_probe_cb probe_cb, spdk_nvme_probe_cb probe_cb,
spdk_nvme_remove_cb remove_cb) spdk_nvme_remove_cb remove_cb)
{ {
struct spdk_nvme_probe_info probe_info; struct spdk_nvme_transport_id trid;
struct spdk_nvme_ctrlr_opts discovery_opts; struct spdk_nvme_ctrlr_opts discovery_opts;
struct spdk_nvme_ctrlr *discovery_ctrlr; struct spdk_nvme_ctrlr *discovery_ctrlr;
struct spdk_nvmf_discovery_log_page *log_page; struct spdk_nvmf_discovery_log_page *log_page;
@ -1069,13 +1069,9 @@ nvme_rdma_ctrlr_scan(const struct spdk_nvme_transport_id *trid,
/* For discovery_ctrlr set the timeout to 0 */ /* For discovery_ctrlr set the timeout to 0 */
discovery_opts.keep_alive_timeout_ms = 0; discovery_opts.keep_alive_timeout_ms = 0;
probe_info.trid.trtype = SPDK_NVME_TRANSPORT_RDMA;
snprintf(probe_info.trid.subnqn, sizeof(probe_info.trid.subnqn), "%s", trid->subnqn);
snprintf(probe_info.trid.traddr, sizeof(probe_info.trid.traddr), "%s", trid->traddr);
snprintf(probe_info.trid.trsvcid, sizeof(probe_info.trid.trsvcid), "%s", trid->trsvcid);
memset(buffer, 0x0, 4096); memset(buffer, 0x0, 4096);
discovery_ctrlr = nvme_rdma_ctrlr_construct(SPDK_NVME_TRANSPORT_RDMA, &discovery_opts, &probe_info, discovery_ctrlr = nvme_rdma_ctrlr_construct(SPDK_NVME_TRANSPORT_RDMA, &discovery_opts,
discovery_trid,
NULL); NULL);
if (discovery_ctrlr == NULL) { if (discovery_ctrlr == NULL) {
return -1; return -1;
@ -1115,10 +1111,10 @@ nvme_rdma_ctrlr_scan(const struct spdk_nvme_transport_id *trid,
continue; continue;
} }
probe_info.trid.trtype = entry->trtype; trid.trtype = entry->trtype;
if (!spdk_nvme_transport_available(probe_info.trid.trtype)) { if (!spdk_nvme_transport_available(trid.trtype)) {
SPDK_WARNLOG("NVMe transport type %u not available; skipping probe\n", SPDK_WARNLOG("NVMe transport type %u not available; skipping probe\n",
probe_info.trid.trtype); trid.trtype);
continue; continue;
} }
@ -1129,22 +1125,22 @@ nvme_rdma_ctrlr_scan(const struct spdk_nvme_transport_id *trid,
continue; continue;
} }
len = end - entry->subnqn; len = end - entry->subnqn;
memcpy(probe_info.trid.subnqn, entry->subnqn, len); memcpy(trid.subnqn, entry->subnqn, len);
probe_info.trid.subnqn[len] = '\0'; trid.subnqn[len] = '\0';
/* Convert traddr to a null terminated string. */ /* Convert traddr to a null terminated string. */
len = spdk_strlen_pad(entry->traddr, sizeof(entry->traddr), ' '); len = spdk_strlen_pad(entry->traddr, sizeof(entry->traddr), ' ');
memcpy(probe_info.trid.traddr, entry->traddr, len); memcpy(trid.traddr, entry->traddr, len);
/* Convert trsvcid to a null terminated string. */ /* Convert trsvcid to a null terminated string. */
len = spdk_strlen_pad(entry->trsvcid, sizeof(entry->trsvcid), ' '); len = spdk_strlen_pad(entry->trsvcid, sizeof(entry->trsvcid), ' ');
memcpy(probe_info.trid.trsvcid, entry->trsvcid, len); memcpy(trid.trsvcid, entry->trsvcid, len);
SPDK_TRACELOG(SPDK_TRACE_DEBUG, "subnqn=%s, trtype=%u, traddr=%s, trsvcid=%s\n", SPDK_TRACELOG(SPDK_TRACE_DEBUG, "subnqn=%s, trtype=%u, traddr=%s, trsvcid=%s\n",
probe_info.trid.subnqn, probe_info.trid.trtype, trid.subnqn, trid.trtype,
probe_info.trid.traddr, probe_info.trid.trsvcid); trid.traddr, trid.trsvcid);
nvme_ctrlr_probe(&probe_info, NULL, probe_cb, cb_ctx); nvme_ctrlr_probe(&trid, NULL, probe_cb, cb_ctx);
} }
nvme_ctrlr_destruct(discovery_ctrlr); nvme_ctrlr_destruct(discovery_ctrlr);
@ -1163,7 +1159,7 @@ nvme_rdma_ctrlr_attach(enum spdk_nvme_transport_type trtype,
struct spdk_nvme_ctrlr * struct spdk_nvme_ctrlr *
nvme_rdma_ctrlr_construct(enum spdk_nvme_transport_type trtype, nvme_rdma_ctrlr_construct(enum spdk_nvme_transport_type trtype,
const struct spdk_nvme_ctrlr_opts *opts, const struct spdk_nvme_ctrlr_opts *opts,
const struct spdk_nvme_probe_info *probe_info, const struct spdk_nvme_transport_id *trid,
void *devhandle) void *devhandle)
{ {
struct nvme_rdma_ctrlr *rctrlr; struct nvme_rdma_ctrlr *rctrlr;
@ -1176,9 +1172,9 @@ struct spdk_nvme_ctrlr *
return NULL; return NULL;
} }
rctrlr->ctrlr.trtype = SPDK_NVME_TRANSPORT_RDMA; rctrlr->ctrlr.trid.trtype = SPDK_NVME_TRANSPORT_RDMA;
rctrlr->ctrlr.opts = *opts; rctrlr->ctrlr.opts = *opts;
rctrlr->ctrlr.probe_info = *probe_info; memcpy(&rctrlr->ctrlr.trid, trid, sizeof(rctrlr->ctrlr.trid));
rc = nvme_ctrlr_construct(&rctrlr->ctrlr); rc = nvme_ctrlr_construct(&rctrlr->ctrlr);
if (rc != 0) { if (rc != 0) {

View File

@ -84,10 +84,10 @@ spdk_nvme_transport_available(enum spdk_nvme_transport_type trtype)
struct spdk_nvme_ctrlr * struct spdk_nvme_ctrlr *
nvme_transport_ctrlr_construct(enum spdk_nvme_transport_type trtype, nvme_transport_ctrlr_construct(enum spdk_nvme_transport_type trtype,
const struct spdk_nvme_ctrlr_opts *opts, const struct spdk_nvme_ctrlr_opts *opts,
const struct spdk_nvme_probe_info *probe_info, const struct spdk_nvme_transport_id *trid,
void *devhandle) void *devhandle)
{ {
NVME_TRANSPORT_CALL(trtype, ctrlr_construct, (trtype, opts, probe_info, devhandle)); NVME_TRANSPORT_CALL(trtype, ctrlr_construct, (trtype, opts, trid, devhandle));
} }
int int
@ -110,68 +110,68 @@ nvme_transport_ctrlr_attach(enum spdk_nvme_transport_type trtype,
int int
nvme_transport_ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr) nvme_transport_ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr)
{ {
NVME_TRANSPORT_CALL(ctrlr->trtype, ctrlr_destruct, (ctrlr)); NVME_TRANSPORT_CALL(ctrlr->trid.trtype, ctrlr_destruct, (ctrlr));
} }
int int
nvme_transport_ctrlr_enable(struct spdk_nvme_ctrlr *ctrlr) nvme_transport_ctrlr_enable(struct spdk_nvme_ctrlr *ctrlr)
{ {
NVME_TRANSPORT_CALL(ctrlr->trtype, ctrlr_enable, (ctrlr)); NVME_TRANSPORT_CALL(ctrlr->trid.trtype, ctrlr_enable, (ctrlr));
} }
int int
nvme_transport_ctrlr_get_pci_id(struct spdk_nvme_ctrlr *ctrlr, struct spdk_pci_id *pci_id) nvme_transport_ctrlr_get_pci_id(struct spdk_nvme_ctrlr *ctrlr, struct spdk_pci_id *pci_id)
{ {
NVME_TRANSPORT_CALL(ctrlr->trtype, ctrlr_get_pci_id, (ctrlr, pci_id)); NVME_TRANSPORT_CALL(ctrlr->trid.trtype, ctrlr_get_pci_id, (ctrlr, pci_id));
} }
int int
nvme_transport_ctrlr_set_reg_4(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint32_t value) nvme_transport_ctrlr_set_reg_4(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint32_t value)
{ {
NVME_TRANSPORT_CALL(ctrlr->trtype, ctrlr_set_reg_4, (ctrlr, offset, value)); NVME_TRANSPORT_CALL(ctrlr->trid.trtype, ctrlr_set_reg_4, (ctrlr, offset, value));
} }
int int
nvme_transport_ctrlr_set_reg_8(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint64_t value) nvme_transport_ctrlr_set_reg_8(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint64_t value)
{ {
NVME_TRANSPORT_CALL(ctrlr->trtype, ctrlr_set_reg_8, (ctrlr, offset, value)); NVME_TRANSPORT_CALL(ctrlr->trid.trtype, ctrlr_set_reg_8, (ctrlr, offset, value));
} }
int int
nvme_transport_ctrlr_get_reg_4(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint32_t *value) nvme_transport_ctrlr_get_reg_4(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint32_t *value)
{ {
NVME_TRANSPORT_CALL(ctrlr->trtype, ctrlr_get_reg_4, (ctrlr, offset, value)); NVME_TRANSPORT_CALL(ctrlr->trid.trtype, ctrlr_get_reg_4, (ctrlr, offset, value));
} }
int int
nvme_transport_ctrlr_get_reg_8(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint64_t *value) nvme_transport_ctrlr_get_reg_8(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint64_t *value)
{ {
NVME_TRANSPORT_CALL(ctrlr->trtype, ctrlr_get_reg_8, (ctrlr, offset, value)); NVME_TRANSPORT_CALL(ctrlr->trid.trtype, ctrlr_get_reg_8, (ctrlr, offset, value));
} }
uint32_t uint32_t
nvme_transport_ctrlr_get_max_xfer_size(struct spdk_nvme_ctrlr *ctrlr) nvme_transport_ctrlr_get_max_xfer_size(struct spdk_nvme_ctrlr *ctrlr)
{ {
NVME_TRANSPORT_CALL(ctrlr->trtype, ctrlr_get_max_xfer_size, (ctrlr)); NVME_TRANSPORT_CALL(ctrlr->trid.trtype, ctrlr_get_max_xfer_size, (ctrlr));
} }
struct spdk_nvme_qpair * struct spdk_nvme_qpair *
nvme_transport_ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid, nvme_transport_ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid,
enum spdk_nvme_qprio qprio) enum spdk_nvme_qprio qprio)
{ {
NVME_TRANSPORT_CALL(ctrlr->trtype, ctrlr_create_io_qpair, (ctrlr, qid, qprio)); NVME_TRANSPORT_CALL(ctrlr->trid.trtype, ctrlr_create_io_qpair, (ctrlr, qid, qprio));
} }
int int
nvme_transport_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair) nvme_transport_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair)
{ {
NVME_TRANSPORT_CALL(ctrlr->trtype, ctrlr_delete_io_qpair, (ctrlr, qpair)); NVME_TRANSPORT_CALL(ctrlr->trid.trtype, ctrlr_delete_io_qpair, (ctrlr, qpair));
} }
int int
nvme_transport_ctrlr_reinit_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair) nvme_transport_ctrlr_reinit_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair)
{ {
NVME_TRANSPORT_CALL(ctrlr->trtype, ctrlr_reinit_io_qpair, (ctrlr, qpair)); NVME_TRANSPORT_CALL(ctrlr->trid.trtype, ctrlr_reinit_io_qpair, (ctrlr, qpair));
} }
int int

View File

@ -185,16 +185,16 @@ static void aer_cb(void *arg, const struct spdk_nvme_cpl *cpl)
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
printf("Attaching to %s\n", probe_info->trid.traddr); printf("Attaching to %s\n", trid->traddr);
return true; return true;
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
struct dev *dev; struct dev *dev;
@ -205,7 +205,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
dev->ctrlr = ctrlr; dev->ctrlr = ctrlr;
snprintf(dev->name, sizeof(dev->name), "%s", snprintf(dev->name, sizeof(dev->name), "%s",
probe_info->trid.traddr); trid->traddr);
printf("Attached to %s\n", dev->name); printf("Attached to %s\n", dev->name);

View File

@ -606,16 +606,16 @@ write_read_e2e_dp_tests(struct dev *dev, nvme_build_io_req_fn_t build_io_fn, con
} }
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
printf("Attaching to %s\n", probe_info->trid.traddr); printf("Attaching to %s\n", trid->traddr);
return true; return true;
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
struct dev *dev; struct dev *dev;
@ -626,7 +626,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
dev->ctrlr = ctrlr; dev->ctrlr = ctrlr;
snprintf(dev->name, sizeof(dev->name), "%s", snprintf(dev->name, sizeof(dev->name), "%s",
probe_info->trid.traddr); trid->traddr);
printf("Attached to %s\n", dev->name); printf("Attached to %s\n", dev->name);
} }

View File

@ -530,7 +530,7 @@ parse_args(int argc, char **argv)
} }
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
static uint32_t ctrlr_found = 0; static uint32_t ctrlr_found = 0;
@ -538,21 +538,21 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
if (ctrlr_found == 1) { if (ctrlr_found == 1) {
fprintf(stderr, "only attching to one controller, so skipping\n"); fprintf(stderr, "only attching to one controller, so skipping\n");
fprintf(stderr, " controller at PCI address %s\n", fprintf(stderr, " controller at PCI address %s\n",
probe_info->trid.traddr); trid->traddr);
return false; return false;
} }
ctrlr_found = 1; ctrlr_found = 1;
printf("Attaching to %s\n", probe_info->trid.traddr); printf("Attaching to %s\n", trid->traddr);
return true; return true;
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
printf("Attached to %s\n", probe_info->trid.traddr); printf("Attached to %s\n", trid->traddr);
register_ctrlr(ctrlr); register_ctrlr(ctrlr);
} }

View File

@ -508,14 +508,14 @@ register_workers(void)
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
return true; return true;
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
register_ctrlr(ctrlr); register_ctrlr(ctrlr);

View File

@ -380,16 +380,16 @@ writev_readv_tests(struct dev *dev, nvme_build_io_req_fn_t build_io_fn, const ch
} }
static bool static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr_opts *opts)
{ {
printf("Attaching to %s\n", probe_info->trid.traddr); printf("Attaching to %s\n", trid->traddr);
return true; return true;
} }
static void static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info, attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{ {
struct dev *dev; struct dev *dev;
@ -400,7 +400,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
dev->ctrlr = ctrlr; dev->ctrlr = ctrlr;
snprintf(dev->name, sizeof(dev->name), "%s", snprintf(dev->name, sizeof(dev->name), "%s",
probe_info->trid.traddr); trid->traddr);
printf("Attached to %s\n", dev->name); printf("Attached to %s\n", dev->name);
} }

View File

@ -64,7 +64,7 @@ spdk_nvme_transport_available(enum spdk_nvme_transport_type trtype)
struct spdk_nvme_ctrlr * struct spdk_nvme_ctrlr *
nvme_transport_ctrlr_construct(enum spdk_nvme_transport_type trtype, nvme_transport_ctrlr_construct(enum spdk_nvme_transport_type trtype,
const struct spdk_nvme_ctrlr_opts *opts, const struct spdk_nvme_ctrlr_opts *opts,
const struct spdk_nvme_probe_info *probe_info, const struct spdk_nvme_transport_id *trid,
void *devhandle) void *devhandle)
{ {
return NULL; return NULL;

View File

@ -59,7 +59,7 @@ __thread int nvme_thread_ioq_index = -1;
struct spdk_nvme_ctrlr * struct spdk_nvme_ctrlr *
nvme_transport_ctrlr_construct(enum spdk_nvme_transport_type trtype, nvme_transport_ctrlr_construct(enum spdk_nvme_transport_type trtype,
const struct spdk_nvme_ctrlr_opts *opts, const struct spdk_nvme_ctrlr_opts *opts,
const struct spdk_nvme_probe_info *probe_info, const struct spdk_nvme_transport_id *trid,
void *devhandle) void *devhandle)
{ {
return NULL; return NULL;

View File

@ -78,7 +78,7 @@ spdk_nvme_transport_available(enum spdk_nvme_transport_type trtype)
struct spdk_nvme_ctrlr * struct spdk_nvme_ctrlr *
nvme_transport_ctrlr_construct(enum spdk_nvme_transport_type trtype, nvme_transport_ctrlr_construct(enum spdk_nvme_transport_type trtype,
const struct spdk_nvme_ctrlr_opts *opts, const struct spdk_nvme_ctrlr_opts *opts,
const struct spdk_nvme_probe_info *probe_info, const struct spdk_nvme_transport_id *trid,
void *devhandle) void *devhandle)
{ {
return NULL; return NULL;