diff --git a/.gitmodules b/.gitmodules index 71bbde722..5a8520b0b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,8 +1,9 @@ [submodule "dpdk-1.8.0"] - path = dpdk - url = ../../sdnfv/onvm-dpdk.git - branch = onvm + path = dpdk + url = https://dpdk.org/git/dpdk + branch = master + commit = 0da7f445df445630c794897347ee360d6fe6348b [submodule "tools/Pktgen/pktgen-dpdk"] - path = tools/Pktgen/pktgen-dpdk - url = ../../sdnfv/onvm-pktgen.git - branch = onvm + path = tools/Pktgen/pktgen-dpdk + url = ../../sdnfv/onvm-pktgen.git + branch = onvm diff --git a/README.md b/README.md index d594f97f5..bfa6e1ceb 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,10 @@ _Want to get started quickly?_ Try using our NSF CloudLab profile: https://www.c Notes -- -We have updated our DPDK submodule to point to a new version, v17.08. If you have already cloned this repository, please update your DPDK submodule by running: +We have updated our DPDK submodule to point to a new version, v18.11. If you have already cloned this repository, please update your DPDK submodule by running: ``` +git submodule sync git submodule update --init ``` diff --git a/dpdk b/dpdk index 3bb1035c2..0da7f445d 160000 --- a/dpdk +++ b/dpdk @@ -1 +1 @@ -Subproject commit 3bb1035c274c7ee7a98148787a3949c6d42f08d3 +Subproject commit 0da7f445df445630c794897347ee360d6fe6348b diff --git a/examples/load_balancer/README.md b/examples/load_balancer/README.md index bea1290d3..68a4ffdde 100644 --- a/examples/load_balancer/README.md +++ b/examples/load_balancer/README.md @@ -6,7 +6,7 @@ This NF acts as a layer 3, round-robin load balancer. When a packet arrives the App Specific Instuctions -- **Setting up dpdk interfaces** -This NF requires 2 DPDK interfaces to work, both can be setup using the `openNetVM/dpdk/tools/dpdk-setup-iface.sh` script. +This NF requires 2 DPDK interfaces to work, both can be setup using the mTCP submodule iface setup, which can be found at the [mTCP onvm module install guide][mTCP repo]. **Server Config** The server config needs to have the total number of backend servers with their ip and mac address combination, an example config file `server.conf` is provided. @@ -58,3 +58,5 @@ This NF supports the NF generating arguments from a config file. For additional reading, see [Examples.md](../../docs/Examples.md) See `../example_config.json` for all possible options that can be set. + +[mTCP repo]: https://github.com/mtcp-stack/mtcp/tree/devel#onvm-version diff --git a/onvm/onvm_mgr/onvm_init.c b/onvm/onvm_mgr/onvm_init.c index c98c29858..6ab43b7b4 100644 --- a/onvm/onvm_mgr/onvm_init.c +++ b/onvm/onvm_mgr/onvm_init.c @@ -105,43 +105,22 @@ static const struct rte_eth_conf port_conf = { .mq_mode = ETH_MQ_RX_RSS, .max_rx_pkt_len = ETHER_MAX_LEN, .split_hdr_size = 0, - .header_split = 0, /* header split disabled */ - .hw_ip_checksum = 1, /* IP checksum offload enabled */ - .hw_vlan_filter = 0, /* VLAN filtering disabled */ - .jumbo_frame = 0, /* jumbo frame support disabled */ - .hw_strip_crc = 1, /* CRC stripped by hardware */ + .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, .rx_adv_conf = { .rss_conf = { .rss_key = rss_symmetric_key, - .rss_hf = ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP, + .rss_hf = ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP | ETH_RSS_L2_PAYLOAD, }, }, .txmode = { - .mq_mode = ETH_MQ_TX_NONE, + .mq_mode = ETH_MQ_TX_NONE, + .offloads = (DEV_TX_OFFLOAD_IPV4_CKSUM | + DEV_TX_OFFLOAD_UDP_CKSUM | + DEV_TX_OFFLOAD_TCP_CKSUM) }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, - .txq_flags = 0, -}; - /*********************************Interfaces**********************************/ @@ -168,7 +147,7 @@ init(int argc, char *argv[]) { #endif /* get total number of ports */ - total_ports = rte_eth_dev_count(); + total_ports = rte_eth_dev_count_avail(); /* set up array for NF tx data */ mz_nf = rte_memzone_reserve(MZ_NF_INFO, sizeof(*nfs) * MAX_NFS, @@ -330,10 +309,15 @@ init_nf_info_pool(void) static int init_port(uint8_t port_num) { const uint16_t rx_rings = ONVM_NUM_RX_THREADS; - const uint16_t rx_ring_size = RTE_MP_RX_DESC_DEFAULT; + uint16_t rx_ring_size = RTE_MP_RX_DESC_DEFAULT; /* Set the number of tx_rings equal to the tx threads. This mimics the onvm_mgr tx thread calculation. */ const uint16_t tx_rings = rte_lcore_count() - rx_rings - ONVM_NUM_MGR_AUX_THREADS; - const uint16_t tx_ring_size = RTE_MP_TX_DESC_DEFAULT; + uint16_t tx_ring_size = RTE_MP_TX_DESC_DEFAULT; + + struct rte_eth_rxconf rxq_conf; + struct rte_eth_txconf txq_conf; + struct rte_eth_dev_info dev_info; + struct rte_eth_conf local_port_conf = port_conf; uint16_t q; int retval; @@ -346,27 +330,54 @@ init_port(uint8_t port_num) { /* Standard DPDK port initialisation - config port, then set up * rx and tx rings */ + rte_eth_dev_info_get(port_num, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE) + local_port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE; + local_port_conf.rx_adv_conf.rss_conf.rss_hf &= + dev_info.flow_type_rss_offloads; + if (local_port_conf.rx_adv_conf.rss_conf.rss_hf != + port_conf.rx_adv_conf.rss_conf.rss_hf) { + printf("Port %u modified RSS hash function based on hardware support," + "requested:%#"PRIx64" configured:%#"PRIx64"\n", + port_num, + port_conf.rx_adv_conf.rss_conf.rss_hf, + local_port_conf.rx_adv_conf.rss_conf.rss_hf); + } + if ((retval = rte_eth_dev_configure(port_num, rx_rings, tx_rings, - &port_conf)) != 0) + &local_port_conf)) != 0) return retval; + /* Adjust rx,tx ring sizes if not allowed by ethernet device + * TODO if this is ajusted store the new values for future reference */ + retval = rte_eth_dev_adjust_nb_rx_tx_desc( + port_num, &rx_ring_size, &tx_ring_size); + if (retval < 0) { + rte_panic("Cannot adjust number of descriptors for port %u (%d)\n", + port_num, retval); + } + + rxq_conf = dev_info.default_rxconf; + rxq_conf.offloads = local_port_conf.rxmode.offloads; for (q = 0; q < rx_rings; q++) { retval = rte_eth_rx_queue_setup(port_num, q, rx_ring_size, rte_eth_dev_socket_id(port_num), - &rx_conf, pktmbuf_pool); + &rxq_conf, pktmbuf_pool); if (retval < 0) return retval; } + txq_conf = dev_info.default_txconf; + txq_conf.offloads = port_conf.txmode.offloads; for (q = 0; q < tx_rings; q++) { retval = rte_eth_tx_queue_setup(port_num, q, tx_ring_size, rte_eth_dev_socket_id(port_num), - &tx_conf); + &txq_conf); if (retval < 0) return retval; } rte_eth_promiscuous_enable(port_num); - retval = rte_eth_dev_start(port_num); + retval = rte_eth_dev_start(port_num); if (retval < 0) return retval; printf("done: \n"); @@ -392,7 +403,7 @@ init_shm_rings(void) { // use calloc since we allocate for all possible NFs // ensure that all fields are init to 0 to avoid reading garbage // TODO plopreiato, move to creation when a NF starts - for (i = 0; i < MAX_NFS; i++) { + for (i = 0; i < MAX_NFS; i++) { /* Create an RX queue for each NF */ socket_id = rte_socket_id(); rq_name = get_rx_queue_name(i); diff --git a/scripts/install.sh b/scripts/install.sh index 937c1e2e2..81ffa732e 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -80,6 +80,15 @@ start_dir=$(pwd) # Compile dpdk cd $RTE_SDK echo "Compiling and installing dpdk in $RTE_SDK" + +# Adding ldflags.txt output for mTCP compatibility +if grep "ldflags.txt" $RTE_SDK/mk/rte.app.mk > /dev/null +then + : +else + sed -i -e 's/O_TO_EXE_STR =/\$(shell if [ \! -d \${RTE_SDK}\/\${RTE_TARGET}\/lib ]\; then mkdir \${RTE_SDK}\/\${RTE_TARGET}\/lib\; fi)\nLINKER_FLAGS = \$(call linkerprefix,\$(LDLIBS))\n\$(shell echo \${LINKER_FLAGS} \> \${RTE_SDK}\/\${RTE_TARGET}\/lib\/ldflags\.txt)\nO_TO_EXE_STR =/g' $RTE_SDK/mk/rte.app.mk +fi + sleep 1 make config T=$RTE_TARGET make T=$RTE_TARGET -j 8 diff --git a/tools/Pktgen/README.md b/tools/Pktgen/README.md index 2ad2d86bf..3514ef9f6 100644 --- a/tools/Pktgen/README.md +++ b/tools/Pktgen/README.md @@ -64,6 +64,10 @@ Install pcap dependency `sudo apt-get install libpcap-dev` +Download Lua, can be found [here](https://www.lua.org/download.html) +Navigate into the downloaded Lua directory and run +`sudo make install` + 2.2 Build Pktgen Application ------------- diff --git a/tools/Pktgen/pktgen-dpdk b/tools/Pktgen/pktgen-dpdk index cfc2e8571..ad3733ab8 160000 --- a/tools/Pktgen/pktgen-dpdk +++ b/tools/Pktgen/pktgen-dpdk @@ -1 +1 @@ -Subproject commit cfc2e8571d79647a15cf115dbe28cb93fedddb7c +Subproject commit ad3733ab8f7608f01df47fafd0ea01cf6960072a