From 776ff89196c1fb5bc0193ea746119e40f80fed46 Mon Sep 17 00:00:00 2001
From: compile_success <980965867@qq.com>
Date: Fri, 22 Mar 2024 08:31:28 +0000
Subject: [PATCH] add udp poll

---
 src/lstack/core/lstack_lwip.c           | 8 ++++++++
 src/lstack/core/lstack_protocol_stack.c | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index a604a62..c5161b4 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -1307,6 +1307,14 @@ void netif_poll(struct netif *netif)
 /* processes on same node handshake packet use this function */
 err_t netif_loop_output(struct netif *netif, struct pbuf *p)
 {
+    if (p != NULL) {
+        const struct ip_hdr *iphdr;
+        iphdr = (const struct ip_hdr *)p->payload;
+        if (IPH_PROTO(iphdr) == IP_PROTO_UDP) {
+            return udp_netif_loop_output(netif, p);
+        }
+    }
+
     struct tcp_pcb *pcb = p->pcb;
     struct pbuf *head = NULL;
 
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 7c4af64..138ac2b 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -491,6 +491,10 @@ int stack_polling(uint32_t wakeup_tick)
         }
     }
 
+    if (cfg->udp_enable) {
+        udp_netif_poll(&stack->netif);
+    }
+
 #if RTE_VERSION < RTE_VERSION_NUM(23, 11, 0, 0)
     /* run to completion mode currently does not support kni */
     /* KNI requests are generally low-rate I/Os,
-- 
2.33.0

