From aa2e11540cf897d2b1051ab33245e8c988618aaa Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Thu, 26 Oct 2023 17:45:56 +0800
Subject: [PATCH] ethdev: fix arp unicast packets cannot be transmitted to
 current procotol stack

---
 src/lstack/core/lstack_protocol_stack.c |  8 ++++++++
 src/lstack/netif/lstack_ethdev.c        | 11 ++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 0726054..511d2b9 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -837,6 +837,14 @@ void stack_broadcast_arp(struct rte_mbuf *mbuf, struct protocol_stack *cur_stack
             return;
         }
     }
+    ret = dpdk_alloc_pktmbuf(stack->rxtx_pktmbuf_pool, &mbuf_copy, 1);
+    if (ret != 0) {
+        stack->stats.rx_allocmbuf_fail++;
+        return;
+    }
+    copy_mbuf(mbuf_copy, mbuf);
+    kni_handle_tx(mbuf_copy);
+    return;
 }
 
 void stack_broadcast_clean_epoll(struct wakeup_poll *wakeup)
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
index 30c3c9a..f2353f8 100644
--- a/src/lstack/netif/lstack_ethdev.c
+++ b/src/lstack/netif/lstack_ethdev.c
@@ -780,15 +780,8 @@ int32_t gazelle_eth_dev_poll(struct protocol_stack *stack, uint8_t use_ltran_fla
             struct rte_ether_hdr *ethh = rte_pktmbuf_mtod(stack->pkts[i], struct rte_ether_hdr *);
             if (unlikely(RTE_BE16(RTE_ETHER_TYPE_ARP) == ethh->ether_type)) {
                 stack_broadcast_arp(stack->pkts[i], stack);
-#if DPDK_VERSION_1911
-                if (!rte_is_broadcast_ether_addr(&ethh->d_addr)) {
-#else /* DPDK_VERSION_1911 */
-                if (!rte_is_broadcast_ether_addr(&ethh->dst_addr)) {
-#endif /* DPDK_VERSION_1911 */
-                    // copy arp into other process
-                    transfer_arp_to_other_process(stack->pkts[i]);
-                    transfer_type = TRANSFER_KERNEL;
-                }
+                /* copy arp into other process */
+                transfer_arp_to_other_process(stack->pkts[i]);
             } else {
                 if (get_global_cfg_params()->tuple_filter && stack->queue_id == 0) {
                     transfer_type = distribute_pakages(stack->pkts[i]);
-- 
2.27.0

