[PATCH v2 6/7] net/ice: add L2TPv2 RSS hash support

Shaiq Wani
2026-02-09T11:59:03Z

Add RSS (Receive Side Scaling) hash support for L2TPv2 packets.
define hash templates and patterns for distributing L2TPv2 traffic
across multiple receive queues based on session IDs and inner headers.

Signed-off-by: Shaiq Wani <shaiq.wani@intel.com>
Tested-by: Song Jiale <songx.jiale@intel.com>
---
drivers/net/intel/ice/ice_hash.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

diff --git a/drivers/net/intel/ice/ice_hash.c b/drivers/net/intel/ice/ice_hash.c
index afdc8f220a..b20103a452 100644
--- a/drivers/net/intel/ice/ice_hash.c
+++ b/drivers/net/intel/ice/ice_hash.c
@@ -305,6 +305,22 @@ struct ice_rss_hash_cfg eth_ipv4_l2tpv3_tmplt = {
0
};

+struct ice_rss_hash_cfg eth_ipv4_l2tpv2_tmplt = {
+ ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV_OTHER |
+ ICE_FLOW_SEG_HDR_L2TPV2,
+ ICE_FLOW_HASH_L2TPV2_SESS_ID,
+ ICE_RSS_OUTER_HEADERS,
+ 0
+};
+
+struct ice_rss_hash_cfg eth_ipv6_l2tpv2_tmplt = {
+ ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_IPV_OTHER |
+ ICE_FLOW_SEG_HDR_L2TPV2,
+ ICE_FLOW_HASH_L2TPV2_SESS_ID,
+ ICE_RSS_OUTER_HEADERS,
+ 0
+};
+
struct ice_rss_hash_cfg eth_ipv4_pfcp_tmplt = {
ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV_OTHER |
ICE_FLOW_SEG_HDR_PFCP_SESSION,
@@ -480,6 +496,8 @@ struct ice_rss_hash_cfg eth_tmplt = {
#define ICE_RSS_TYPE_IPV6_AH (RTE_ETH_RSS_AH | RTE_ETH_RSS_IPV6)
#define ICE_RSS_TYPE_IPV4_L2TPV3 (RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_IPV4)
#define ICE_RSS_TYPE_IPV6_L2TPV3 (RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_IPV6)
+#define ICE_RSS_TYPE_IPV4_L2TPV2 (RTE_ETH_RSS_L2TPV2 | RTE_ETH_RSS_IPV4)
+#define ICE_RSS_TYPE_IPV6_L2TPV2 (RTE_ETH_RSS_L2TPV2 | RTE_ETH_RSS_IPV6)
#define ICE_RSS_TYPE_IPV4_PFCP (RTE_ETH_RSS_PFCP | RTE_ETH_RSS_IPV4)
#define ICE_RSS_TYPE_IPV6_PFCP (RTE_ETH_RSS_PFCP | RTE_ETH_RSS_IPV6)

@@ -522,6 +540,8 @@ static struct ice_pattern_match_item ice_hash_pattern_list[] = {
{pattern_eth_ipv4_udp_esp, ICE_RSS_TYPE_IPV4_ESP, ICE_INSET_NONE, &eth_ipv4_udp_esp_tmplt},
{pattern_eth_ipv4_ah, ICE_RSS_TYPE_IPV4_AH, ICE_INSET_NONE, &eth_ipv4_ah_tmplt},
{pattern_eth_ipv4_l2tp, ICE_RSS_TYPE_IPV4_L2TPV3, ICE_INSET_NONE, &eth_ipv4_l2tpv3_tmplt},
+ {pattern_eth_ipv4_l2tpv2, ICE_RSS_TYPE_IPV4_L2TPV2, ICE_INSET_NONE, &eth_ipv4_l2tpv2_tmplt},
+ {pattern_eth_ipv6_l2tpv2, ICE_RSS_TYPE_IPV6_L2TPV2, ICE_INSET_NONE, &eth_ipv6_l2tpv2_tmplt},
{pattern_eth_ipv4_pfcp, ICE_RSS_TYPE_IPV4_PFCP, ICE_INSET_NONE, &eth_ipv4_pfcp_tmplt},
/* IPV6 */
{pattern_eth_ipv6, ICE_RSS_TYPE_ETH_IPV6, ICE_INSET_NONE, &ipv6_tmplt},
@@ -925,6 +945,11 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
*hash_flds &= ~ICE_FLOW_HASH_L2TPV3_SESS_ID;
}

+ if (*addl_hdrs & ICE_FLOW_SEG_HDR_L2TPV2) {
+ if (!(rss_type & RTE_ETH_RSS_L2TPV2))
+ *hash_flds &= ~ICE_FLOW_HASH_L2TPV2_SESS_ID;
+ }
+
if (*addl_hdrs & ICE_FLOW_SEG_HDR_ESP) {
if (!(rss_type & RTE_ETH_RSS_ESP))
*hash_flds &= ~ICE_FLOW_HASH_ESP_SPI;
--
2.34.1