From c392e263cb5f5392713600174d3b8955f2d26759 Mon Sep 17 00:00:00 2001
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
Date: Wed, 3 Apr 2024 14:33:57 +0800
Subject: [PATCH] fix vlan filter can be added when vlan_mode=-1

---
 src/lstack/core/lstack_dpdk.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
index 42981f4..b972c00 100644
--- a/src/lstack/core/lstack_dpdk.c
+++ b/src/lstack/core/lstack_dpdk.c
@@ -624,10 +624,12 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
     }
 
     /* after rte_eth_dev_configure */
-    ret = rte_eth_dev_vlan_filter(port_id, get_global_cfg_params()->nic.vlan_mode, 1);
-    if (ret != 0) {
-        LSTACK_LOG(ERR, LSTACK, "dpdk add vlan filter failed ret = %d\n", ret);
-        return -1;
+    if (get_global_cfg_params()->nic.vlan_mode != -1) {
+        ret = rte_eth_dev_vlan_filter(port_id, get_global_cfg_params()->nic.vlan_mode, 1);
+        if (ret != 0) {
+            LSTACK_LOG(ERR, LSTACK, "dpdk add vlan filter failed ret = %d\n", ret);
+            return -1;
+        }
     }
 
     rte_eth_allmulticast_enable(port_id);
-- 
2.33.0

