From cecfc87fc706a6ac819aa213b368072fa011bcae Mon Sep 17 00:00:00 2001 From: Jianfeng Tan Date: Thu, 13 Jun 2019 15:14:12 +0800 Subject: dpdk: move to v18.11 as default DPDK version DPDK v18.11 is the latest LTS verison. As of the API/ABI changes introduced in ether at v18.08, we cannot compile l4fwd and nginx with old DPDK versions. Change-Id: I225302d9a257e9bce4aa22ff84d76a57170e7eb7 Signed-off-by: Jianfeng Tan Signed-off-by: Konstantin Ananyev --- README | 2 +- app/nginx/src/tldk/be.c | 21 ++++++++------------- dpdk/Makefile | 8 +------- examples/l4fwd/main.c | 3 +-- examples/l4fwd/pkt.c | 2 +- examples/l4fwd/port.h | 11 ++++------- test/gtest/test_tle_udp_stream_gen.h | 9 +++++---- 7 files changed, 21 insertions(+), 35 deletions(-) diff --git a/README b/README index 16f96b9..2ca150b 100644 --- a/README +++ b/README @@ -41,7 +41,7 @@ 1) Obtain latest supported DPDK version and build it. (refer to http://dpdk.org for information how to download and build it). - Currently supported(tested) DPDK versions: 16.11 LTS, 17.11 LTS, 18.02. + Currently supported(tested) DPDK versions: 18.11 LTS. 2) Make sure that RTE_SDK and RTE_TARGET DPDK related environment variables are setup correctly. 3) Go to the TLDK root directory and type: 'make all'. diff --git a/app/nginx/src/tldk/be.c b/app/nginx/src/tldk/be.c index 3d17b60..1b7b496 100644 --- a/app/nginx/src/tldk/be.c +++ b/app/nginx/src/tldk/be.c @@ -64,7 +64,7 @@ typedef uint8_t dpdk_port_t; static const struct rte_eth_conf port_conf_default = { .rxmode = { - .hw_vlan_strip = 1, + .offloads = DEV_RX_OFFLOAD_VLAN_STRIP, }, }; @@ -201,14 +201,18 @@ port_init(const struct tldk_port_conf *pcf) if ((pcf->rx_offload & RX_CSUM_OFFLOAD) != 0) { RTE_LOG(ERR, USER1, "%s(%u): enabling RX csum offload;\n", __func__, pcf->id); - port_conf.rxmode.hw_ip_checksum = 1; + port_conf.rxmode.offloads |= pcf->rx_offload & RX_CSUM_OFFLOAD; } port_conf.rxmode.max_rx_pkt_len = pcf->mtu + ETHER_CRC_LEN; if (port_conf.rxmode.max_rx_pkt_len > ETHER_MAX_LEN) - port_conf.rxmode.jumbo_frame = 1; + port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; port_conf.rxmode.mq_mode = ETH_MQ_RX_RSS; port_conf.rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IP | ETH_RSS_TCP; + port_conf.rx_adv_conf.rss_conf.rss_hf &= + dev_info.flow_type_rss_offloads; + + port_conf.txmode.offloads = pcf->tx_offload; rc = rte_eth_dev_configure(pcf->id, pcf->nb_queues, pcf->nb_queues, &port_conf); @@ -296,13 +300,11 @@ be_queue_init(struct tldk_ctx *tcx, const tldk_conf_t *cf) uint32_t port_id, i, nb_rxd, nb_txd; struct rte_eth_dev_info dev_info; const struct tldk_ctx_conf *ctx; - const struct tldk_port_conf *pcf; ctx = tcx->cf; for (i = 0; i < ctx->nb_dev; i++) { port_id = ctx->dev[i].port; queue_id = ctx->dev[i].queue; - pcf = &cf->port[port_id]; rte_eth_dev_info_get(port_id, &dev_info); @@ -312,13 +314,6 @@ be_queue_init(struct tldk_ctx *tcx, const tldk_conf_t *cf) nb_txd = RTE_MIN(TX_RING_SIZE, dev_info.tx_desc_lim.nb_max); dev_info.default_txconf.tx_free_thresh = nb_txd / 2; - if (pcf->tx_offload != 0) { - RTE_LOG(ERR, USER1, - "%s(port=%u): enabling full featured TX;\n", - __func__, port_id); - dev_info.default_txconf.txq_flags = 0; - } - socket = rte_eth_dev_socket_id(port_id); rc = rte_eth_rx_queue_setup(port_id, queue_id, nb_rxd, @@ -999,7 +994,7 @@ setup_rx_cb(const struct tldk_dev *td, struct tldk_ctx *tcx) { int32_t rc; uint32_t i, n, smask; - void *cb; + const void *cb; const struct ptype2cb *ptype2cb; static const struct ptype2cb tcp_ptype2cb[] = { diff --git a/dpdk/Makefile b/dpdk/Makefile index 63ddd6c..ddb4287 100644 --- a/dpdk/Makefile +++ b/dpdk/Makefile @@ -14,7 +14,7 @@ # Scripts require non-POSIX parts of bash SHELL := /bin/bash -DPDK_VERSION ?= v17.11 +DPDK_VERSION ?= v18.11 DPDK_BUILD_DIR ?= $(CURDIR)/_build DPDK_INSTALL_DIR ?= $(DPDK_BUILD_DIR)/dpdk/$(RTE_TARGET) DPDK_PKTMBUF_HEADROOM ?= 128 @@ -115,16 +115,10 @@ $(B)/custom-config: $(B)/.patch.ok Makefile $(call set,RTE_LIBRTE_PMD_BOND,y) $(call set,RTE_LIBRTE_IP_FRAG,y) @# not needed - $(call set,RTE_LIBRTE_TIMER,n) $(call set,RTE_LIBRTE_CFGFILE,n) - $(call set,RTE_LIBRTE_LPM,y) - $(call set,RTE_LIBRTE_ACL,n) $(call set,RTE_LIBRTE_POWER,n) $(call set,RTE_LIBRTE_DISTRIBUTOR,n) $(call set,RTE_LIBRTE_REORDER,n) - $(call set,RTE_LIBRTE_PORT,n) - $(call set,RTE_LIBRTE_TABLE,n) - $(call set,RTE_LIBRTE_PIPELINE,n) $(call set,RTE_LIBRTE_FLOW_CLASSIFY,n) $(call set,RTE_LIBRTE_PMD_CRYPTO_SCHEDULER,n) $(call set,RTE_KNI_KMOD,n) diff --git a/examples/l4fwd/main.c b/examples/l4fwd/main.c index ff572be..9396403 100644 --- a/examples/l4fwd/main.c +++ b/examples/l4fwd/main.c @@ -68,8 +68,7 @@ static char proto_name[3][10] = {"udp", "tcp", ""}; static const struct rte_eth_conf port_conf_default = { .rxmode = { - .hw_vlan_strip = 1, - .jumbo_frame = 0, + .offloads = DEV_RX_OFFLOAD_VLAN_STRIP, }, }; diff --git a/examples/l4fwd/pkt.c b/examples/l4fwd/pkt.c index 6dfad0e..43aa9c8 100644 --- a/examples/l4fwd/pkt.c +++ b/examples/l4fwd/pkt.c @@ -946,7 +946,7 @@ setup_rx_cb(const struct netbe_port *uprt, struct netbe_lcore *lc, { int32_t rc; uint32_t i, n, smask; - void *cb; + const void *cb; const struct ptype2cb *ptype2cb; static const struct ptype2cb tcp_ptype2cb[] = { diff --git a/examples/l4fwd/port.h b/examples/l4fwd/port.h index b727b1b..a154844 100644 --- a/examples/l4fwd/port.h +++ b/examples/l4fwd/port.h @@ -180,16 +180,18 @@ port_init(struct netbe_port *uprt, uint32_t proto) if ((uprt->rx_offload & RX_CSUM_OFFLOAD) != 0) { RTE_LOG(ERR, USER1, "%s(%u): enabling RX csum offload;\n", __func__, uprt->id); - port_conf.rxmode.hw_ip_checksum = 1; + port_conf.rxmode.offloads |= uprt->rx_offload & RX_CSUM_OFFLOAD; } port_conf.rxmode.max_rx_pkt_len = uprt->mtu + ETHER_CRC_LEN; if (port_conf.rxmode.max_rx_pkt_len > ETHER_MAX_LEN) - port_conf.rxmode.jumbo_frame = 1; + port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; rc = update_rss_conf(uprt, &dev_info, &port_conf, proto); if (rc != 0) return rc; + port_conf.txmode.offloads = uprt->tx_offload; + rc = rte_eth_dev_configure(uprt->id, uprt->nb_lcore, uprt->nb_lcore, &port_conf); RTE_LOG(NOTICE, USER1, @@ -220,11 +222,6 @@ queue_init(struct netbe_port *uprt, struct rte_mempool *mp) nb_txd = RTE_MIN(TX_RING_SIZE, dev_info.tx_desc_lim.nb_max); dev_info.default_txconf.tx_free_thresh = nb_txd / 2; - if (uprt->tx_offload != 0) { - RTE_LOG(ERR, USER1, "%s(%u): enabling full featured TX;\n", - __func__, uprt->id); - dev_info.default_txconf.txq_flags = 0; - } for (q = 0; q < uprt->nb_lcore; q++) { rc = rte_eth_rx_queue_setup(uprt->id, q, nb_rxd, diff --git a/test/gtest/test_tle_udp_stream_gen.h b/test/gtest/test_tle_udp_stream_gen.h index d9d5337..1f3d210 100644 --- a/test/gtest/test_tle_udp_stream_gen.h +++ b/test/gtest/test_tle_udp_stream_gen.h @@ -195,7 +195,7 @@ struct test_str { vector gen_streams; }; -const char *vdevargs[] = {VDEV_NAME",rx_pcap=" RX_PCAP",tx_pcap=" TX_PCAP}; +const char *vdevargs = "rx_pcap=" RX_PCAP ",tx_pcap=" TX_PCAP; class test_tle_udp_gen_base : public testing::TestWithParam { public: @@ -307,14 +307,15 @@ public: map routes4; map routes6; test_str tp; - void *cb; + const void *cb; }; int 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) + if (rte_eal_hotplug_add("vdev", VDEV_NAME, vdevargs) < 0 || + rte_eth_dev_get_port_by_name(VDEV_NAME, portid) != 0) return -1; cb = rte_eth_add_rx_callback(*portid, 0, typen_rx_callback, nullptr); @@ -332,7 +333,7 @@ test_tle_udp_gen_base::cleanup_devices(dpdk_port_t portid) rte_eth_dev_stop(portid); rte_eth_dev_close(portid); - rte_eth_dev_detach(portid, name); + rte_eal_hotplug_remove("vdev", VDEV_NAME); return 0; } -- cgit 1.2.3-korg