* [dpdk-dev] [RFC 0/3] Auto enable hotplug with netvsc devices @ 2020-05-08 3:59 Stephen Hemminger 2020-05-08 3:59 ` [dpdk-dev] [RFC 1/3] eal/hotplug: allow monitor to be setup by multiple places Stephen Hemminger ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Stephen Hemminger @ 2020-05-08 3:59 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger In Azure, hotplug is a requirement for a working application. Yet most applications don't enable it because DPDK hotplug support is opt-in. There are three options: 1. Blame the application (this seems to be the DPDK default) 2. Fix the design mistake (too risky at this time) 3. Automatically enable hotplug if necessary (that is what this patchset does). Stephen Hemminger (3): eal/hotplug: allow monitor to be setup by multiple places net/vdev_netvsc: automatically enable hotplug support net/netvsc: automatically enable hotplug support drivers/net/netvsc/hn_ethdev.c | 5 ++++- drivers/net/vdev_netvsc/vdev_netvsc.c | 4 ++++ lib/librte_eal/linux/eal_dev.c | 15 +++++++-------- 3 files changed, 15 insertions(+), 9 deletions(-) -- 2.20.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [RFC 1/3] eal/hotplug: allow monitor to be setup by multiple places 2020-05-08 3:59 [dpdk-dev] [RFC 0/3] Auto enable hotplug with netvsc devices Stephen Hemminger @ 2020-05-08 3:59 ` Stephen Hemminger 2020-05-08 3:59 ` [dpdk-dev] [RFC 2/3] net/vdev_netvsc: automatically enable hotplug support Stephen Hemminger 2020-05-08 3:59 ` [dpdk-dev] [RFC 3/3] net/netvsc: " Stephen Hemminger 2 siblings, 0 replies; 4+ messages in thread From: Stephen Hemminger @ 2020-05-08 3:59 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger In some cases, a device or infrastructure may want to enable hotplug but application may also try and start hotplug as well. Therefore change the monitor_started from a boolean into a reference count. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/librte_eal/linux/eal_dev.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/librte_eal/linux/eal_dev.c b/lib/librte_eal/linux/eal_dev.c index 83c9cd660754..4d1c08f4c258 100644 --- a/lib/librte_eal/linux/eal_dev.c +++ b/lib/librte_eal/linux/eal_dev.c @@ -23,8 +23,11 @@ #include "eal_private.h" -static struct rte_intr_handle intr_handle = {.fd = -1 }; -static bool monitor_started; +static struct rte_intr_handle intr_handle = { + .type = RTE_INTR_HANDLE_DEV_EVENT, + .fd = -1, +}; +static uint32_t monitor_refcount; static bool hotplug_handle; #define EAL_UEV_MSG_LEN 4096 @@ -290,7 +293,7 @@ rte_dev_event_monitor_start(void) { int ret; - if (monitor_started) + if (__atomic_fetch_add(&monitor_refcount, 1, __ATOMIC_RELAXED)) return 0; ret = dev_uev_socket_fd_create(); @@ -299,7 +302,6 @@ rte_dev_event_monitor_start(void) return -1; } - intr_handle.type = RTE_INTR_HANDLE_DEV_EVENT; ret = rte_intr_callback_register(&intr_handle, dev_uev_handler, NULL); if (ret) { @@ -307,8 +309,6 @@ rte_dev_event_monitor_start(void) return -1; } - monitor_started = true; - return 0; } @@ -317,7 +317,7 @@ rte_dev_event_monitor_stop(void) { int ret; - if (!monitor_started) + if (__atomic_sub_fetch(&monitor_refcount, 1, __ATOMIC_RELAXED)) return 0; ret = rte_intr_callback_unregister(&intr_handle, dev_uev_handler, @@ -329,7 +329,6 @@ rte_dev_event_monitor_stop(void) close(intr_handle.fd); intr_handle.fd = -1; - monitor_started = false; return 0; } -- 2.20.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [RFC 2/3] net/vdev_netvsc: automatically enable hotplug support 2020-05-08 3:59 [dpdk-dev] [RFC 0/3] Auto enable hotplug with netvsc devices Stephen Hemminger 2020-05-08 3:59 ` [dpdk-dev] [RFC 1/3] eal/hotplug: allow monitor to be setup by multiple places Stephen Hemminger @ 2020-05-08 3:59 ` Stephen Hemminger 2020-05-08 3:59 ` [dpdk-dev] [RFC 3/3] net/netvsc: " Stephen Hemminger 2 siblings, 0 replies; 4+ messages in thread From: Stephen Hemminger @ 2020-05-08 3:59 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger In Hyper-V/Azure with accelerated networking the VF device maybe added or removed at anytime. Automatically enable hotplug support (in case application has forgot to). Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/net/vdev_netvsc/vdev_netvsc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index 9ed74a1d6a2e..f99909ad800f 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -729,6 +729,7 @@ vdev_netvsc_vdev_probe(struct rte_vdev_device *dev) if (kvargs) rte_kvargs_free(kvargs); ++vdev_netvsc_ctx_inst; + rte_dev_event_monitor_start(); return 0; } @@ -749,7 +750,10 @@ vdev_netvsc_vdev_remove(__rte_unused struct rte_vdev_device *dev) { if (--vdev_netvsc_ctx_inst) return 0; + rte_eal_alarm_cancel(vdev_netvsc_alarm, NULL); + rte_dev_event_monitor_stop(); + while (!LIST_EMPTY(&vdev_netvsc_ctx_list)) { struct vdev_netvsc_ctx *ctx = LIST_FIRST(&vdev_netvsc_ctx_list); -- 2.20.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [RFC 3/3] net/netvsc: automatically enable hotplug support 2020-05-08 3:59 [dpdk-dev] [RFC 0/3] Auto enable hotplug with netvsc devices Stephen Hemminger 2020-05-08 3:59 ` [dpdk-dev] [RFC 1/3] eal/hotplug: allow monitor to be setup by multiple places Stephen Hemminger 2020-05-08 3:59 ` [dpdk-dev] [RFC 2/3] net/vdev_netvsc: automatically enable hotplug support Stephen Hemminger @ 2020-05-08 3:59 ` Stephen Hemminger 2 siblings, 0 replies; 4+ messages in thread From: Stephen Hemminger @ 2020-05-08 3:59 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger In Hyper-V/Azure with accelerated networking the VF device maybe added or removed at anytime. Automatically enable hotplug support (in case application has forgot to). Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/net/netvsc/hn_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index 05f1a25a1abc..cf10fc24b37b 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -1074,8 +1074,10 @@ static int eth_hn_probe(struct rte_vmbus_driver *drv __rte_unused, ret = eth_hn_dev_init(eth_dev); if (ret) eth_dev_vmbus_release(eth_dev); - else + else { rte_eth_dev_probing_finish(eth_dev); + rte_dev_event_monitor_stop(); + } return ret; } @@ -1096,6 +1098,7 @@ static int eth_hn_remove(struct rte_vmbus_device *dev) return ret; eth_dev_vmbus_release(eth_dev); + rte_dev_event_monitor_stop(); return 0; } -- 2.20.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-08 3:59 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-05-08 3:59 [dpdk-dev] [RFC 0/3] Auto enable hotplug with netvsc devices Stephen Hemminger 2020-05-08 3:59 ` [dpdk-dev] [RFC 1/3] eal/hotplug: allow monitor to be setup by multiple places Stephen Hemminger 2020-05-08 3:59 ` [dpdk-dev] [RFC 2/3] net/vdev_netvsc: automatically enable hotplug support Stephen Hemminger 2020-05-08 3:59 ` [dpdk-dev] [RFC 3/3] net/netvsc: " Stephen Hemminger
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).