代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。