• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From a8ca1b0361d5b31e437fd70d17860248dd44ddf7 Mon Sep 17 00:00:00 2001
2From: Lemmy Huang <huangliming5@huawei.com>
3Date: Thu, 15 Jun 2023 09:06:58 +0800
4Subject: [PATCH] adapt to dpdk-19.11 and dpdk-21.11
5
6Signed-off-by: Lemmy Huang <huangliming5@huawei.com>
7---
8 src/Makefile                |  3 +++
9 src/include/arch/sys_arch.h |  1 +
10 src/include/dpdk_cksum.h    |  3 +++
11 src/include/dpdk_version.h  | 52 +++++++++++++++++++++++++++++++++++++
12 src/include/eventpoll.h     |  1 +
13 src/include/reg_sock.h      |  2 ++
14 6 files changed, 62 insertions(+)
15 create mode 100644 src/include/dpdk_version.h
16
17diff --git a/src/Makefile b/src/Makefile
18index f445601b..480470fb 100644
19--- a/src/Makefile
20+++ b/src/Makefile
21@@ -19,6 +19,9 @@ ARFLAGS = crDP
22 ifeq ($(shell $(CC) -dumpmachine | cut -d"-" -f1), x86_64)
23     CFLAGS += -mssse3
24 endif
25+ifeq ($(DPDK_VERSION_1911), 1)
26+    CFLAGS += -DDPDK_VERSION_1911=1
27+endif
28
29 SRCS =
30 DIRS = api core netif
31diff --git a/src/include/arch/sys_arch.h b/src/include/arch/sys_arch.h
32index 04e3192a..5e95f3d3 100644
33--- a/src/include/arch/sys_arch.h
34+++ b/src/include/arch/sys_arch.h
35@@ -79,6 +79,7 @@ typedef struct sys_thread *sys_thread_t;
36 #if GAZELLE_ENABLE
37 extern int eth_dev_poll(void);
38 #include <rte_ring.h>
39+#include "dpdk_version.h"
40
41 /*
42     gazelle custom rte ring interface
43diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h
44index e41644b5..b48c9267 100644
45--- a/src/include/dpdk_cksum.h
46+++ b/src/include/dpdk_cksum.h
47@@ -34,8 +34,11 @@
48 #define __DPDK_CKSUM_H__
49
50 #include "lwipopts.h"
51+
52 #if GAZELLE_ENABLE
53+#include <stdbool.h>
54 #include <rte_ethdev.h>
55+#include "dpdk_version.h"
56
57 #if CHECKSUM_OFFLOAD_ALL
58 #include <rte_mbuf_core.h>
59diff --git a/src/include/dpdk_version.h b/src/include/dpdk_version.h
60new file mode 100644
61index 00000000..43b254a8
62--- /dev/null
63+++ b/src/include/dpdk_version.h
64@@ -0,0 +1,52 @@
65+/*
66+ * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
67+ * All rights reserved.
68+ *
69+ * Redistribution and use in source and binary forms, with or without modification,
70+ * are permitted provided that the following conditions are met:
71+ *
72+ * 1. Redistributions of source code must retain the above copyright notice,
73+ *    this list of conditions and the following disclaimer.
74+ * 2. Redistributions in binary form must reproduce the above copyright notice,
75+ *    this list of conditions and the following disclaimer in the documentation
76+ *    and/or other materials provided with the distribution.
77+ * 3. The name of the author may not be used to endorse or promote products
78+ *    derived from this software without specific prior written permission.
79+ *
80+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
81+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
82+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
83+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
84+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
85+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
86+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
87+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
88+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
89+ * OF SUCH DAMAGE.
90+ *
91+ * This file is part of the lwIP TCP/IP stack.
92+ *
93+ * Author: Huawei Technologies
94+ *
95+ */
96+
97+#ifndef __DPDK_VERSION_H__
98+#define __DPDK_VERSION_H__
99+
100+#if DPDK_VERSION_1911
101+#define __rte_ring_enqueue_elems(r, prod_head, obj_table, esize, n) \
102+    ENQUEUE_PTRS(r, &r[1], prod_head, (obj_table), n, void *)
103+
104+#define __rte_ring_dequeue_elems(r, cons_head, obj_table, esize, n) \
105+    DEQUEUE_PTRS(r, &r[1], cons_head, (obj_table), n, void *)
106+
107+#define RTE_MBUF_F_RX_IP_CKSUM_BAD  PKT_RX_IP_CKSUM_BAD
108+#define RTE_MBUF_F_RX_L4_CKSUM_BAD  PKT_RX_L4_CKSUM_BAD
109+#define RTE_MBUF_F_TX_IPV4          PKT_TX_IPV4
110+#define RTE_MBUF_F_TX_IP_CKSUM      PKT_TX_IP_CKSUM
111+#define RTE_MBUF_F_TX_TCP_CKSUM     PKT_TX_TCP_CKSUM
112+#define RTE_MBUF_F_TX_TCP_SEG       PKT_TX_TCP_SEG
113+
114+#endif /* DPDK_VERSION_1911 */
115+
116+#endif /* __DPDK_VERSION_H__ */
117diff --git a/src/include/eventpoll.h b/src/include/eventpoll.h
118index a10c84bf..dd65a4d5 100644
119--- a/src/include/eventpoll.h
120+++ b/src/include/eventpoll.h
121@@ -35,6 +35,7 @@
122
123 #include <sys/epoll.h>
124
125+#include "arch/sys_arch.h"
126 #include "lwip/api.h"
127 #include "list.h"
128
129diff --git a/src/include/reg_sock.h b/src/include/reg_sock.h
130index e349e854..5d5710d7 100644
131--- a/src/include/reg_sock.h
132+++ b/src/include/reg_sock.h
133@@ -33,6 +33,8 @@
134 #ifndef __REG_SOCK_H__
135 #define __REG_SOCK_H__
136
137+#include <stdbool.h>
138+
139 enum reg_ring_type {
140     REG_RING_TCP_LISTEN = 0,
141     REG_RING_TCP_LISTEN_CLOSE,
142--
1432.22.0.windows.1
144
145