aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2021-06-10 10:00:34 +0300
committerMatias Elo <matias.elo@nokia.com>2021-06-11 12:57:00 +0300
commit4f2d750161038bbb883b01b56932e850682efe24 (patch)
tree52c1cf369bfcb3950294d6eb22eb40644fd12ac2 /platform
parent7b514df6d33dec2114ae35861dc285c4a94dfa85 (diff)
linux-dpdk: pktio: don't enable input hashing automatically
Don't enable input hashing automatically. An application may reasonably expect that all packets will end up in the same input queue when input hashing is not enabled in odp_pktin_queue_param_t. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Diffstat (limited to 'platform')
-rw-r--r--platform/linux-dpdk/odp_packet_dpdk.c48
1 files changed, 19 insertions, 29 deletions
diff --git a/platform/linux-dpdk/odp_packet_dpdk.c b/platform/linux-dpdk/odp_packet_dpdk.c
index ee72e9d10..0f8a1e178 100644
--- a/platform/linux-dpdk/odp_packet_dpdk.c
+++ b/platform/linux-dpdk/odp_packet_dpdk.c
@@ -88,8 +88,8 @@ typedef struct {
typedef struct ODP_ALIGNED_CACHE {
/** Supported RTE_PTYPE_XXX flags in a mask */
uint32_t supported_ptypes;
- /** Packet input hash protocol */
- odp_pktin_hash_proto_t hash;
+ /** RSS configuration */
+ struct rte_eth_rss_conf rss_conf;
char ifname[32];
/** DPDK port identifier */
uint16_t port_id;
@@ -217,7 +217,7 @@ static int _dpdk_netdev_is_valid(const char *s)
return 1;
}
-static void rss_conf_to_hash_proto(struct rte_eth_rss_conf *rss_conf,
+static void hash_proto_to_rss_conf(struct rte_eth_rss_conf *rss_conf,
const odp_pktin_hash_proto_t *hash_proto)
{
if (hash_proto->proto.ipv4_udp)
@@ -260,35 +260,20 @@ static int dpdk_maxlen_set(pktio_entry_t *pktio_entry, uint32_t maxlen_input,
return ret;
}
-static int dpdk_setup_eth_dev(pktio_entry_t *pktio_entry,
- const struct rte_eth_dev_info *dev_info)
+static int dpdk_setup_eth_dev(pktio_entry_t *pktio_entry)
{
int ret;
pkt_dpdk_t *pkt_dpdk = pkt_priv(pktio_entry);
- struct rte_eth_rss_conf rss_conf;
struct rte_eth_conf eth_conf;
- uint64_t rss_hf_capa = dev_info->flow_type_rss_offloads;
pool_t *pool = pool_entry_from_hdl(pktio_entry->s.pool);
uint64_t rx_offloads = 0;
uint64_t tx_offloads = 0;
- memset(&rss_conf, 0, sizeof(struct rte_eth_rss_conf));
-
- /* Always set some hash functions to enable DPDK RSS hash calculation.
- * Hash capability has been checked in pktin config. */
- if (pkt_dpdk->hash.all_bits == 0)
- rss_conf.rss_hf = ETH_RSS_IP | ETH_RSS_TCP | ETH_RSS_UDP;
- else
- rss_conf_to_hash_proto(&rss_conf, &pkt_dpdk->hash);
-
- /* Filter out unsupported flags */
- rss_conf.rss_hf &= rss_hf_capa;
-
memset(&eth_conf, 0, sizeof(eth_conf));
eth_conf.rxmode.mq_mode = ETH_MQ_RX_RSS;
eth_conf.txmode.mq_mode = ETH_MQ_TX_NONE;
- eth_conf.rx_adv_conf.rss_conf = rss_conf;
+ eth_conf.rx_adv_conf.rss_conf = pkt_dpdk->rss_conf;
/* Setup RX checksum offloads */
if (pktio_entry->s.config.pktin.bit.ipv4_chksum)
@@ -355,7 +340,7 @@ static void _dpdk_print_port_mac(uint16_t port_id)
eth_addr.addr_bytes[5]);
}
-static void check_hash_proto(pktio_entry_t *pktio_entry,
+static void prepare_rss_conf(pktio_entry_t *pktio_entry,
const odp_pktin_queue_param_t *p)
{
struct rte_eth_dev_info dev_info;
@@ -363,11 +348,15 @@ static void check_hash_proto(pktio_entry_t *pktio_entry,
pkt_dpdk_t *pkt_dpdk = pkt_priv(pktio_entry);
uint16_t port_id = pkt_dpdk->port_id;
+ memset(&pkt_dpdk->rss_conf, 0, sizeof(struct rte_eth_rss_conf));
+
+ if (!p->hash_enable)
+ return;
+
rte_eth_dev_info_get(port_id, &dev_info);
rss_hf_capa = dev_info.flow_type_rss_offloads;
- /* Print debug info about unsupported hash protocols. Unsupported
- * protocols are later filtered out by dpdk_setup_eth_dev(). */
+ /* Print debug info about unsupported hash protocols */
if (p->hash_proto.proto.ipv4 &&
((rss_hf_capa & ETH_RSS_IPV4) == 0))
ODP_PRINT("DPDK: hash_proto.ipv4 not supported (rss_hf_capa 0x%" PRIx64 ")\n",
@@ -397,6 +386,11 @@ static void check_hash_proto(pktio_entry_t *pktio_entry,
((rss_hf_capa & ETH_RSS_NONFRAG_IPV6_TCP) == 0))
ODP_PRINT("DPDK: hash_proto.ipv6_tcp not supported (rss_hf_capa 0x%" PRIx64 ")\n",
rss_hf_capa);
+
+ hash_proto_to_rss_conf(&pkt_dpdk->rss_conf, &p->hash_proto);
+
+ /* Filter out unsupported hash functions */
+ pkt_dpdk->rss_conf.rss_hf &= rss_hf_capa;
}
static int dpdk_input_queues_config(pktio_entry_t *pktio_entry,
@@ -405,8 +399,7 @@ static int dpdk_input_queues_config(pktio_entry_t *pktio_entry,
odp_pktin_mode_t mode = pktio_entry->s.param.in_mode;
uint8_t lockless;
- if (p->hash_enable)
- check_hash_proto(pktio_entry, p);
+ prepare_rss_conf(pktio_entry, p);
/**
* Scheduler synchronizes input queue polls. Only single thread
@@ -417,9 +410,6 @@ static int dpdk_input_queues_config(pktio_entry_t *pktio_entry,
else
lockless = 0;
- if (p->hash_enable && p->num_queues > 1)
- pkt_priv(pktio_entry)->hash = p->hash_proto;
-
pkt_priv(pktio_entry)->flags.lockless_rx = lockless;
return 0;
@@ -803,7 +793,7 @@ static int dpdk_start(pktio_entry_t *pktio_entry)
rte_eth_dev_info_get(port_id, &dev_info);
/* Setup device */
- if (dpdk_setup_eth_dev(pktio_entry, &dev_info)) {
+ if (dpdk_setup_eth_dev(pktio_entry)) {
ODP_ERR("Failed to configure device\n");
return -1;
}