From 3759b870823535d76e92025efcf9e375d87ab4ad Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Fri, 17 Jul 2020 11:42:40 +0200 Subject: [PATCH] env_dpdk/pci: remove driver->is_registered Now that we support only DPDK 18.11+ and always have to register pci drivers to DPDK on initialization we don't need that flag - it's always true. Change-Id: Ibf1d79155595609fe9093f58e056bea25db6fdb2 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3446 Reviewed-by: Jacek Kalwas Reviewed-by: Ben Walker Reviewed-by: Jim Harris Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins --- lib/env_dpdk/env_internal.h | 1 - lib/env_dpdk/pci.c | 25 ------------------------- lib/env_dpdk/pci_idxd.c | 1 - lib/env_dpdk/pci_ioat.c | 1 - lib/env_dpdk/pci_nvme.c | 1 - lib/env_dpdk/pci_virtio.c | 1 - lib/env_dpdk/pci_vmd.c | 1 - test/env/pci/pci_ut.c | 4 +--- 8 files changed, 1 insertion(+), 34 deletions(-) diff --git a/lib/env_dpdk/env_internal.h b/lib/env_dpdk/env_internal.h index fa2554e76..3643aa316 100644 --- a/lib/env_dpdk/env_internal.h +++ b/lib/env_dpdk/env_internal.h @@ -69,7 +69,6 @@ struct spdk_pci_driver { struct rte_pci_driver driver; spdk_pci_enum_cb cb_fn; void *cb_arg; - bool is_registered; TAILQ_ENTRY(spdk_pci_driver) tailq; }; diff --git a/lib/env_dpdk/pci.c b/lib/env_dpdk/pci.c index 4b43ccc18..d729d7435 100644 --- a/lib/env_dpdk/pci.c +++ b/lib/env_dpdk/pci.c @@ -244,22 +244,7 @@ pci_env_init(void) { struct spdk_pci_driver *driver; - /* We need to pre-register pci drivers for the pci devices to be - * attachable in multi-process with DPDK 18.11+. - * - * DPDK 18.11+ does its best to ensure all devices are equally - * attached or detached in all processes within a shared memory group. - * For SPDK it means that if a device is hotplugged in the primary, - * then DPDK will automatically send an IPC hotplug request to all other - * processes. Those other processes may not have the same SPDK PCI - * driver registered and may fail to attach the device. DPDK will send - * back the failure status, and the the primary process will also fail - * to hotplug the device. To prevent that, we need to pre-register the - * pci drivers here. - */ TAILQ_FOREACH(driver, &g_pci_drivers, tailq) { - assert(!driver->is_registered); - driver->is_registered = true; rte_pci_register(&driver->driver); } @@ -497,11 +482,6 @@ spdk_pci_device_attach(struct spdk_pci_driver *driver, return rc; } - if (!driver->is_registered) { - driver->is_registered = true; - rte_pci_register(&driver->driver); - } - driver->cb_fn = enum_cb; driver->cb_arg = enum_ctx; @@ -579,11 +559,6 @@ spdk_pci_enumerate(struct spdk_pci_driver *driver, } pthread_mutex_unlock(&g_pci_mutex); - if (!driver->is_registered) { - driver->is_registered = true; - rte_pci_register(&driver->driver); - } - if (scan_pci_bus(true) != 0) { return -1; } diff --git a/lib/env_dpdk/pci_idxd.c b/lib/env_dpdk/pci_idxd.c index 42f3da1ce..987eb29d2 100644 --- a/lib/env_dpdk/pci_idxd.c +++ b/lib/env_dpdk/pci_idxd.c @@ -52,7 +52,6 @@ static struct spdk_pci_driver g_idxd_pci_drv = { .cb_fn = NULL, .cb_arg = NULL, - .is_registered = false, }; struct spdk_pci_driver * diff --git a/lib/env_dpdk/pci_ioat.c b/lib/env_dpdk/pci_ioat.c index 74875557b..632f17c83 100644 --- a/lib/env_dpdk/pci_ioat.c +++ b/lib/env_dpdk/pci_ioat.c @@ -100,7 +100,6 @@ static struct spdk_pci_driver g_ioat_pci_drv = { .cb_fn = NULL, .cb_arg = NULL, - .is_registered = false, }; struct spdk_pci_driver * diff --git a/lib/env_dpdk/pci_nvme.c b/lib/env_dpdk/pci_nvme.c index e5122874c..45631a77b 100644 --- a/lib/env_dpdk/pci_nvme.c +++ b/lib/env_dpdk/pci_nvme.c @@ -59,7 +59,6 @@ static struct spdk_pci_driver g_nvme_pci_drv = { .cb_fn = NULL, .cb_arg = NULL, - .is_registered = false, }; struct spdk_pci_driver * diff --git a/lib/env_dpdk/pci_virtio.c b/lib/env_dpdk/pci_virtio.c index a762c4a17..5faa9708a 100644 --- a/lib/env_dpdk/pci_virtio.c +++ b/lib/env_dpdk/pci_virtio.c @@ -56,7 +56,6 @@ static struct spdk_pci_driver g_virtio_pci_drv = { .cb_fn = NULL, .cb_arg = NULL, - .is_registered = false, }; struct spdk_pci_driver * diff --git a/lib/env_dpdk/pci_vmd.c b/lib/env_dpdk/pci_vmd.c index ae5f4b658..16dd9268d 100644 --- a/lib/env_dpdk/pci_vmd.c +++ b/lib/env_dpdk/pci_vmd.c @@ -53,7 +53,6 @@ static struct spdk_pci_driver g_vmd_pci_drv = { .cb_fn = NULL, .cb_arg = NULL, - .is_registered = false, }; struct spdk_pci_driver * diff --git a/test/env/pci/pci_ut.c b/test/env/pci/pci_ut.c index eb9a46199..66d36b980 100644 --- a/test/env/pci/pci_ut.c +++ b/test/env/pci/pci_ut.c @@ -59,9 +59,7 @@ pci_claim_test(struct spdk_pci_device *dev) } } -static struct spdk_pci_driver ut_pci_driver = { - .is_registered = true, -}; +static struct spdk_pci_driver ut_pci_driver; struct ut_pci_dev { struct spdk_pci_device pci;