Commit 3da43e64 authored by Ben Walker's avatar Ben Walker Committed by Daniel Verkamp
Browse files

nvme: Remove pci_addr from probe_info



This can be obtained by parsing the traddr.

Change-Id: Idaf35066cbf900c87e771a44934de99fb5420001
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 9511b2a2
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -338,13 +338,18 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
	 struct spdk_nvme_ctrlr_opts *opts)
{
	struct spdk_nvmf_probe_ctx *ctx = cb_ctx;
	struct spdk_pci_addr pci_addr;

	if (spdk_pci_addr_parse(&pci_addr, probe_info->trid.traddr)) {
		return false;
	}

	if (ctx->any && !ctx->found) {
		ctx->found = true;
		return true;
	}

	if (spdk_pci_addr_compare(&probe_info->pci_addr, &ctx->pci_addr) == 0) {
	if (spdk_pci_addr_compare(&pci_addr, &ctx->pci_addr) == 0) {
		ctx->found = true;
		return true;
	}
@@ -360,20 +365,17 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
	int rc;
	char path[MAX_STRING_LEN];
	int numa_node = -1;
	struct spdk_pci_addr pci_addr;

	spdk_pci_addr_parse(&pci_addr, probe_info->trid.traddr);

	SPDK_NOTICELOG("Attaching NVMe device %p at %x:%x:%x.%x to subsystem %s\n",
	SPDK_NOTICELOG("Attaching NVMe device %p at %s to subsystem %s\n",
		       ctrlr,
		       probe_info->pci_addr.domain,
		       probe_info->pci_addr.bus,
		       probe_info->pci_addr.dev,
		       probe_info->pci_addr.func,
		       probe_info->trid.traddr,
		       spdk_nvmf_subsystem_get_nqn(ctx->app_subsystem->subsystem));

	snprintf(path, sizeof(path), "/sys/bus/pci/devices/%04x:%02x:%02x.%1u/numa_node",
		 probe_info->pci_addr.domain,
		 probe_info->pci_addr.bus,
		 probe_info->pci_addr.dev,
		 probe_info->pci_addr.func);
	snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/numa_node",
		 probe_info->trid.traddr);

	numa_node = spdk_get_numa_node_value(path);
	if (numa_node >= 0) {
@@ -390,7 +392,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
		}
	}

	rc = nvmf_subsystem_add_ctrlr(ctx->app_subsystem->subsystem, ctrlr, &probe_info->pci_addr);
	rc = nvmf_subsystem_add_ctrlr(ctx->app_subsystem->subsystem, ctrlr, &pci_addr);
	if (rc < 0) {
		SPDK_ERRLOG("Failed to add controller to subsystem\n");
	}
+2 −10
Original line number Diff line number Diff line
@@ -859,11 +859,7 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
	/* Update with user specified arbitration configuration */
	opts->arb_mechanism = g_arbitration.arbitration_mechanism;

	printf("Attaching to %04x:%02x:%02x.%02x\n",
	       probe_info->pci_addr.domain,
	       probe_info->pci_addr.bus,
	       probe_info->pci_addr.dev,
	       probe_info->pci_addr.func);
	printf("Attaching to %s\n", probe_info->trid.traddr);

	return true;
}
@@ -872,11 +868,7 @@ static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
	  struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{
	printf("Attached to %04x:%02x:%02x.%02x\n",
	       probe_info->pci_addr.domain,
	       probe_info->pci_addr.bus,
	       probe_info->pci_addr.dev,
	       probe_info->pci_addr.func);
	printf("Attached to %s\n", probe_info->trid.traddr);

	/* Update with actual arbitration configuration in use */
	g_arbitration.arbitration_mechanism = opts->arb_mechanism;
+14 −6
Original line number Diff line number Diff line
@@ -94,6 +94,11 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
	unsigned int		i;
	struct thread_data 	*td = cb_ctx;
	int rc;
	struct spdk_pci_addr pci_addr;

	if (spdk_pci_addr_parse(&pci_addr, probe_info->trid.traddr)) {
		return false;
	}

	/* Check if we want to claim this device */
	for_each_file(td, f, i) {
@@ -103,9 +108,9 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
			fprintf(stderr, "Invalid filename: %s\n", f->file_name);
			continue;
		}
		if (bus == probe_info->pci_addr.bus &&
		    slot == probe_info->pci_addr.dev &&
		    func == probe_info->pci_addr.func) {
		if (bus == pci_addr.bus &&
		    slot == pci_addr.dev &&
		    func == pci_addr.func) {
			return true;
		}
	}
@@ -123,6 +128,9 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
	struct spdk_fio_ns	*fio_ns;
	struct fio_file *f;
	unsigned int i;
	struct spdk_pci_addr pci_addr;

	spdk_pci_addr_parse(&pci_addr, probe_info->trid.traddr);

	/* Create an fio_ctrlr and add it to the list */
	fio_ctrlr = calloc(1, sizeof(*fio_ctrlr));
@@ -137,9 +145,9 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
		int domain, bus, slot, func, nsid, rc;
		rc = sscanf(f->file_name, "%x.%x.%x.%x/%x", &domain, &bus, &slot, &func, &nsid);
		if (rc == 5 &&
		    bus == probe_info->pci_addr.bus &&
		    slot == probe_info->pci_addr.dev &&
		    func == probe_info->pci_addr.func) {
		    bus == pci_addr.bus &&
		    slot == pci_addr.dev &&
		    func == pci_addr.func) {
			fio_ns = calloc(1, sizeof(*fio_ns));
			if (fio_ns == NULL) {
				continue;
+2 −10
Original line number Diff line number Diff line
@@ -241,11 +241,7 @@ static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
	 struct spdk_nvme_ctrlr_opts *opts)
{
	printf("Attaching to %04x:%02x:%02x.%02x\n",
	       probe_info->pci_addr.domain,
	       probe_info->pci_addr.bus,
	       probe_info->pci_addr.dev,
	       probe_info->pci_addr.func);
	printf("Attaching to %s\n", probe_info->trid.traddr);

	return true;
}
@@ -264,11 +260,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
		exit(1);
	}

	printf("Attached to %04x:%02x:%02x.%02x\n",
	       probe_info->pci_addr.domain,
	       probe_info->pci_addr.bus,
	       probe_info->pci_addr.dev,
	       probe_info->pci_addr.func);
	printf("Attached to %s\n", probe_info->trid.traddr);

	snprintf(entry->name, sizeof(entry->name), "%-20.20s (%-20.20s)", cdata->mn, cdata->sn);

+2 −10
Original line number Diff line number Diff line
@@ -265,11 +265,7 @@ static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
	 struct spdk_nvme_ctrlr_opts *opts)
{
	printf("Attaching to %04x:%02x:%02x.%02x\n",
	       probe_info->pci_addr.domain,
	       probe_info->pci_addr.bus,
	       probe_info->pci_addr.dev,
	       probe_info->pci_addr.func);
	printf("Attaching to %s\n", probe_info->trid.traddr);

	return true;
}
@@ -278,11 +274,7 @@ static void
attach_cb(void *cb_ctx, const struct spdk_nvme_probe_info *probe_info,
	  struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{
	printf("Attached to %04x:%02x:%02x.%02x\n",
	       probe_info->pci_addr.domain,
	       probe_info->pci_addr.bus,
	       probe_info->pci_addr.dev,
	       probe_info->pci_addr.func);
	printf("Attached to %s\n", probe_info->trid.traddr);

	register_dev(ctrlr);
}
Loading