1 Star 0 Fork 48

liyunqing_kl/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0087-support-vlan-offload.patch 2.19 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2024-02-06 10:45 . adapt lwip-2.2.0
From c2c63406f804550db5670715c1afa6e743d1f675 Mon Sep 17 00:00:00 2001
From: jiangheng <[email protected]>
Date: Mon, 5 Feb 2024 17:38:06 +0800
Subject: support vlan offload
---
src/include/dpdk_version.h | 1 +
src/include/lwip/pbuf.h | 1 +
src/netif/ethernet.c | 17 +++++++++++------
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/include/dpdk_version.h b/src/include/dpdk_version.h
index e61d0b3..5efaa39 100644
--- a/src/include/dpdk_version.h
+++ b/src/include/dpdk_version.h
@@ -48,6 +48,7 @@
#define RTE_MBUF_F_TX_TCP_CKSUM PKT_TX_TCP_CKSUM
#define RTE_MBUF_F_TX_TCP_SEG PKT_TX_TCP_SEG
#define RTE_MBUF_F_TX_UDP_CKSUM PKT_TX_UDP_CKSUM
+#define RTE_MBUF_F_TX_VLAN PKT_TX_VLAN_PKT
#endif /* DPDK_VERSION_1911 */
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index 7fad719..bc29372 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -240,6 +240,7 @@ struct pbuf {
struct pbuf *last;
pthread_spinlock_t pbuf_lock;
struct tcp_pcb *pcb;
+ u16_t vlan_tci;
#if GAZELLE_UDP_ENABLE
ip_addr_t addr;
u16_t port;
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index af4cffc..d2960b5 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -289,7 +289,12 @@ ethernet_output(struct netif * netif, struct pbuf * p,
}
#else
if (netif->vlan_enable) {
- vlan_prio_vid = netif->vlan_tci;
+ if (netif->txol_flags & DEV_TX_OFFLOAD_VLAN_INSERT) {
+ p->ol_flags |= RTE_MBUF_F_TX_VLAN;
+ p->vlan_tci = netif->vlan_tci;
+ } else {
+ vlan_prio_vid = netif->vlan_tci;
+ }
}
#endif /* GAZELLE_ENABLE */
#endif
@@ -327,11 +332,11 @@ ethernet_output(struct netif * netif, struct pbuf * p,
("ethernet_output: sending packet %p\n", (void *)p));
#if CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW
-#if LWIP_VLAN_PCP
- ethh_cksum_set(p, sizeof(*ethhdr)+SIZEOF_VLAN_HDR);
-#else
- ethh_cksum_set(p, sizeof(*ethhdr));
-#endif
+ if (netif->vlan_enable && !(netif->txol_flags & DEV_TX_OFFLOAD_VLAN_INSERT)) {
+ ethh_cksum_set(p, sizeof(*ethhdr) + SIZEOF_VLAN_HDR);
+ } else {
+ ethh_cksum_set(p, sizeof(*ethhdr));
+ }
#endif
/* send the packet */
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/li_yunq/lwip.git
[email protected]:li_yunq/lwip.git
li_yunq
lwip
lwip
master

搜索帮助