Fetch the repository succeeded.
This action will force synchronization from src-openEuler/gazelle, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
From fcdf8a09859cc0ba148a5c0a410997931fb4fa20 Mon Sep 17 00:00:00 2001
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
Date: Wed, 22 Nov 2023 16:08:22 +0800
Subject: [PATCH] add vlan_id in netif
---
src/lstack/core/lstack_cfg.c | 4 ++--
src/lstack/core/lstack_lwip.c | 3 ---
src/lstack/include/lstack_cfg.h | 2 +-
src/lstack/netif/lstack_ethdev.c | 5 +++++
src/lstack/netif/lstack_vdev.c | 2 +-
5 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index d1cbd1d..6324c97 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -1261,9 +1261,9 @@ static int32_t parse_stack_thread_mode(void)
static int32_t parse_nic_vlan_mode(void)
{
int32_t ret;
- PARSE_ARG(g_config_params.nic.vlan_mode, "nic_vlan_mode", 0, 0, 4094, ret);
+ PARSE_ARG(g_config_params.nic.vlan_mode, "nic_vlan_mode", -1, -1, 4094, ret);
if (ret != 0) {
- LSTACK_PRE_LOG(LSTACK_ERR, "cfg: invalid vlan mode value %d ret=%d. only support 0~4094\n", \
+ LSTACK_PRE_LOG(LSTACK_ERR, "cfg: invalid vlan mode value %d ret=%d. only support -1~4094\n", \
g_config_params.nic.vlan_mode, ret);
}
return ret;
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index c8b4e8f..af9bf73 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -196,9 +196,6 @@ void do_lwip_init_sock(int32_t fd)
(void)replenish_send_idlembuf(stack, sock);
sock->stack = stack;
- if (get_global_cfg_params()->nic.vlan_mode > 0 && get_global_cfg_params()->nic.vlan_mode < 4095) {
- sock->conn->pcb.udp->netif_hints.tci = get_global_cfg_params()->nic.vlan_mode;
- }
init_list_node_null(&sock->recv_list);
init_list_node_null(&sock->event_list);
diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h
index e33f4fe..a6bdfd5 100644
--- a/src/lstack/include/lstack_cfg.h
+++ b/src/lstack/include/lstack_cfg.h
@@ -63,7 +63,7 @@ struct secondary_attach_arg {
struct cfg_nic_params {
uint32_t rxqueue_size;
uint32_t txqueue_size;
- uint16_t vlan_mode;
+ int32_t vlan_mode;
};
struct cfg_params {
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
index 29bef21..cce2fcf 100644
--- a/src/lstack/netif/lstack_ethdev.c
+++ b/src/lstack/netif/lstack_ethdev.c
@@ -967,6 +967,11 @@ int32_t ethdev_init(struct protocol_stack *stack)
netif_ip6_addr_set(&stack->netif, 0, &cfg->host_addr6);
netif_ip6_addr_set_state(&stack->netif, 0, IP6_ADDR_VALID);
}
+
+ /* 0-4094: The vlaue range for VLAN IDs is 0 to 4094. */
+ if (get_global_cfg_params()->nic.vlan_mode >= 0 && get_global_cfg_params()->nic.vlan_mode <= 4094) {
+ netif_set_vlan_tci(&stack->netif, (u16_t)get_global_cfg_params()->nic.vlan_mode);
+ }
netif_set_link_up(&stack->netif);
diff --git a/src/lstack/netif/lstack_vdev.c b/src/lstack/netif/lstack_vdev.c
index d57ce59..18322a6 100644
--- a/src/lstack/netif/lstack_vdev.c
+++ b/src/lstack/netif/lstack_vdev.c
@@ -84,7 +84,7 @@ static uint32_t vdev_rx_poll(struct protocol_stack *stack, struct rte_mbuf **pkt
}
/* skip gro when tcp/ip cksum offloads disable */
- if (get_protocol_stack_group()->rx_offload == 0 || get_global_cfg_params()->nic.vlan_mode > 0) {
+ if (get_protocol_stack_group()->rx_offload == 0 || get_global_cfg_params()->nic.vlan_mode >= 0) {
return pkt_num;
}
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。