From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 667A846C46; Wed, 30 Jul 2025 02:10:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2455740DFD; Wed, 30 Jul 2025 02:09:55 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 5E2CB40B9A for ; Wed, 30 Jul 2025 02:09:51 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1202) id B88B8211766F; Tue, 29 Jul 2025 17:09:50 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B88B8211766F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1753834190; bh=XgIXR3r8jg2CfA5p6Yx30PgZLbuy4Eyh3xG/A5B3Jok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=BqMc43J5+jx3AigWG/sTRtKUvEyowyrvSAwKD2GsKn20KZv6ir+iG7YsKlBiCGE6H BaVZ0eqKa6f5FrlJOedrpaWkCIYjBJlzuo7ZJkVudlV5cabbrMGoRbZ3YVjd7OrS6r QKP159jw2AdMSda0pxzT4UlH7HBxhGB77h0PjV5o= From: longli@linuxonhyperv.com To: Stephen Hemminger , Wei Hu Cc: dev@dpdk.org, Long Li Subject: [Patch v7 4/4] bus/vmbus: set event for channel without monitoring support Date: Tue, 29 Jul 2025 17:09:43 -0700 Message-Id: <1753834183-22244-5-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1753834183-22244-1-git-send-email-longli@linuxonhyperv.com> References: <1753834183-22244-1-git-send-email-longli@linuxonhyperv.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: longli@microsoft.com Errors-To: dev-bounces@dpdk.org From: Long Li 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 --- drivers/bus/vmbus/vmbus_channel.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c index d066e3288d..6887fbad46 100644 --- a/drivers/bus/vmbus/vmbus_channel.c +++ b/drivers/bus/vmbus/vmbus_channel.c @@ -25,6 +25,19 @@ 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 = (RTE_ATOMIC(uint32_t) *) (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) { @@ -40,10 +53,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.25.1