aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ananyev <konstantin.ananyev@intel.com>2018-02-06 22:17:36 +0000
committerKonstantin Ananyev <konstantin.ananyev@intel.com>2018-02-07 17:43:40 +0000
commit5c795f7bd17608d441d4e2c7f862ad9d45685b93 (patch)
tree96947264d77354b9cb880f86333d961d414ce689
parent3726dc50dd2a9873ac05847be80ca615ea4a708b (diff)
tldk: make sure it builds/works with latest dpdk (17.11/18.02)
Change-Id: I460b88661656b64558b442c7800b4edc20ad4b56 Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
-rw-r--r--app/nginx/src/tldk/be.c32
-rw-r--r--app/nginx/src/tldk/module.c9
-rw-r--r--app/nginx/src/tldk/ngx_tldk.h4
-rw-r--r--examples/l4fwd/dpdk_legacy.h104
-rw-r--r--examples/l4fwd/lcore.h92
-rw-r--r--examples/l4fwd/netbe.h4
-rw-r--r--examples/l4fwd/pkt.c28
-rw-r--r--examples/l4fwd/port.h12
-rw-r--r--lib/libtle_l4p/tle_ctx.h4
-rw-r--r--test/gtest/Makefile3
-rw-r--r--test/gtest/test_common.cpp7
-rw-r--r--test/gtest/test_common.h11
-rw-r--r--test/gtest/test_tle_udp_stream_gen.h24
13 files changed, 178 insertions, 156 deletions
diff --git a/app/nginx/src/tldk/be.c b/app/nginx/src/tldk/be.c
index ba4039a..4cb1b1c 100644
--- a/app/nginx/src/tldk/be.c
+++ b/app/nginx/src/tldk/be.c
@@ -27,6 +27,10 @@
#include <assert.h>
#include <netinet/ip6.h>
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+#include "be.h"
#include <rte_version.h>
#include <rte_cycles.h>
#include <rte_ethdev.h>
@@ -38,10 +42,11 @@
#include <tle_tcp.h>
-#include <ngx_config.h>
-#include <ngx_core.h>
-
-#include "be.h"
+#if RTE_VERSION_NUM(17, 11, 0, 0) <= RTE_VERSION
+typedef uint16_t dpdk_port_t;
+#else
+typedef uint8_t dpdk_port_t;
+#endif
#define RX_RING_SIZE 0x400
#define TX_RING_SIZE 0x800
@@ -177,15 +182,17 @@ port_init(const struct tldk_port_conf *pcf)
if ((dev_info.rx_offload_capa & pcf->rx_offload) != pcf->rx_offload) {
RTE_LOG(ERR, USER1,
"port#%u supported/requested RX offloads don't match, "
- "supported: %#x, requested: %#x;\n",
- pcf->id, dev_info.rx_offload_capa, pcf->rx_offload);
+ "supported: %#" PRIx64 ", requested: %#" PRIx64 ";\n",
+ pcf->id, (uint64_t)dev_info.rx_offload_capa,
+ pcf->rx_offload);
return NGX_ERROR;
}
if ((dev_info.tx_offload_capa & pcf->tx_offload) != pcf->tx_offload) {
RTE_LOG(ERR, USER1,
"port#%u supported/requested TX offloads don't match, "
- "supported: %#x, requested: %#x;\n",
- pcf->id, dev_info.tx_offload_capa, pcf->tx_offload);
+ "supported: %#" PRIx64 ", requested: %#" PRIx64 ";\n",
+ pcf->id, (uint64_t)dev_info.tx_offload_capa,
+ pcf->tx_offload);
return NGX_ERROR;
}
@@ -852,7 +859,8 @@ fill_eth_tcp_hdr_len(struct rte_mbuf *m)
* HW can recognize L2/L3 with/without extensions/L4 (ixgbe/igb/fm10k)
*/
static uint16_t
-type0_tcp_rx_callback(__rte_unused uint8_t port, __rte_unused uint16_t queue,
+type0_tcp_rx_callback(__rte_unused dpdk_port_t port,
+ __rte_unused uint16_t queue,
struct rte_mbuf *pkt[], uint16_t nb_pkts,
__rte_unused uint16_t max_pkts, __rte_unused void *user_param)
{
@@ -916,7 +924,8 @@ type0_tcp_rx_callback(__rte_unused uint8_t port, __rte_unused uint16_t queue,
* HW can recognize L2/L3/L4 and fragments (i40e).
*/
static uint16_t
-type1_tcp_rx_callback(__rte_unused uint8_t port, __rte_unused uint16_t queue,
+type1_tcp_rx_callback(__rte_unused dpdk_port_t port,
+ __rte_unused uint16_t queue,
struct rte_mbuf *pkt[], uint16_t nb_pkts,
__rte_unused uint16_t max_pkts, void *user_param)
{
@@ -965,7 +974,8 @@ type1_tcp_rx_callback(__rte_unused uint8_t port, __rte_unused uint16_t queue,
}
static uint16_t
-typen_tcp_rx_callback(__rte_unused uint8_t port, __rte_unused uint16_t queue,
+typen_tcp_rx_callback(__rte_unused dpdk_port_t port,
+ __rte_unused uint16_t queue,
struct rte_mbuf *pkt[], uint16_t nb_pkts,
__rte_unused uint16_t max_pkts, __rte_unused void *user_param)
{
diff --git a/app/nginx/src/tldk/module.c b/app/nginx/src/tldk/module.c
index 4ddea36..67d9746 100644
--- a/app/nginx/src/tldk/module.c
+++ b/app/nginx/src/tldk/module.c
@@ -24,14 +24,15 @@
* SUCH DAMAGE.
*/
-#include <rte_ethdev.h>
-#include <rte_lpm6.h>
-#include <rte_lpm.h>
-
#include <ngx_config.h>
#include <ngx_core.h>
#include "ngx_tldk.h"
+
+#include <rte_ethdev.h>
+#include <rte_lpm6.h>
+#include <rte_lpm.h>
+
#include "be.h"
#include "tldk_sock.h"
diff --git a/app/nginx/src/tldk/ngx_tldk.h b/app/nginx/src/tldk/ngx_tldk.h
index 01ac556..ffd479b 100644
--- a/app/nginx/src/tldk/ngx_tldk.h
+++ b/app/nginx/src/tldk/ngx_tldk.h
@@ -54,8 +54,8 @@ struct tldk_port_conf {
uint32_t nb_queues;
uint32_t queue_map;
uint32_t mtu;
- uint32_t rx_offload;
- uint32_t tx_offload;
+ uint64_t rx_offload;
+ uint64_t tx_offload;
uint32_t ipv4;
struct in6_addr ipv6;
struct ether_addr mac;
diff --git a/examples/l4fwd/dpdk_legacy.h b/examples/l4fwd/dpdk_legacy.h
index 7bf856f..29886b1 100644
--- a/examples/l4fwd/dpdk_legacy.h
+++ b/examples/l4fwd/dpdk_legacy.h
@@ -19,109 +19,15 @@
#include <rte_version.h>
#if RTE_VERSION_NUM(17, 5, 0, 0) <= RTE_VERSION
-#ifndef DPDK_VERSION_GE_1705
-#define DPDK_VERSION_GE_1705
-#endif
-#endif
-
-/*
- * IPv6 destination lookup callback.
- */
-static int
-lpm6_dst_lookup(void *data, const struct in6_addr *addr,
- struct tle_dest *res)
-{
- int32_t rc;
-#ifdef DPDK_VERSION_GE_1705
- uint32_t idx;
+typedef uint32_t dpdk_lpm6_idx_t;
#else
- uint8_t idx;
+typedef uint8_t dpdk_lpm6_idx_t;
#endif
- struct netbe_lcore *lc;
- struct tle_dest *dst;
- uintptr_t p;
-
- lc = data;
- p = (uintptr_t)addr->s6_addr;
- rc = rte_lpm6_lookup(lc->lpm6, (uint8_t *)p, &idx);
- if (rc == 0) {
- dst = &lc->dst6[idx];
- rte_memcpy(res, dst, dst->l2_len + dst->l3_len +
- offsetof(struct tle_dest, hdr));
- }
- return rc;
-}
-
-static int
-netbe_find6(const struct in6_addr *laddr, uint16_t lport,
- const struct in6_addr *raddr, uint32_t belc)
-{
- uint32_t i, j;
-#ifdef DPDK_VERSION_GE_1705
- uint32_t idx;
+#if RTE_VERSION_NUM(17, 11, 0, 0) <= RTE_VERSION
+typedef uint16_t dpdk_port_t;
#else
- uint8_t idx;
+typedef uint8_t dpdk_port_t;
#endif
- struct netbe_lcore *bc;
-
- /* we have exactly one BE, use it for all traffic */
- if (becfg.cpu_num == 1)
- return 0;
-
- /* search by provided be_lcore */
- if (belc != LCORE_ID_ANY) {
- for (i = 0; i != becfg.cpu_num; i++) {
- bc = becfg.cpu + i;
- if (belc == bc->id)
- return i;
- }
- RTE_LOG(NOTICE, USER1, "%s: no stream with belcore=%u\n",
- __func__, belc);
- return -ENOENT;
- }
-
- /* search by local address */
- if (memcmp(laddr, &in6addr_any, sizeof(*laddr)) != 0) {
- for (i = 0; i != becfg.cpu_num; i++) {
- bc = becfg.cpu + i;
- /* search by queue for the local port */
- for (j = 0; j != bc->prtq_num; j++) {
- if (memcmp(laddr, &bc->prtq[j].port.ipv6,
- sizeof(*laddr)) == 0) {
-
- if (lport == 0)
- return i;
-
- if (verify_queue_for_port(bc->prtq + j,
- lport) != 0)
- return i;
- }
- }
- }
- }
-
- /* search by remote address */
- if (memcmp(raddr, &in6addr_any, sizeof(*raddr)) == 0) {
- for (i = 0; i != becfg.cpu_num; i++) {
- bc = becfg.cpu + i;
- if (rte_lpm6_lookup(bc->lpm6,
- (uint8_t *)(uintptr_t)raddr->s6_addr,
- &idx) == 0) {
-
- if (lport == 0)
- return i;
-
- /* search by queue for the local port */
- for (j = 0; j != bc->prtq_num; j++)
- if (verify_queue_for_port(bc->prtq + j,
- lport) != 0)
- return i;
- }
- }
- }
-
- return -ENOENT;
-}
#endif /* DPDK_LEGACY_H_ */
diff --git a/examples/l4fwd/lcore.h b/examples/l4fwd/lcore.h
index 9deddcc..ac2fbbd 100644
--- a/examples/l4fwd/lcore.h
+++ b/examples/l4fwd/lcore.h
@@ -43,6 +43,31 @@ lpm4_dst_lookup(void *data, const struct in_addr *addr,
return rc;
}
+/*
+ * IPv6 destination lookup callback.
+ */
+static int
+lpm6_dst_lookup(void *data, const struct in6_addr *addr,
+ struct tle_dest *res)
+{
+ int32_t rc;
+ dpdk_lpm6_idx_t idx;
+ struct netbe_lcore *lc;
+ struct tle_dest *dst;
+ uintptr_t p;
+
+ lc = data;
+ p = (uintptr_t)addr->s6_addr;
+
+ rc = rte_lpm6_lookup(lc->lpm6, (uint8_t *)p, &idx);
+ if (rc == 0) {
+ dst = &lc->dst6[idx];
+ rte_memcpy(res, dst, dst->l2_len + dst->l3_len +
+ offsetof(struct tle_dest, hdr));
+ }
+ return rc;
+}
+
static int
lcore_lpm_init(struct netbe_lcore *lc)
{
@@ -146,6 +171,73 @@ netbe_find4(const struct in_addr *laddr, const uint16_t lport,
}
static int
+netbe_find6(const struct in6_addr *laddr, uint16_t lport,
+ const struct in6_addr *raddr, uint32_t belc)
+{
+ uint32_t i, j;
+ dpdk_lpm6_idx_t idx;
+ struct netbe_lcore *bc;
+
+ /* we have exactly one BE, use it for all traffic */
+ if (becfg.cpu_num == 1)
+ return 0;
+
+ /* search by provided be_lcore */
+ if (belc != LCORE_ID_ANY) {
+ for (i = 0; i != becfg.cpu_num; i++) {
+ bc = becfg.cpu + i;
+ if (belc == bc->id)
+ return i;
+ }
+ RTE_LOG(NOTICE, USER1, "%s: no stream with belcore=%u\n",
+ __func__, belc);
+ return -ENOENT;
+ }
+
+ /* search by local address */
+ if (memcmp(laddr, &in6addr_any, sizeof(*laddr)) != 0) {
+ for (i = 0; i != becfg.cpu_num; i++) {
+ bc = becfg.cpu + i;
+ /* search by queue for the local port */
+ for (j = 0; j != bc->prtq_num; j++) {
+ if (memcmp(laddr, &bc->prtq[j].port.ipv6,
+ sizeof(*laddr)) == 0) {
+
+ if (lport == 0)
+ return i;
+
+ if (verify_queue_for_port(bc->prtq + j,
+ lport) != 0)
+ return i;
+ }
+ }
+ }
+ }
+
+ /* search by remote address */
+ if (memcmp(raddr, &in6addr_any, sizeof(*raddr)) == 0) {
+ for (i = 0; i != becfg.cpu_num; i++) {
+ bc = becfg.cpu + i;
+ if (rte_lpm6_lookup(bc->lpm6,
+ (uint8_t *)(uintptr_t)raddr->s6_addr,
+ &idx) == 0) {
+
+ if (lport == 0)
+ return i;
+
+ /* search by queue for the local port */
+ for (j = 0; j != bc->prtq_num; j++)
+ if (verify_queue_for_port(bc->prtq + j,
+ lport) != 0)
+ return i;
+ }
+ }
+ }
+
+ return -ENOENT;
+}
+
+static int
create_context(struct netbe_lcore *lc, const struct tle_ctx_param *ctx_prm)
{
uint32_t rc = 0, sid;
diff --git a/examples/l4fwd/netbe.h b/examples/l4fwd/netbe.h
index ebb1345..6d9aa35 100644
--- a/examples/l4fwd/netbe.h
+++ b/examples/l4fwd/netbe.h
@@ -71,8 +71,8 @@ struct netbe_port {
uint32_t nb_lcore;
uint32_t *lcore_id;
uint32_t mtu;
- uint32_t rx_offload;
- uint32_t tx_offload;
+ uint64_t rx_offload;
+ uint64_t tx_offload;
uint32_t ipv4;
struct in6_addr ipv6;
struct ether_addr mac;
diff --git a/examples/l4fwd/pkt.c b/examples/l4fwd/pkt.c
index b9d53ce..6dfad0e 100644
--- a/examples/l4fwd/pkt.c
+++ b/examples/l4fwd/pkt.c
@@ -17,6 +17,7 @@
#include <rte_arp.h>
#include "netbe.h"
+#include "dpdk_legacy.h"
struct ptype2cb {
uint32_t mask;
@@ -230,7 +231,7 @@ fill_ipv6_hdr_len(struct rte_mbuf *m, uint32_t l2, uint32_t fproto,
}
static inline struct rte_mbuf *
-handle_arp(struct rte_mbuf *m, struct netbe_lcore *lc, uint8_t port,
+handle_arp(struct rte_mbuf *m, struct netbe_lcore *lc, dpdk_port_t port,
uint32_t l2len)
{
const struct arp_hdr *ahdr;
@@ -258,7 +259,7 @@ handle_arp(struct rte_mbuf *m, struct netbe_lcore *lc, uint8_t port,
static inline struct rte_mbuf *
fill_eth_tcp_arp_hdr_len(struct rte_mbuf *m, struct netbe_lcore *lc,
- uint8_t port)
+ dpdk_port_t port)
{
uint32_t dlen, l2_len, l3_len, l4_len;
uint16_t etp;
@@ -431,7 +432,7 @@ fix_reassembled(struct rte_mbuf *m, int32_t hwcsum, uint32_t proto)
static struct rte_mbuf *
reassemble(struct rte_mbuf *m, struct netbe_lcore *lc, uint64_t tms,
- uint8_t port, uint32_t proto)
+ dpdk_port_t port, uint32_t proto)
{
uint32_t l3cs;
struct rte_ip_frag_tbl *tbl;
@@ -526,7 +527,8 @@ do { \
* HW can recognize L2/L3 with/without extensions/L4 (ixgbe/igb/fm10k)
*/
static uint16_t
-type0_tcp_rx_callback(__rte_unused uint8_t port, __rte_unused uint16_t queue,
+type0_tcp_rx_callback(__rte_unused dpdk_port_t port,
+ __rte_unused uint16_t queue,
struct rte_mbuf *pkt[], uint16_t nb_pkts,
__rte_unused uint16_t max_pkts, void *user_param)
{
@@ -594,7 +596,7 @@ type0_tcp_rx_callback(__rte_unused uint8_t port, __rte_unused uint16_t queue,
* HW can recognize L2/L3 with/without extensions/L4 (ixgbe/igb/fm10k)
*/
static uint16_t
-type0_udp_rx_callback(uint8_t port, __rte_unused uint16_t queue,
+type0_udp_rx_callback(dpdk_port_t port, __rte_unused uint16_t queue,
struct rte_mbuf *pkt[], uint16_t nb_pkts,
__rte_unused uint16_t max_pkts, void *user_param)
{
@@ -680,7 +682,8 @@ type0_udp_rx_callback(uint8_t port, __rte_unused uint16_t queue,
* HW can recognize L2/L3/L4 and fragments (i40e).
*/
static uint16_t
-type1_tcp_rx_callback(__rte_unused uint8_t port, __rte_unused uint16_t queue,
+type1_tcp_rx_callback(__rte_unused dpdk_port_t port,
+ __rte_unused uint16_t queue,
struct rte_mbuf *pkt[], uint16_t nb_pkts,
__rte_unused uint16_t max_pkts, void *user_param)
{
@@ -734,7 +737,7 @@ type1_tcp_rx_callback(__rte_unused uint8_t port, __rte_unused uint16_t queue,
* HW can recognize L2/L3/L4 and fragments (i40e).
*/
static uint16_t
-type1_udp_rx_callback(uint8_t port, __rte_unused uint16_t queue,
+type1_udp_rx_callback(dpdk_port_t port, __rte_unused uint16_t queue,
struct rte_mbuf *pkt[], uint16_t nb_pkts,
__rte_unused uint16_t max_pkts, void *user_param)
{
@@ -804,8 +807,9 @@ type1_udp_rx_callback(uint8_t port, __rte_unused uint16_t queue,
* generic, assumes HW doesn't recognize any packet type.
*/
static uint16_t
-typen_tcp_arp_rx_callback(uint8_t port, uint16_t queue, struct rte_mbuf *pkt[],
- uint16_t nb_pkts, uint16_t max_pkts, void *user_param)
+typen_tcp_arp_rx_callback(dpdk_port_t port, uint16_t queue,
+ struct rte_mbuf *pkt[], uint16_t nb_pkts, uint16_t max_pkts,
+ void *user_param)
{
uint32_t j, x;
struct netbe_lcore *lc;
@@ -830,8 +834,8 @@ typen_tcp_arp_rx_callback(uint8_t port, uint16_t queue, struct rte_mbuf *pkt[],
}
static uint16_t
-typen_tcp_rx_callback(__rte_unused uint8_t port, __rte_unused uint16_t queue,
- struct rte_mbuf *pkt[], uint16_t nb_pkts,
+typen_tcp_rx_callback(__rte_unused dpdk_port_t port,
+ __rte_unused uint16_t queue, struct rte_mbuf *pkt[], uint16_t nb_pkts,
__rte_unused uint16_t max_pkts, void *user_param)
{
uint32_t j;
@@ -851,7 +855,7 @@ typen_tcp_rx_callback(__rte_unused uint8_t port, __rte_unused uint16_t queue,
}
static uint16_t
-typen_udp_rx_callback(uint8_t port, __rte_unused uint16_t queue,
+typen_udp_rx_callback(dpdk_port_t port, __rte_unused uint16_t queue,
struct rte_mbuf *pkt[], uint16_t nb_pkts,
__rte_unused uint16_t max_pkts, void *user_param)
{
diff --git a/examples/l4fwd/port.h b/examples/l4fwd/port.h
index 04f3ec2..a451f7b 100644
--- a/examples/l4fwd/port.h
+++ b/examples/l4fwd/port.h
@@ -162,15 +162,17 @@ port_init(struct netbe_port *uprt, uint32_t proto)
if ((dev_info.rx_offload_capa & uprt->rx_offload) != uprt->rx_offload) {
RTE_LOG(ERR, USER1,
"port#%u supported/requested RX offloads don't match, "
- "supported: %#x, requested: %#x;\n",
- uprt->id, dev_info.rx_offload_capa, uprt->rx_offload);
+ "supported: %#" PRIx64 ", requested: %#" PRIx64 ";\n",
+ uprt->id, (uint64_t)dev_info.rx_offload_capa,
+ (uint64_t)uprt->rx_offload);
return -EINVAL;
}
if ((dev_info.tx_offload_capa & uprt->tx_offload) != uprt->tx_offload) {
RTE_LOG(ERR, USER1,
"port#%u supported/requested TX offloads don't match, "
- "supported: %#x, requested: %#x;\n",
- uprt->id, dev_info.tx_offload_capa, uprt->tx_offload);
+ "supported: %#" PRIx64 ", requested: %#" PRIx64 ";\n",
+ uprt->id, (uint64_t)dev_info.tx_offload_capa,
+ (uint64_t)uprt->tx_offload);
return -EINVAL;
}
@@ -282,7 +284,7 @@ log_netbe_prt(const struct netbe_port *uprt)
RTE_LOG(NOTICE, USER1,
"uprt %p = <id = %u, lcore = <%s>, mtu = %u, "
- "rx_offload = %u, tx_offload = %u,\n"
+ "rx_offload = %#" PRIx64 ", tx_offload = %#" PRIx64 ",\n"
"ipv4 = %#x, "
"ipv6 = %04hx:%04hx:%04hx:%04hx:%04hx:%04hx:%04hx:%04hx, "
"mac = %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx>;\n"
diff --git a/lib/libtle_l4p/tle_ctx.h b/lib/libtle_l4p/tle_ctx.h
index 0ea4668..de78a6b 100644
--- a/lib/libtle_l4p/tle_ctx.h
+++ b/lib/libtle_l4p/tle_ctx.h
@@ -67,8 +67,8 @@ struct tle_bl_port {
* device parameters.
*/
struct tle_dev_param {
- uint32_t rx_offload; /**< DEV_RX_OFFLOAD_* supported. */
- uint32_t tx_offload; /**< DEV_TX_OFFLOAD_* supported. */
+ uint64_t rx_offload; /**< DEV_RX_OFFLOAD_* supported. */
+ uint64_t tx_offload; /**< DEV_TX_OFFLOAD_* supported. */
struct in_addr local_addr4; /**< local IPv4 address assigned. */
struct in6_addr local_addr6; /**< local IPv6 address assigned. */
struct tle_bl_port bl4; /**< blocked ports for IPv4 address. */
diff --git a/test/gtest/Makefile b/test/gtest/Makefile
index 648c233..c81cf4c 100644
--- a/test/gtest/Makefile
+++ b/test/gtest/Makefile
@@ -91,6 +91,8 @@ CXXFLAGS += -I$(GTEST_DIR)/include
CXXFLAGS += -I$(GMOCK_DIR)/include
CXXFLAGS += -I$(RTE_OUTPUT)/include
+CXXFLAGS += $(EXTRA_CFLAGS)
+
LDFLAGS += -lstdc++
LDFLAGS += -L$(GMOCK_DIR) -lgmock
LDLIBS += -whole-archive -ltle_l4p -ltle_dring
@@ -121,6 +123,7 @@ LDLIBS += gtest-rfc.o
LDLIBS += -lstdc++
LDLIBS += -L$(GMOCK_DIR) -lgmock
+LDLIBS += -L$(GMOCK_DIR)/gtest -lgtest
LDLIBS += -L$(RTE_OUTPUT)/lib
LDLIBS += -whole-archive -ltle_l4p -ltle_dring -ltle_timer
diff --git a/test/gtest/test_common.cpp b/test/gtest/test_common.cpp
index 0bdcebc..65e3a51 100644
--- a/test/gtest/test_common.cpp
+++ b/test/gtest/test_common.cpp
@@ -16,7 +16,7 @@
#include "test_common.h"
int
-port_init(uint8_t port, struct rte_mempool *mbuf_pool)
+port_init(dpdk_port_t port, struct rte_mempool *mbuf_pool)
{
struct rte_eth_conf port_conf;
const uint16_t rx_rings = 1, tx_rings = 1;
@@ -24,9 +24,6 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
int retval;
int socket_id;
- if (port >= rte_eth_dev_count())
- return -1;
-
socket_id = rte_eth_dev_socket_id(port);
memset(&port_conf, 0, sizeof(struct rte_eth_conf));
@@ -243,7 +240,7 @@ fill_eth_hdr_len(struct rte_mbuf *m)
* generic, assumes HW doesn't recognise any packet type.
*/
uint16_t
-typen_rx_callback(uint8_t port, __rte_unused uint16_t queue,
+typen_rx_callback(dpdk_port_t port, __rte_unused uint16_t queue,
struct rte_mbuf *pkt[], uint16_t nb_pkts,
__rte_unused uint16_t max_pkts, void *user_param)
{
diff --git a/test/gtest/test_common.h b/test/gtest/test_common.h
index a7fa41a..9c521b8 100644
--- a/test/gtest/test_common.h
+++ b/test/gtest/test_common.h
@@ -35,6 +35,13 @@
#include <rte_ip.h>
#include <rte_ip_frag.h>
#include <rte_udp.h>
+#include <rte_version.h>
+
+#if RTE_VERSION_NUM(17, 11, 0, 0) <= RTE_VERSION
+typedef uint16_t dpdk_port_t;
+#else
+typedef uint8_t dpdk_port_t;
+#endif
#define RX_RING_SIZE 128
#define TX_RING_SIZE 128
@@ -47,7 +54,7 @@ extern struct rte_mempool *frag_mp;
extern char binpath[PATH_MAX];
-int port_init(uint8_t port, struct rte_mempool *mbuf_pool);
+int port_init(dpdk_port_t port, struct rte_mempool *mbuf_pool);
uint64_t
_mbuf_tx_offload(uint64_t il2, uint64_t il3, uint64_t il4, uint64_t tso,
@@ -86,7 +93,7 @@ void
fill_eth_hdr_len(struct rte_mbuf *m);
uint16_t
-typen_rx_callback(uint8_t port, __rte_unused uint16_t queue,
+typen_rx_callback(dpdk_port_t port, __rte_unused uint16_t queue,
struct rte_mbuf *pkt[], uint16_t nb_pkts,
__rte_unused uint16_t max_pkts, void *user_param);
diff --git a/test/gtest/test_tle_udp_stream_gen.h b/test/gtest/test_tle_udp_stream_gen.h
index 0f3d11b..d9d5337 100644
--- a/test/gtest/test_tle_udp_stream_gen.h
+++ b/test/gtest/test_tle_udp_stream_gen.h
@@ -177,8 +177,8 @@ struct stream_s {
struct dev_s {
string l_ipv4;
string l_ipv6;
- int rx_offload;
- int tx_offload;
+ uint64_t rx_offload;
+ uint64_t tx_offload;
int exp_pkts_bulk_rx;
int exp_pkts_bulk_tx;
int exp_pkts_enoent;
@@ -201,15 +201,15 @@ class test_tle_udp_gen_base : public testing::TestWithParam<test_str> {
public:
tle_ctx *setup_ctx(void);
- tle_dev *setup_dev(tle_ctx *ctx, uint32_t rx_offload,
- uint32_t tx_offload, const char *local_ipv4,
+ tle_dev *setup_dev(tle_ctx *ctx, uint64_t rx_offload,
+ uint64_t tx_offload, const char *local_ipv4,
const char *local_ipv6);
tle_evq *setup_evq(void);
tle_event *setup_event(void);
tle_stream *setup_stream(struct tle_ctx *ctx, int family,
const char *l_ip, const char *r_ip, int l_port, int r_port);
- int setup_devices(uint8_t *portid);
- int cleanup_devices(uint8_t portid);
+ int setup_devices(dpdk_port_t *portid);
+ int cleanup_devices(dpdk_port_t portid);
int prepare_pcaps(string l_ip, string r_ip, int l_port, int r_port,
int nb_pkts, int l3_chksum, int l4_chksum, string rx_pcap_dest);
@@ -296,8 +296,8 @@ public:
cleanup_pcaps(TX_PCAP);
}
- uint8_t nb_ports;
- uint8_t portid;
+ dpdk_port_t nb_ports;
+ dpdk_port_t portid;
uint32_t socket_id;
uint32_t max_events;
struct tle_ctx *ctx;
@@ -311,7 +311,7 @@ public:
};
int
-test_tle_udp_gen_base::setup_devices(uint8_t *portid)
+test_tle_udp_gen_base::setup_devices(dpdk_port_t *portid)
{
/* attach + configure + start pmd device */
if (rte_eth_dev_attach(vdevargs[0], portid) != 0)
@@ -325,7 +325,7 @@ test_tle_udp_gen_base::setup_devices(uint8_t *portid)
}
int
-test_tle_udp_gen_base::cleanup_devices(uint8_t portid)
+test_tle_udp_gen_base::cleanup_devices(dpdk_port_t portid)
{
/* release mbufs + detach device */
char name[RTE_ETH_NAME_MAX_LEN];
@@ -391,8 +391,8 @@ test_tle_udp_gen_base::setup_ctx(void)
}
struct tle_dev *
-test_tle_udp_gen_base::setup_dev(struct tle_ctx *ctx, uint32_t rx_offload,
- uint32_t tx_offload, const char *l_ipv4, const char *l_ipv6)
+test_tle_udp_gen_base::setup_dev(struct tle_ctx *ctx, uint64_t rx_offload,
+ uint64_t tx_offload, const char *l_ipv4, const char *l_ipv6)
{
struct tle_dev *dev;
struct tle_dev_param dev_prm;