support vlan offload

(cherry picked from commit 327259493144a14c656a4f8c4e638b9c02be36d5)
This commit is contained in:
zhengjiebing 2023-11-28 17:40:23 +08:00 committed by openeuler-sync-bot
parent baffc303a4
commit af1c721d86
2 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,56 @@
diff -Nur lwip-82/src/include/dpdk_version.h lwip-offload/src/include/dpdk_version.h
--- lwip-82/src/include/dpdk_version.h 2023-11-28 14:17:02.432481010 +0800
+++ lwip-offload/src/include/dpdk_version.h 2023-11-28 14:34:21.208481010 +0800
@@ -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 -Nur lwip-82/src/include/lwip/pbuf.h lwip-offload/src/include/lwip/pbuf.h
--- lwip-82/src/include/lwip/pbuf.h 2023-11-28 14:17:02.408481010 +0800
+++ lwip-offload/src/include/lwip/pbuf.h 2023-11-28 14:41:31.580481010 +0800
@@ -240,6 +240,7 @@
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 -Nur lwip-82/src/netif/ethernet.c lwip-offload/src/netif/ethernet.c
--- lwip-82/src/netif/ethernet.c 2023-11-28 14:17:02.440481010 +0800
+++ lwip-offload/src/netif/ethernet.c 2023-11-28 16:35:36.536481010 +0800
@@ -289,7 +289,12 @@
}
#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: 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 */

View File

@ -4,7 +4,7 @@
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
Name: lwip
Version: 2.1.3
Release: 89
Release: 90
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -100,6 +100,7 @@ Patch9082: 0083-lwipopts-add-lwip-debug-log-macro.patch
Patch9083: 0084-add-tcpslowtmr-log-and-tcpfasttmr-cnt.patch
Patch9084: 0085-add-lwip-log-tcp_rst-tcp_abandon-tcp_abort.patch
Patch9085: 0086-log-add-errevent-log-and-tcp-exception-statistics.patch
Patch9086: 0087-support-vlan-offload.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
@ -130,6 +131,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Tue Nov 28 2023 zhengjiebing <zhengjiebing@cmss.chinamobile.com> - 2.1.3-90
- support vlan offload
* Tue Nov 28 2023 jiangheng <jiangheng14@huawei.com> - 2.1.3-89
- log: add errevent log and tcp exception statistics