Projects
openEuler:C
gazelle
_service:tar_scm:0065-support-vlan-offload.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0065-support-vlan-offload.patch of Package gazelle
From a449111fed8c0c4cd7b8021ff20b3ea12f334479 Mon Sep 17 00:00:00 2001 From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com> Date: Tue, 28 Nov 2023 14:14:15 +0800 Subject: [PATCH] support vlan offload --- src/common/dpdk_common.c | 12 ++++++++++++ src/lstack/netif/lstack_ethdev.c | 13 +++++++------ src/lstack/netif/lstack_vdev.c | 3 ++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/common/dpdk_common.c b/src/common/dpdk_common.c index 52a163f..50f0bf0 100644 --- a/src/common/dpdk_common.c +++ b/src/common/dpdk_common.c @@ -104,6 +104,12 @@ void eth_params_checksum(struct rte_eth_conf *conf, struct rte_eth_dev_info *dev COMMON_INFO("DEV_RX_OFFLOAD_UDP_CKSUM\n"); } + // rx vlan + if (rx_ol_capa & DEV_RX_OFFLOAD_VLAN_STRIP) { + rx_ol |= DEV_RX_OFFLOAD_VLAN_STRIP; + COMMON_INFO("DEV_RX_OFFLOAD_VLAN_STRIP\n"); + } + // tx ip if (tx_ol_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) { tx_ol |= DEV_TX_OFFLOAD_IPV4_CKSUM; @@ -128,6 +134,12 @@ void eth_params_checksum(struct rte_eth_conf *conf, struct rte_eth_dev_info *dev COMMON_INFO("DEV_TX_OFFLOAD_TCP_TSO\n"); } + // tx vlan + if (tx_ol_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { + tx_ol |= DEV_TX_OFFLOAD_VLAN_INSERT; + COMMON_INFO("DEV_TX_OFFLOAD_VLAN_INSERT\n"); + } + if (!(rx_ol & DEV_RX_OFFLOAD_UDP_CKSUM) || !(rx_ol & DEV_RX_OFFLOAD_TCP_CKSUM) || !(rx_ol & DEV_RX_OFFLOAD_IPV4_CKSUM)) { diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c index cce2fcf..31856f2 100644 --- a/src/lstack/netif/lstack_ethdev.c +++ b/src/lstack/netif/lstack_ethdev.c @@ -815,12 +815,12 @@ int32_t gazelle_eth_dev_poll(struct protocol_stack *stack, uint8_t use_ltran_fla /* copy arp into other stack */ if (!use_ltran_flag) { struct rte_ether_hdr *ethh = rte_pktmbuf_mtod(stack->pkts[i], struct rte_ether_hdr *); - u16_t type; - type = ethh->ether_type; - if (type == PP_HTONS(ETHTYPE_VLAN)) { - struct eth_vlan_hdr *vlan = (struct eth_vlan_hdr *)(((char *)ethh) + SIZEOF_ETH_HDR); - type = vlan->tpid; - } + u16_t type; + type = ethh->ether_type; + if (type == PP_HTONS(ETHTYPE_VLAN)) { + struct eth_vlan_hdr *vlan = (struct eth_vlan_hdr *)(((char *)ethh) + SIZEOF_ETH_HDR); + type = vlan->tpid; + } if (unlikely(RTE_BE16(RTE_ETHER_TYPE_ARP) == type)) { stack_broadcast_arp(stack->pkts[i], stack); /* copy arp into other process */ @@ -860,6 +860,7 @@ static err_t eth_dev_output(struct netif *netif, struct pbuf *pbuf) mbuf->data_len = pbuf->len; mbuf->pkt_len = pbuf->tot_len; mbuf->ol_flags = pbuf->ol_flags; + mbuf->vlan_tci = pbuf->vlan_tci; mbuf->next = NULL; buf_addr = rte_pktmbuf_mtod(mbuf, void *); diff --git a/src/lstack/netif/lstack_vdev.c b/src/lstack/netif/lstack_vdev.c index 18322a6..e1438da 100644 --- a/src/lstack/netif/lstack_vdev.c +++ b/src/lstack/netif/lstack_vdev.c @@ -84,7 +84,8 @@ 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 + && !(get_protocol_stack_group()->rx_offload & DEV_RX_OFFLOAD_VLAN_STRIP))) { 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
.