Honour RTE_ETH_RSS_LEVEL_INNERMOST in the RSS configuration. When it is set, program the IP extracts with hdr_index = HDR_INDEX_LAST so the RSS key uses the innermost IP header instead of the outer one.
This is useful for tunnelled traffic whose outer headers are fixed, leaving no entropy for an outer IP hash. Hashing on the inner IP addresses spreads such flows. The hdr_index field is only defined for IP/IPv4/IPv6, VLAN and MPLS extracts, so this patch only controls the IP extracts. L4 extracts do not have a header-instance selector and keep hdr_index 0; they continue to use the parser-selected L4 offset. The RSS level is carried in the high bits of rss_hf; extract it and strip the level bits before walking the protocol bits so they are not mistaken for an unsupported hash type. The level is also advertised in flow_type_rss_offloads, otherwise ethdev rejects an rss_hf carrying it. Signed-off-by: Maxime Leroy <[email protected]> --- doc/guides/rel_notes/release_26_07.rst | 4 ++++ drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 23 +++++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.c | 3 ++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_26_07.rst b/doc/guides/rel_notes/release_26_07.rst index 5d7aa8d1bf..39f3988198 100644 --- a/doc/guides/rel_notes/release_26_07.rst +++ b/doc/guides/rel_notes/release_26_07.rst @@ -140,6 +140,10 @@ New Features * Added support for selective Rx in scalar SPRQ Rx path. +* **Updated NXP dpaa2 driver.** + + * Added inner RSS level support for tunnelled traffic. + * **Updated PCAP ethernet driver.** * Added support for VLAN insertion and stripping. diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index 2724672a5e..8a05253bbd 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -220,6 +220,13 @@ dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev, return ret; } +/* dpkg from_hdr.hdr_index value selecting the innermost IP instance (see + * fsl_dpkg.h, where hdr_index is only defined for NET_PROT_IP/IPv4/IPv6/ + * VLAN/MPLS). Used to hash on the inner IP of tunnelled traffic when + * RTE_ETH_RSS_LEVEL_INNERMOST is requested. + */ +#define DPAA2_DIST_HDR_INDEX_LAST 0xff + int dpaa2_distset_to_dpkg_profile_cfg( uint64_t req_dist_set, @@ -234,8 +241,18 @@ dpaa2_distset_to_dpkg_profile_cfg( int esp_configured = 0; int ah_configured = 0; int pppoe_configured = 0; + uint8_t hdr_index = 0; memset(kg_cfg, 0, sizeof(struct dpkg_profile_cfg)); + + /* RTE_ETH_RSS_LEVEL_INNERMOST asks for the inner header to be hashed. + * Map it to the innermost IP instance in the key extracts; the level + * bits are not protocol bits, so strip them before the loop. + */ + if ((req_dist_set & RTE_ETH_RSS_LEVEL_MASK) == RTE_ETH_RSS_LEVEL_INNERMOST) + hdr_index = DPAA2_DIST_HDR_INDEX_LAST; + req_dist_set &= ~RTE_ETH_RSS_LEVEL_MASK; + while (req_dist_set) { if (req_dist_set % 2 != 0) { dist_field = 1ULL << loop; @@ -373,6 +390,8 @@ dpaa2_distset_to_dpkg_profile_cfg( kg_cfg->extracts[i].extract.from_hdr.prot = NET_PROT_IP; + kg_cfg->extracts[i].extract.from_hdr.hdr_index = + hdr_index; kg_cfg->extracts[i].extract.from_hdr.field = NH_FLD_IP_SRC; kg_cfg->extracts[i].type = @@ -383,6 +402,8 @@ dpaa2_distset_to_dpkg_profile_cfg( kg_cfg->extracts[i].extract.from_hdr.prot = NET_PROT_IP; + kg_cfg->extracts[i].extract.from_hdr.hdr_index = + hdr_index; kg_cfg->extracts[i].extract.from_hdr.field = NH_FLD_IP_DST; kg_cfg->extracts[i].type = @@ -393,6 +414,8 @@ dpaa2_distset_to_dpkg_profile_cfg( kg_cfg->extracts[i].extract.from_hdr.prot = NET_PROT_IP; + kg_cfg->extracts[i].extract.from_hdr.hdr_index = + hdr_index; kg_cfg->extracts[i].extract.from_hdr.field = NH_FLD_IP_PROTO; kg_cfg->extracts[i].type = diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 803a8321e0..c19736fb80 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -424,7 +424,8 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, dev_info->max_hash_mac_addrs = 0; dev_info->max_vfs = 0; dev_info->max_vmdq_pools = RTE_ETH_16_POOLS; - dev_info->flow_type_rss_offloads = DPAA2_RSS_OFFLOAD_ALL; + dev_info->flow_type_rss_offloads = DPAA2_RSS_OFFLOAD_ALL | + RTE_ETH_RSS_LEVEL_OUTERMOST | RTE_ETH_RSS_LEVEL_INNERMOST; dev_info->default_rxportconf.burst_size = dpaa2_dqrr_size; /* same is rx size for best perf */ -- 2.43.0

