1195972f6Sopenharmony_ciFrom a8ca1b0361d5b31e437fd70d17860248dd44ddf7 Mon Sep 17 00:00:00 2001 2195972f6Sopenharmony_ciFrom: Lemmy Huang <huangliming5@huawei.com> 3195972f6Sopenharmony_ciDate: Thu, 15 Jun 2023 09:06:58 +0800 4195972f6Sopenharmony_ciSubject: [PATCH] adapt to dpdk-19.11 and dpdk-21.11 5195972f6Sopenharmony_ci 6195972f6Sopenharmony_ciSigned-off-by: Lemmy Huang <huangliming5@huawei.com> 7195972f6Sopenharmony_ci--- 8195972f6Sopenharmony_ci src/Makefile | 3 +++ 9195972f6Sopenharmony_ci src/include/arch/sys_arch.h | 1 + 10195972f6Sopenharmony_ci src/include/dpdk_cksum.h | 3 +++ 11195972f6Sopenharmony_ci src/include/dpdk_version.h | 52 +++++++++++++++++++++++++++++++++++++ 12195972f6Sopenharmony_ci src/include/eventpoll.h | 1 + 13195972f6Sopenharmony_ci src/include/reg_sock.h | 2 ++ 14195972f6Sopenharmony_ci 6 files changed, 62 insertions(+) 15195972f6Sopenharmony_ci create mode 100644 src/include/dpdk_version.h 16195972f6Sopenharmony_ci 17195972f6Sopenharmony_cidiff --git a/src/Makefile b/src/Makefile 18195972f6Sopenharmony_ciindex f445601b..480470fb 100644 19195972f6Sopenharmony_ci--- a/src/Makefile 20195972f6Sopenharmony_ci+++ b/src/Makefile 21195972f6Sopenharmony_ci@@ -19,6 +19,9 @@ ARFLAGS = crDP 22195972f6Sopenharmony_ci ifeq ($(shell $(CC) -dumpmachine | cut -d"-" -f1), x86_64) 23195972f6Sopenharmony_ci CFLAGS += -mssse3 24195972f6Sopenharmony_ci endif 25195972f6Sopenharmony_ci+ifeq ($(DPDK_VERSION_1911), 1) 26195972f6Sopenharmony_ci+ CFLAGS += -DDPDK_VERSION_1911=1 27195972f6Sopenharmony_ci+endif 28195972f6Sopenharmony_ci 29195972f6Sopenharmony_ci SRCS = 30195972f6Sopenharmony_ci DIRS = api core netif 31195972f6Sopenharmony_cidiff --git a/src/include/arch/sys_arch.h b/src/include/arch/sys_arch.h 32195972f6Sopenharmony_ciindex 04e3192a..5e95f3d3 100644 33195972f6Sopenharmony_ci--- a/src/include/arch/sys_arch.h 34195972f6Sopenharmony_ci+++ b/src/include/arch/sys_arch.h 35195972f6Sopenharmony_ci@@ -79,6 +79,7 @@ typedef struct sys_thread *sys_thread_t; 36195972f6Sopenharmony_ci #if GAZELLE_ENABLE 37195972f6Sopenharmony_ci extern int eth_dev_poll(void); 38195972f6Sopenharmony_ci #include <rte_ring.h> 39195972f6Sopenharmony_ci+#include "dpdk_version.h" 40195972f6Sopenharmony_ci 41195972f6Sopenharmony_ci /* 42195972f6Sopenharmony_ci gazelle custom rte ring interface 43195972f6Sopenharmony_cidiff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h 44195972f6Sopenharmony_ciindex e41644b5..b48c9267 100644 45195972f6Sopenharmony_ci--- a/src/include/dpdk_cksum.h 46195972f6Sopenharmony_ci+++ b/src/include/dpdk_cksum.h 47195972f6Sopenharmony_ci@@ -34,8 +34,11 @@ 48195972f6Sopenharmony_ci #define __DPDK_CKSUM_H__ 49195972f6Sopenharmony_ci 50195972f6Sopenharmony_ci #include "lwipopts.h" 51195972f6Sopenharmony_ci+ 52195972f6Sopenharmony_ci #if GAZELLE_ENABLE 53195972f6Sopenharmony_ci+#include <stdbool.h> 54195972f6Sopenharmony_ci #include <rte_ethdev.h> 55195972f6Sopenharmony_ci+#include "dpdk_version.h" 56195972f6Sopenharmony_ci 57195972f6Sopenharmony_ci #if CHECKSUM_OFFLOAD_ALL 58195972f6Sopenharmony_ci #include <rte_mbuf_core.h> 59195972f6Sopenharmony_cidiff --git a/src/include/dpdk_version.h b/src/include/dpdk_version.h 60195972f6Sopenharmony_cinew file mode 100644 61195972f6Sopenharmony_ciindex 00000000..43b254a8 62195972f6Sopenharmony_ci--- /dev/null 63195972f6Sopenharmony_ci+++ b/src/include/dpdk_version.h 64195972f6Sopenharmony_ci@@ -0,0 +1,52 @@ 65195972f6Sopenharmony_ci+/* 66195972f6Sopenharmony_ci+ * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 67195972f6Sopenharmony_ci+ * All rights reserved. 68195972f6Sopenharmony_ci+ * 69195972f6Sopenharmony_ci+ * Redistribution and use in source and binary forms, with or without modification, 70195972f6Sopenharmony_ci+ * are permitted provided that the following conditions are met: 71195972f6Sopenharmony_ci+ * 72195972f6Sopenharmony_ci+ * 1. Redistributions of source code must retain the above copyright notice, 73195972f6Sopenharmony_ci+ * this list of conditions and the following disclaimer. 74195972f6Sopenharmony_ci+ * 2. Redistributions in binary form must reproduce the above copyright notice, 75195972f6Sopenharmony_ci+ * this list of conditions and the following disclaimer in the documentation 76195972f6Sopenharmony_ci+ * and/or other materials provided with the distribution. 77195972f6Sopenharmony_ci+ * 3. The name of the author may not be used to endorse or promote products 78195972f6Sopenharmony_ci+ * derived from this software without specific prior written permission. 79195972f6Sopenharmony_ci+ * 80195972f6Sopenharmony_ci+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 81195972f6Sopenharmony_ci+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 82195972f6Sopenharmony_ci+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 83195972f6Sopenharmony_ci+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 84195972f6Sopenharmony_ci+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 85195972f6Sopenharmony_ci+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 86195972f6Sopenharmony_ci+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 87195972f6Sopenharmony_ci+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 88195972f6Sopenharmony_ci+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 89195972f6Sopenharmony_ci+ * OF SUCH DAMAGE. 90195972f6Sopenharmony_ci+ * 91195972f6Sopenharmony_ci+ * This file is part of the lwIP TCP/IP stack. 92195972f6Sopenharmony_ci+ * 93195972f6Sopenharmony_ci+ * Author: Huawei Technologies 94195972f6Sopenharmony_ci+ * 95195972f6Sopenharmony_ci+ */ 96195972f6Sopenharmony_ci+ 97195972f6Sopenharmony_ci+#ifndef __DPDK_VERSION_H__ 98195972f6Sopenharmony_ci+#define __DPDK_VERSION_H__ 99195972f6Sopenharmony_ci+ 100195972f6Sopenharmony_ci+#if DPDK_VERSION_1911 101195972f6Sopenharmony_ci+#define __rte_ring_enqueue_elems(r, prod_head, obj_table, esize, n) \ 102195972f6Sopenharmony_ci+ ENQUEUE_PTRS(r, &r[1], prod_head, (obj_table), n, void *) 103195972f6Sopenharmony_ci+ 104195972f6Sopenharmony_ci+#define __rte_ring_dequeue_elems(r, cons_head, obj_table, esize, n) \ 105195972f6Sopenharmony_ci+ DEQUEUE_PTRS(r, &r[1], cons_head, (obj_table), n, void *) 106195972f6Sopenharmony_ci+ 107195972f6Sopenharmony_ci+#define RTE_MBUF_F_RX_IP_CKSUM_BAD PKT_RX_IP_CKSUM_BAD 108195972f6Sopenharmony_ci+#define RTE_MBUF_F_RX_L4_CKSUM_BAD PKT_RX_L4_CKSUM_BAD 109195972f6Sopenharmony_ci+#define RTE_MBUF_F_TX_IPV4 PKT_TX_IPV4 110195972f6Sopenharmony_ci+#define RTE_MBUF_F_TX_IP_CKSUM PKT_TX_IP_CKSUM 111195972f6Sopenharmony_ci+#define RTE_MBUF_F_TX_TCP_CKSUM PKT_TX_TCP_CKSUM 112195972f6Sopenharmony_ci+#define RTE_MBUF_F_TX_TCP_SEG PKT_TX_TCP_SEG 113195972f6Sopenharmony_ci+ 114195972f6Sopenharmony_ci+#endif /* DPDK_VERSION_1911 */ 115195972f6Sopenharmony_ci+ 116195972f6Sopenharmony_ci+#endif /* __DPDK_VERSION_H__ */ 117195972f6Sopenharmony_cidiff --git a/src/include/eventpoll.h b/src/include/eventpoll.h 118195972f6Sopenharmony_ciindex a10c84bf..dd65a4d5 100644 119195972f6Sopenharmony_ci--- a/src/include/eventpoll.h 120195972f6Sopenharmony_ci+++ b/src/include/eventpoll.h 121195972f6Sopenharmony_ci@@ -35,6 +35,7 @@ 122195972f6Sopenharmony_ci 123195972f6Sopenharmony_ci #include <sys/epoll.h> 124195972f6Sopenharmony_ci 125195972f6Sopenharmony_ci+#include "arch/sys_arch.h" 126195972f6Sopenharmony_ci #include "lwip/api.h" 127195972f6Sopenharmony_ci #include "list.h" 128195972f6Sopenharmony_ci 129195972f6Sopenharmony_cidiff --git a/src/include/reg_sock.h b/src/include/reg_sock.h 130195972f6Sopenharmony_ciindex e349e854..5d5710d7 100644 131195972f6Sopenharmony_ci--- a/src/include/reg_sock.h 132195972f6Sopenharmony_ci+++ b/src/include/reg_sock.h 133195972f6Sopenharmony_ci@@ -33,6 +33,8 @@ 134195972f6Sopenharmony_ci #ifndef __REG_SOCK_H__ 135195972f6Sopenharmony_ci #define __REG_SOCK_H__ 136195972f6Sopenharmony_ci 137195972f6Sopenharmony_ci+#include <stdbool.h> 138195972f6Sopenharmony_ci+ 139195972f6Sopenharmony_ci enum reg_ring_type { 140195972f6Sopenharmony_ci REG_RING_TCP_LISTEN = 0, 141195972f6Sopenharmony_ci REG_RING_TCP_LISTEN_CLOSE, 142195972f6Sopenharmony_ci-- 143195972f6Sopenharmony_ci2.22.0.windows.1 144195972f6Sopenharmony_ci 145