From 80eccdd1bb639a1ea8c186c8c2b7f451b0b38a7e Mon Sep 17 00:00:00 2001
From: compile_success <980965867@qq.com>
Date: Tue, 31 Oct 2023 11:44:29 +0000
Subject: [PATCH] add tx package timeout

---
 src/lstack/netif/lstack_vdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lstack/netif/lstack_vdev.c b/src/lstack/netif/lstack_vdev.c
index 81b48dc..62abe80 100644
--- a/src/lstack/netif/lstack_vdev.c
+++ b/src/lstack/netif/lstack_vdev.c
@@ -142,10 +142,11 @@ static uint32_t vdev_tx_xmit(struct protocol_stack *stack, struct rte_mbuf **pkt
         stack->stats.tx_prepare_fail++;
         LSTACK_LOG(INFO, LSTACK, "rte_eth_tx_prepare failed\n");
     }
+    const uint32_t tbegin = sys_now();
 
     do {
         sent_pkts += rte_eth_tx_burst(stack->port_id, stack->queue_id, &pkts[sent_pkts], nr_pkts - sent_pkts);
-    } while (sent_pkts < nr_pkts);
+    } while (sent_pkts < nr_pkts && (ENQUEUE_RING_RETRY_TIMEOUT > sys_now() - tbegin));
 
     return sent_pkts;
 }
-- 
2.27.0

