Projects
openEuler:C
gazelle
_service:tar_scm:0064-add-vlan_id-in-netif.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0064-add-vlan_id-in-netif.patch of Package gazelle
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
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.