eth_memif_tx_zc() returns uint16_t but did "return -1" when the
interrupt FD was invalid, so the caller saw 65535 packets sent after
ring->head had already been published. The FD can legitimately be -1:
memif_init_queues() only warns and continues when eventfd() fails. Skip
the kick when the FD is invalid, as eth_memif_tx() does, and return the
real count.

Fixes: aedd054c5c2a ("drivers: check interrupt file descriptor validity")
Cc: [email protected]

Suggested-by: Stephen Hemminger <[email protected]>
Signed-off-by: Sriram Yagnaraman <[email protected]>
---
 drivers/net/memif/rte_eth_memif.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/memif/rte_eth_memif.c 
b/drivers/net/memif/rte_eth_memif.c
index cdf77d77b0..0680dc3947 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -1254,11 +1254,9 @@ eth_memif_tx_zc(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)
        rte_atomic_store_explicit(&ring->head, slot, rte_memory_order_release);
 
        /* Send interrupt, if enabled. */
-       if ((ring->flags & MEMIF_RING_FLAG_MASK_INT) == 0) {
+       if ((ring->flags & MEMIF_RING_FLAG_MASK_INT) == 0 &&
+           rte_intr_fd_get(mq->intr_handle) >= 0) {
                uint64_t a = 1;
-               if (rte_intr_fd_get(mq->intr_handle) < 0)
-                       return -1;
-
                ssize_t size = write(rte_intr_fd_get(mq->intr_handle),
                                     &a, sizeof(a));
                if (unlikely(size < 0)) {
-- 
2.43.7

Reply via email to