diff options
author | Matias Elo <matias.elo@nokia.com> | 2019-10-08 13:38:21 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2019-10-23 11:35:58 +0300 |
commit | c723055094546df3890efb0f6a5f02b59cb4cb34 (patch) | |
tree | 9f1ecf5a674cea4e1ebbfaf27f72e684599e9a1b | |
parent | 7610aab45d2a307d883c62ee56fbc0430fabf2b2 (diff) |
linux-gen: dpdk: make storing packet flow hash configurable
Make saving RX RSS hash as ODP flow hash optional (disabled by default).
This improves performance by removing a write operation to an additional
cache line.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
-rw-r--r-- | config/odp-linux-generic.conf | 5 | ||||
-rw-r--r-- | platform/linux-generic/pktio/dpdk.c | 18 | ||||
-rw-r--r-- | platform/linux-generic/test/inline-timer.conf | 2 | ||||
-rw-r--r-- | platform/linux-generic/test/process-mode.conf | 2 |
4 files changed, 18 insertions, 9 deletions
diff --git a/config/odp-linux-generic.conf b/config/odp-linux-generic.conf index 4fec05047..4e24ef82d 100644 --- a/config/odp-linux-generic.conf +++ b/config/odp-linux-generic.conf @@ -16,7 +16,7 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.8" +config_file_version = "0.1.9" # Shared memory options shm: { @@ -70,6 +70,9 @@ pktio_dpdk: { num_tx_desc = 512 rx_drop_en = 0 + # Store RX RSS hash result as ODP flow hash + set_flow_hash = 0 + # Driver specific options (use PMD names from DPDK) net_ixgbe: { rx_drop_en = 1 diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index cc0a4368c..93cec349d 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -92,7 +92,8 @@ ODP_STATIC_ASSERT((DPDK_NB_MBUF % DPDK_MEMPOOL_CACHE_SIZE == 0) && typedef struct { int num_rx_desc; int num_tx_desc; - int rx_drop_en; + uint8_t rx_drop_en; + uint8_t set_flow_hash; } dpdk_opt_t; struct pkt_cache_t { @@ -169,6 +170,7 @@ static int init_options(pktio_entry_t *pktio_entry, const struct rte_eth_dev_info *dev_info) { dpdk_opt_t *opt = &pkt_priv(pktio_entry)->opt; + int val; if (!lookup_opt("num_rx_desc", dev_info->driver_name, &opt->num_rx_desc)) @@ -190,10 +192,13 @@ static int init_options(pktio_entry_t *pktio_entry, return -1; } - if (!lookup_opt("rx_drop_en", dev_info->driver_name, - &opt->rx_drop_en)) + if (!lookup_opt("rx_drop_en", dev_info->driver_name, &val)) return -1; - opt->rx_drop_en = !!opt->rx_drop_en; + opt->rx_drop_en = !!val; + + if (!lookup_opt("set_flow_hash", NULL, &val)) + return -1; + opt->set_flow_hash = !!val; ODP_PRINT("DPDK interface (%s): %" PRIu16 "\n", dev_info->driver_name, pkt_priv(pktio_entry)->port_id); @@ -810,6 +815,7 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t *pktio_entry, { odp_packet_hdr_t *pkt_hdr; uint16_t pkt_len; + uint8_t set_flow_hash; struct rte_mbuf *mbuf; void *data; int i, nb_pkts; @@ -824,6 +830,7 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t *pktio_entry, pkt_dpdk = pkt_priv(pktio_entry); nb_pkts = 0; pool = pkt_dpdk->pool; + set_flow_hash = pkt_dpdk->opt.set_flow_hash; pktin_cfg = pktio_entry->s.config.pktin; parse_layer = pktio_entry->s.config.parser.layer; input = pktio_entry->s.handle; @@ -893,8 +900,7 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t *pktio_entry, continue; } } - - if (mbuf->ol_flags & PKT_RX_RSS_HASH) + if (set_flow_hash && (mbuf->ol_flags & PKT_RX_RSS_HASH)) packet_set_flow_hash(pkt_hdr, mbuf->hash.rss); packet_set_ts(pkt_hdr, ts); diff --git a/platform/linux-generic/test/inline-timer.conf b/platform/linux-generic/test/inline-timer.conf index 03998f5f5..435f51e6d 100644 --- a/platform/linux-generic/test/inline-timer.conf +++ b/platform/linux-generic/test/inline-timer.conf @@ -1,6 +1,6 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.8" +config_file_version = "0.1.9" timer: { # Enable inline timer implementation diff --git a/platform/linux-generic/test/process-mode.conf b/platform/linux-generic/test/process-mode.conf index dbf2acb81..708b9b4a8 100644 --- a/platform/linux-generic/test/process-mode.conf +++ b/platform/linux-generic/test/process-mode.conf @@ -1,6 +1,6 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.8" +config_file_version = "0.1.9" # Shared memory options shm: { |