Skip to content

Commit

Permalink
Update DPDK to v18. (#287)
Browse files Browse the repository at this point in the history
This change updates DPDK submodule to v18.11.

- Update Pktgen submodule to point to the latest version to remain compatible with DPDK v18.11
- DPDK submodule no longer points to our fork--we now point to the upstream DPDK repository.  This is because mTCP requirements for DPDK have relaxed and they no longer need to have additional patches on top of it.
- Fixes NIC ring RSS hashing functions
- Fixes NIC ring file descriptor size alignment

Commit log:

* Initial dpdk18.08 testing

* Updating port config, queue configs

* Fix indentation to spaces

* Fix the checksum offloading

* Change the .gitmodules dpdk pointer

* Add Lua installation note to pktgen README

* Adding a magic command to fix the dpdk submodule

* Fixed the mtcp build error

* Updating pktgen submodule

* Fix load balancer README
  • Loading branch information
koolzz authored and nks5295 committed Feb 5, 2019
1 parent addaf1f commit abe77ad
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 45 deletions.
13 changes: 7 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
2 changes: 1 addition & 1 deletion dpdk
Submodule dpdk updated from 3bb103 to 0da7f4
4 changes: 3 additions & 1 deletion examples/load_balancer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
81 changes: 46 additions & 35 deletions onvm/onvm_mgr/onvm_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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**********************************/

Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -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");
Expand All @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tools/Pktgen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------

Expand Down
2 changes: 1 addition & 1 deletion tools/Pktgen/pktgen-dpdk
Submodule pktgen-dpdk updated 299 files

0 comments on commit abe77ad

Please sign in to comment.