From: longli@linuxonhyperv.com
To: Stephen Hemminger <stephen@networkplumber.org>,
Wei Hu <weh@microsoft.com>
Cc: dev@dpdk.org, Long Li <longli@microsoft.com>
Subject: [PATCH 1/6] net/netvsc: introduce private data for storing vmbus device for secondary process
Date: Thu, 27 Feb 2025 17:08:56 -0800 [thread overview]
Message-ID: <1740704941-1631-2-git-send-email-longli@linuxonhyperv.com> (raw)
From: Long Li <longli@microsoft.com>
To prepare for supporting to set hyperv event from secondary process
when the channel has monitoring disable, introduce a private data
region for storing the vmbus device. The secondary process will get
access to its vmbus device in case it needs to signal the host.
Signed-off-by: Long Li <longli@microsoft.com>
---
drivers/net/netvsc/hn_ethdev.c | 44 +++++++++++++++++++++++++++-------
drivers/net/netvsc/hn_nvs.h | 4 ++++
2 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index f8cb05a118..4b7b557b5c 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -1423,7 +1423,8 @@ static int eth_hn_probe(struct rte_vmbus_driver *drv __rte_unused,
struct rte_vmbus_device *dev)
{
struct rte_eth_dev *eth_dev;
- int ret;
+ struct hn_nvs_process_priv *process_priv;
+ int ret = 0;
PMD_INIT_FUNC_TRACE();
@@ -1434,16 +1435,37 @@ static int eth_hn_probe(struct rte_vmbus_driver *drv __rte_unused,
}
eth_dev = eth_dev_vmbus_allocate(dev, sizeof(struct hn_data));
- if (!eth_dev)
- return -ENOMEM;
+ if (!eth_dev) {
+ ret = -ENOMEM;
+ goto vmbus_alloc_failed;
+ }
- ret = eth_hn_dev_init(eth_dev);
- if (ret) {
- eth_dev_vmbus_release(eth_dev);
- rte_dev_event_monitor_stop();
- } else {
- rte_eth_dev_probing_finish(eth_dev);
+ process_priv = rte_zmalloc_socket("netvsc_proc_priv",
+ sizeof(struct hn_nvs_process_priv),
+ RTE_CACHE_LINE_SIZE,
+ dev->device.numa_node);
+ if (!process_priv) {
+ ret = -ENOMEM;
+ goto priv_alloc_failed;
}
+ process_priv->vmbus_dev = dev;
+ eth_dev->process_private = process_priv;
+
+ ret = eth_hn_dev_init(eth_dev);
+ if (ret)
+ goto dev_init_failed;
+
+ rte_eth_dev_probing_finish(eth_dev);
+ return ret;
+
+dev_init_failed:
+ rte_free(process_priv);
+
+priv_alloc_failed:
+ eth_dev_vmbus_release(eth_dev);
+
+vmbus_alloc_failed:
+ rte_dev_event_monitor_stop();
return ret;
}
@@ -1451,6 +1473,7 @@ static int eth_hn_probe(struct rte_vmbus_driver *drv __rte_unused,
static int eth_hn_remove(struct rte_vmbus_device *dev)
{
struct rte_eth_dev *eth_dev;
+ struct hn_nvs_process_priv *process_priv;
int ret;
PMD_INIT_FUNC_TRACE();
@@ -1463,6 +1486,9 @@ static int eth_hn_remove(struct rte_vmbus_device *dev)
if (ret)
return ret;
+ process_priv = eth_dev->process_private;
+ rte_free(process_priv);
+
eth_dev_vmbus_release(eth_dev);
rte_dev_event_monitor_stop();
return 0;
diff --git a/drivers/net/netvsc/hn_nvs.h b/drivers/net/netvsc/hn_nvs.h
index 3766d2ee34..88f413f6aa 100644
--- a/drivers/net/netvsc/hn_nvs.h
+++ b/drivers/net/netvsc/hn_nvs.h
@@ -65,6 +65,10 @@
#define NVS_TYPE_SUBCH_RESP 133 /* same as SUBCH_REQ */
#define NVS_TYPE_TXTBL_NOTE 134 /* notification */
+/* Private data for primary/secondary processes */
+struct hn_nvs_process_priv {
+ struct rte_vmbus_device *vmbus_dev;
+};
/* NVS message common header */
struct hn_nvs_hdr {
--
2.34.1
next reply other threads:[~2025-02-28 1:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 1:08 longli [this message]
2025-02-28 1:08 ` [PATCH 2/6] net/netvsc: introduce get_vmbus_device to get the vmbus device longli
2025-02-28 1:08 ` [PATCH 3/6] bus/vmbus: store UIO fd for secondary process longli
2025-02-28 1:08 ` [PATCH 4/6] bus/vmbus: support channels without monitoring enabled longli
2025-02-28 1:09 ` [PATCH 5/6] bus/vmbus: add rte_vmbus_device to all functions accessing vmbus longli
2025-02-28 1:09 ` [PATCH 6/6] bus/vmbus: set event for channel without monitoring support longli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1740704941-1631-2-git-send-email-longli@linuxonhyperv.com \
--to=longli@linuxonhyperv.com \
--cc=dev@dpdk.org \
--cc=longli@microsoft.com \
--cc=stephen@networkplumber.org \
--cc=weh@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).