From: Long Li <lon...@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 <lon...@microsoft.com> --- Change log: v2: fixed compilation warnings drivers/bus/vmbus/vmbus_channel.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c index bccef168d3..81e8096190 100644 --- a/drivers/bus/vmbus/vmbus_channel.c +++ b/drivers/bus/vmbus/vmbus_channel.c @@ -24,6 +24,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) { @@ -39,10 +52,12 @@ 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); + if (chan->monitor_id != UINT8_MAX) + vmbus_set_monitor(chan, chan->monitor_id); + else + vmbus_send_interrupt(dev, chan->relid); } /* -- 2.34.1