DPDK patches and discussions
 help / color / mirror / Atom feed
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 v4 6/6] bus/vmbus: set event for channel without monitoring support
Date: Mon,  7 Apr 2025 15:45:04 -0700	[thread overview]
Message-ID: <1744065904-18455-7-git-send-email-longli@linuxonhyperv.com> (raw)
In-Reply-To: <1744065904-18455-1-git-send-email-longli@linuxonhyperv.com>

From: Long Li <longli@microsoft.com>

For vmbus channels without monitoring support, use kernel UIO interface
to indicate packet through interrupt page and UIO file handle.

Signed-off-by: Long Li <longli@microsoft.com>
---
Changes:
v4: replace RTE_ATOMIC(uint32_t) * with RTE_ATOMIC(uint32_t *) for declaring variable

 drivers/bus/vmbus/vmbus_channel.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index bccef168d3..96ac3ba6d6 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -19,15 +19,28 @@
 #include "private.h"
 
 static inline void
-vmbus_sync_set_bit(volatile RTE_ATOMIC(uint32_t) *addr, uint32_t mask)
+vmbus_sync_set_bit(volatile RTE_ATOMIC(uint32_t *) addr, uint32_t mask)
 {
 	rte_atomic_fetch_or_explicit(addr, mask, rte_memory_order_seq_cst);
 }
 
+static inline void
+vmbus_send_interrupt(const struct rte_vmbus_device *dev, uint32_t relid)
+{
+	RTE_ATOMIC(uint32_t *) int_addr;
+	uint32_t int_mask;
+
+	int_addr = dev->int_page + relid / 32;
+	int_mask = 1u << (relid % 32);
+	vmbus_sync_set_bit(int_addr, int_mask);
+
+	vmbus_uio_irq_control(dev, 1);
+}
+
 static inline void
 vmbus_set_monitor(const struct vmbus_channel *channel, uint32_t monitor_id)
 {
-	RTE_ATOMIC(uint32_t) *monitor_addr;
+	RTE_ATOMIC(uint32_t *) monitor_addr;
 	uint32_t monitor_mask;
 	unsigned int trigger_index;
 
@@ -39,10 +52,13 @@ vmbus_set_monitor(const struct vmbus_channel *channel, uint32_t monitor_id)
 }
 
 static void
-vmbus_set_event(struct rte_vmbus_device *dev __rte_unused,
-		const struct vmbus_channel *chan)
+vmbus_set_event(struct rte_vmbus_device *dev, const struct vmbus_channel *chan)
 {
-	vmbus_set_monitor(chan, chan->monitor_id);
+	/* Use monitored bit if supported, otherwise use interrupt/Hypercall */
+	if (chan->monitor_id != UINT8_MAX)
+		vmbus_set_monitor(chan, chan->monitor_id);
+	else
+		vmbus_send_interrupt(dev, chan->relid);
 }
 
 /*
-- 
2.34.1


  parent reply	other threads:[~2025-04-07 22:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07 22:44 [patch v4 0/6] Support VMBUS channels without monitoring enabled longli
2025-04-07 22:44 ` [patch v4 1/6] net/netvsc: introduce private data for storing vmbus device for secondary process longli
2025-04-07 22:45 ` [patch v4 2/6] net/netvsc: introduce get_vmbus_device to get the vmbus device longli
2025-04-07 22:45 ` [patch v4 3/6] bus/vmbus: store UIO fd for secondary process longli
2025-04-07 22:45 ` [patch v4 4/6] bus/vmbus: support channels without monitoring enabled longli
2025-04-07 22:45 ` [patch v4 5/6] bus/vmbus: add rte_vmbus_device to all functions accessing vmbus longli
2025-04-07 22:45 ` longli [this message]
2025-04-08 14:18   ` [patch v4 6/6] bus/vmbus: set event for channel without monitoring support Stephen Hemminger
2025-04-08 21:55     ` [EXTERNAL] " Long Li

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=1744065904-18455-7-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).