1 Star 0 Fork 49

compile_success/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0103-adapt-for-dpdk-23.11.patch 11.28 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2024-01-13 20:56 . adapt for dpdk-23.11
From 055e167029e3cee7ee8db8f8692efaec0300f374 Mon Sep 17 00:00:00 2001
From: jiangheng <[email protected]>
Date: Sat, 13 Jan 2024 20:52:37 +0800
Subject: [PATCH] adapt for dpdk-23.11
---
src/Makefile | 3 ---
src/core/ipv4/icmp.c | 2 +-
src/core/ipv4/ip4.c | 6 ++---
src/core/ipv4/ip4_frag.c | 4 ++--
src/core/ipv6/ip6.c | 2 +-
src/core/tcp_in.c | 2 +-
src/core/tcp_out.c | 6 ++---
src/core/udp.c | 4 ++--
src/include/dpdk_version.h | 46 ++++++++++++++++++++++++++++----------
src/netif/ethernet.c | 4 ++--
10 files changed, 49 insertions(+), 30 deletions(-)
diff --git a/src/Makefile b/src/Makefile
index 480470f..f445601 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -19,9 +19,6 @@ ARFLAGS = crDP
ifeq ($(shell $(CC) -dumpmachine | cut -d"-" -f1), x86_64)
CFLAGS += -mssse3
endif
-ifeq ($(DPDK_VERSION_1911), 1)
- CFLAGS += -DDPDK_VERSION_1911=1
-endif
SRCS =
DIRS = api core netif
diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c
index c3a877c..6bab368 100644
--- a/src/core/ipv4/icmp.c
+++ b/src/core/ipv4/icmp.c
@@ -241,7 +241,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
#if CHECKSUM_GEN_IP
IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_GEN_IP) {
#if CHECKSUM_GEN_IP_HW
- if (netif_get_txol_flags(inp) & DEV_TX_OFFLOAD_IPV4_CKSUM) {
+ if (netif_get_txol_flags(inp) & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) {
iph_cksum_set(p, hlen, 1);
} else {
iph_cksum_set(p, hlen, 0);
diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
index 1e3690f..9e962eb 100644
--- a/src/core/ipv4/ip4.c
+++ b/src/core/ipv4/ip4.c
@@ -509,7 +509,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_CHECK_IP) {
#if CHECKSUM_CHECK_IP_HW
u64_t ret;
- if (netif_get_rxol_flags(inp) & DEV_RX_OFFLOAD_IPV4_CKSUM) {
+ if (netif_get_rxol_flags(inp) & RTE_ETH_RX_OFFLOAD_IPV4_CKSUM) {
ret = is_cksum_ipbad(p);
} else {
ret = (u64_t)inet_chksum(iphdr, iphdr_hlen);
@@ -986,7 +986,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
#if CHECKSUM_GEN_IP
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) {
#if CHECKSUM_GEN_IP_HW
- if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_IPV4_CKSUM) {
+ if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) {
iph_cksum_set(p, ip_hlen, 1);
} else {
iph_cksum_set(p, ip_hlen, 0);
@@ -1035,7 +1035,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
#if IP_FRAG
/* don't fragment if interface has mtu set to 0 [loopif] */
#if GAZELLE_ENABLE
- if (!(netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_TSO)) {
+ if (!(netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_TSO)) {
#endif
if (netif->mtu && (p->tot_len > netif->mtu)) {
return ip4_frag(p, netif, dest);
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
index 3f2521c..98d8b56 100644
--- a/src/core/ipv4/ip4_frag.c
+++ b/src/core/ipv4/ip4_frag.c
@@ -642,7 +642,7 @@ ip4_reass(struct pbuf *p)
#if CHECKSUM_GEN_IP
IF__NETIF_CHECKSUM_ENABLED(netif_default, NETIF_CHECKSUM_GEN_IP) {
#if CHECKSUM_GEN_IP_HW
- if (netif_get_txol_flags(netif_default) & DEV_TX_OFFLOAD_IPV4_CKSUM) {
+ if (netif_get_txol_flags(netif_default) & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) {
iph_cksum_set(p, IP_HLEN, 1);
} else {
iph_cksum_set(p, IP_HLEN, 0);
@@ -885,7 +885,7 @@ ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest)
#if CHECKSUM_GEN_IP
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) {
#if CHECKSUM_GEN_IP_HW
- if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_IPV4_CKSUM) {
+ if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) {
iph_cksum_set(p, IP_HLEN, 1);
} else {
iph_cksum_set(p, IP_HLEN, 0);
diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c
index 7f74f31..1f0e0f6 100644
--- a/src/core/ipv6/ip6.c
+++ b/src/core/ipv6/ip6.c
@@ -1279,7 +1279,7 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
#if LWIP_IPV6_FRAG
/* don't fragment if interface has mtu set to 0 [loopif] */
#if GAZELLE_ENABLE
- if (!(netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_TSO)) {
+ if (!(netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_TSO)) {
#endif
if (netif_mtu6(netif) && (p->tot_len > nd6_get_destination_mtu(dest, netif))) {
return ip6_frag(p, netif, dest);
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index b86232b..ec1905f 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -209,7 +209,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
/* Verify TCP checksum. */
#if CHECKSUM_CHECK_TCP_HW
u64_t ret;
- if (netif_get_rxol_flags(inp) & DEV_RX_OFFLOAD_TCP_CKSUM) {
+ if (netif_get_rxol_flags(inp) & RTE_ETH_RX_OFFLOAD_TCP_CKSUM) {
ret = is_cksum_bad(p);
} else {
ret = (u64_t)ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index e5c407e..7b6a1f6 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1552,7 +1552,7 @@ tcp_output(struct tcp_pcb *pcb)
/* data available and window allows it to be sent? */
#if GAZELLE_ENABLE
- if ((netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_TSO) && pcb->need_tso_send) {
+ if ((netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_TSO) && pcb->need_tso_send) {
uint16_t send_pkt = 0;
do {
@@ -1935,7 +1935,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
#if CHECKSUM_GEN_TCP
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
#if CHECKSUM_GEN_TCP_HW
- if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_CKSUM) {
+ if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) {
tcph_cksum_set(seg->p, TCPH_HDRLEN_BYTES(seg->tcphdr));
seg->tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP,seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip);
} else {
@@ -2378,7 +2378,7 @@ tcp_output_control_segment(struct tcp_pcb *pcb, struct pbuf *p,
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
#if CHECKSUM_GEN_TCP_HW
- if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_CKSUM) {
+ if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) {
tcph_cksum_set(p, TCPH_HDRLEN_BYTES(tcphdr));
tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP, p->tot_len, src, dst);
} else {
diff --git a/src/core/udp.c b/src/core/udp.c
index c150b38..718f9f4 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -414,7 +414,7 @@ udp_input(struct pbuf *p, struct netif *inp)
if (udphdr->chksum != 0) {
#if CHECKSUM_CHECK_UDP_HW
u64_t ret = 0;
- if (netif_get_rxol_flags(inp) & DEV_RX_OFFLOAD_UDP_CKSUM) {
+ if (netif_get_rxol_flags(inp) & RTE_ETH_RX_OFFLOAD_UDP_CKSUM) {
ret = is_cksum_bad(p);
} else {
ret = ip_chksum_pseudo(p, IP_PROTO_UDP, p->tot_len,
@@ -983,7 +983,7 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
#endif /* LWIP_CHECKSUM_ON_COPY */
{
#if CHECKSUM_GEN_UDP_HW
- if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_UDP_CKSUM) {
+ if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_UDP_CKSUM) {
udph_cksum_set(q, UDP_HLEN);
udpchksum = ip_chksum_pseudo_offload(IP_PROTO_UDP, q->tot_len, &pcb->local_ip, &pcb->remote_ip);
} else {
diff --git a/src/include/dpdk_version.h b/src/include/dpdk_version.h
index 5efaa39..b38416a 100644
--- a/src/include/dpdk_version.h
+++ b/src/include/dpdk_version.h
@@ -33,23 +33,47 @@
#ifndef __DPDK_VERSION_H__
#define __DPDK_VERSION_H__
-#if DPDK_VERSION_1911
+#include <rte_version.h>
+
+#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
#define __rte_ring_enqueue_elems(r, prod_head, obj_table, esize, n) \
ENQUEUE_PTRS(r, &r[1], prod_head, (obj_table), n, void *)
#define __rte_ring_dequeue_elems(r, cons_head, obj_table, esize, n) \
DEQUEUE_PTRS(r, &r[1], cons_head, (obj_table), n, void *)
-#define RTE_MBUF_F_RX_IP_CKSUM_BAD PKT_RX_IP_CKSUM_BAD
-#define RTE_MBUF_F_RX_L4_CKSUM_BAD PKT_RX_L4_CKSUM_BAD
-#define RTE_MBUF_F_TX_IPV4 PKT_TX_IPV4
-#define RTE_MBUF_F_TX_IPV6 PKT_TX_IPV6
-#define RTE_MBUF_F_TX_IP_CKSUM PKT_TX_IP_CKSUM
-#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 */
+#define RTE_MBUF_F_RX_IP_CKSUM_BAD PKT_RX_IP_CKSUM_BAD
+#define RTE_MBUF_F_RX_L4_CKSUM_BAD PKT_RX_L4_CKSUM_BAD
+#define RTE_MBUF_F_TX_IPV4 PKT_TX_IPV4
+#define RTE_MBUF_F_TX_IPV6 PKT_TX_IPV6
+#define RTE_MBUF_F_TX_IP_CKSUM PKT_TX_IP_CKSUM
+#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
+
+#define RTE_ETH_RX_OFFLOAD_TCP_CKSUM DEV_RX_OFFLOAD_TCP_CKSUM
+#define RTE_ETH_RX_OFFLOAD_UDP_CKSUM DEV_RX_OFFLOAD_UDP_CKSUM
+#define RTE_ETH_RX_OFFLOAD_IPV4_CKSUM DEV_RX_OFFLOAD_IPV4_CKSUM
+#define RTE_ETH_RX_OFFLOAD_VLAN_STRIP DEV_RX_OFFLOAD_VLAN_STRIP
+
+#define RTE_ETH_TX_OFFLOAD_IPV4_CKSUM DEV_TX_OFFLOAD_IPV4_CKSUM
+#define RTE_ETH_TX_OFFLOAD_VLAN_INSERT DEV_TX_OFFLOAD_VLAN_INSERT
+#define RTE_ETH_TX_OFFLOAD_TCP_TSO DEV_TX_OFFLOAD_TCP_TSO
+#define RTE_ETH_TX_OFFLOAD_TCP_CKSUM DEV_TX_OFFLOAD_TCP_CKSUM
+#define RTE_ETH_TX_OFFLOAD_UDP_CKSUM DEV_TX_OFFLOAD_UDP_CKSUM
+#define RTE_ETH_TX_OFFLOAD_MULTI_SEGS DEV_TX_OFFLOAD_MULTI_SEGS
+
+#define RTE_ETH_LINK_SPEED_AUTONEG ETH_LINK_SPEED_AUTONEG
+
+#define RTE_ETH_MQ_TX_NONE ETH_MQ_TX_NONE
+#define RTE_ETH_MQ_RX_NONE ETH_MQ_RX_NONE
+#define RTE_ETH_RSS_IP ETH_RSS_IP
+#define RTE_ETH_RSS_TCP ETH_RSS_TCP
+#define RTE_ETH_RSS_UDP ETH_RSS_UDP
+#define RTE_ETH_MQ_RX_RSS ETH_MQ_RX_RSS
+#define RTE_ETH_RETA_GROUP_SIZE RTE_RETA_GROUP_SIZE
+
+#endif /* RTE_VERSION */
#endif /* __DPDK_VERSION_H__ */
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index 0be1289..afd13ad 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -289,7 +289,7 @@ ethernet_output(struct netif * netif, struct pbuf * p,
}
#else
if (netif->vlan_enable) {
- if (netif->txol_flags & DEV_TX_OFFLOAD_VLAN_INSERT) {
+ if (netif->txol_flags & RTE_ETH_TX_OFFLOAD_VLAN_INSERT) {
p->ol_flags |= RTE_MBUF_F_TX_VLAN;
p->vlan_tci = netif->vlan_tci;
} else {
@@ -332,7 +332,7 @@ 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 (netif->vlan_enable && !(netif->txol_flags & DEV_TX_OFFLOAD_VLAN_INSERT)) {
+ if (netif->vlan_enable && !(netif->txol_flags & RTE_ETH_TX_OFFLOAD_VLAN_INSERT)) {
ethh_cksum_set(p, sizeof(*ethhdr) + SIZEOF_VLAN_HDR);
} else {
ethh_cksum_set(p, sizeof(*ethhdr));
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/compile_success/lwip.git
[email protected]:compile_success/lwip.git
compile_success
lwip
lwip
master

搜索帮助