From 5c795f7bd17608d441d4e2c7f862ad9d45685b93 Mon Sep 17 00:00:00 2001 From: Konstantin Ananyev Date: Tue, 6 Feb 2018 22:17:36 +0000 Subject: tldk: make sure it builds/works with latest dpdk (17.11/18.02) Change-Id: I460b88661656b64558b442c7800b4edc20ad4b56 Signed-off-by: Konstantin Ananyev --- test/gtest/Makefile | 3 +++ test/gtest/test_common.cpp | 7 ++----- test/gtest/test_common.h | 11 +++++++++-- test/gtest/test_tle_udp_stream_gen.h | 24 ++++++++++++------------ 4 files changed, 26 insertions(+), 19 deletions(-) (limited to 'test') 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 #include #include +#include + +#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 { 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; -- cgit 1.2.3-korg