net/ice: fix rss simple_xor hash function
PATCH 1/1 net/ice: fix rss simple_xor hash function
RSS Simple XOR hash function is supported by the NIC as per datasheet & also in ICE Linux Ethernet kernel driver but the same is not enabled in ICE PMD even though code support is already present.
This patch fixes the issue by removing the simple_xor check & adding proper error log for empty argument.
Bugzilla ID: 1518
--- drivers/net/intel/ice/ice_hash.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/intel/ice/ice_hash.c +4 -5
@@ -1109,12 +1109,11 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, rss_type = rss->types;/* Check hash function and save it to rss_meta. */ -if (pattern_match_item->pattern_list != - pattern_empty && rss->func == -RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ) { -return rte_flow_error_set (error,ENOTSUP , +if (pattern_match_item->pattern_list == + pattern_empty) { +return rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION , action, -"Not supported flow" ); +"Invalid empty argument" ); }else if (rss->func ==RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ){ rss_meta->hash_function =
Signature · 1 line
2.34.1
Quoted 8 lines · Anurag Mandal
RSS Simple XOR hash function is supported by the NIC as per datasheet & also in ICE Linux Ethernet kernel driver but the same is not enabled in ICE PMD even though code support is already present.
This patch fixes the issue by removing the
simple_xorcheck & adding proper error log for empty argument.
Quoted 6 lines
Bugzilla ID: 1518
Fixes 0b952714e9c1 ("net/ice: refactor PF hash flow")Signed-off-by Anurag Mandal <[email protected]>---
Hi,
Quoted 11 lines
drivers/net/intel/ice/ice_hash.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/net/intel/ice/ice_hash.c +0
-0@@ -1109,12 +1109,11 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, rss_type = rss->types;/* Check hash function and save it to rss_meta. */
drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, · line 1116
Quoted 10 lines
drivers/net/intel/ice/ice_hash.c +4
-5-if (pattern_match_item->pattern_list != - pattern_empty && rss->func == -RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ) { -return rte_flow_error_set (error,ENOTSUP , +if (pattern_match_item->pattern_list == + pattern_empty) { +return rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION , action, -"Not supported flow" ); +"Invalid empty argument" );
I think this changes existing semantics a little too far.
The original code disallowed simple XOR only for cases where pattern wasn't empty (if it was, we allowed it - i.e. if it was a global RSS configuration). The fix disallows empty patterns altogether, whereas what it should've done instead is remove this check, and instead modify the second check to look for empty patterns (because otherwise we would go through further checks down the line for non-empty patterns).
Quoted 3 lines
drivers/net/intel/ice/ice_hash.c +0
-0}else if (rss->func ==RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ){ rss_meta->hash_function =
Signature · 2 lines
Thanks, Anatoly
Quoted 60 lines
-----Original Message-----
From: Burakov, Anatoly <[email protected]>
Sent: 09 March 2026 15:49
To: Mandal, Anurag <[email protected]>; [email protected]
Cc: Richardson, Bruce <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH] net/ice: fix rsssimple_xorhash functionQuoted 7 lines · Anurag Mandal
RSS Simple XOR hash function is supported by the NIC as per datasheet & also in ICE Linux Ethernet kernel driver but the same is not enabled in ICE PMD even though code support is already present.
This patch fixes the issue by removing the
simple_xorcheck & adding proper error log for empty argument.Quoted 6 lines
Bugzilla ID: 1518
Fixes 0b952714e9c1 ("net/ice: refactor PF hash flow")Signed-off-by Anurag Mandal <[email protected]>---
Hi,
drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct
Quoted 9 lines
drivers/net/intel/ice/ice_hash.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/net/intel/ice/ice_hash.c +0
-0@@ -1109,12 +1109,11 @@ ice_hash_parse_action(struct
ice_pattern_match_item*pattern_match_item,drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,
Quoted 11 lines
drivers/net/intel/ice/ice_hash.c +3
-4rss_type = rss->types;/* Check hash function and save it to rss_meta. */ -if (pattern_match_item->pattern_list != - pattern_empty && rss->func == -RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ) { - return rte_flow_error_set(error, ENOTSUP, +if (pattern_match_item->pattern_list == + pattern_empty) { + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,action,
drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, · line 1116
Quoted 2 lines
drivers/net/intel/ice/ice_hash.c +1
-1- "Not supported flow"); + "Invalid empty argument");I think this changes existing semantics a little too far.
The original code disallowed simple XOR only for cases where pattern wasn't empty (if it was, we allowed it - i.e. if it was a global RSS configuration). The fix disallows empty patterns altogether, whereas what it should've done instead is remove this check, and instead modify the second check to look for empty patterns (because otherwise we would go through further checks down the line for non-empty patterns).
Quoted 8 lines
drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, · line 1119
Quoted 3 lines
drivers/net/intel/ice/ice_hash.c +0
-0}else if (rss->func ==RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ){ rss_meta->hash_function =--
Thanks,
Anatoly
Hi Anatoly,
Thank you for your comments.
I understand the current change disallows all empty patterns altogether and that should be rectified. My doubt is should be allow both empty and non empty patterns to apply for simple_xor like symmetric Toeplitz ?
Thanks,
Anurag M
Quoted 69 lines · Anurag
Quoted 60 lines
-----Original Message-----
From: Burakov, Anatoly <[email protected]>
Sent: 09 March 2026 15:49
To: Mandal, Anurag <[email protected]>; [email protected]
Cc: Richardson, Bruce <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH] net/ice: fix rsssimple_xorhash functionQuoted 7 lines · Anurag Mandal
RSS Simple XOR hash function is supported by the NIC as per datasheet & also in ICE Linux Ethernet kernel driver but the same is not enabled in ICE PMD even though code support is already present.
This patch fixes the issue by removing the
simple_xorcheck & adding proper error log for empty argument.Quoted 6 lines
Bugzilla ID: 1518
Fixes 0b952714e9c1 ("net/ice: refactor PF hash flow")Signed-off-by Anurag Mandal <[email protected]>---
Hi,
drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct
Quoted 9 lines
drivers/net/intel/ice/ice_hash.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/net/intel/ice/ice_hash.c +0
-0@@ -1109,12 +1109,11 @@ ice_hash_parse_action(struct
ice_pattern_match_item*pattern_match_item,drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,
Quoted 11 lines
drivers/net/intel/ice/ice_hash.c +3
-4rss_type = rss->types;/* Check hash function and save it to rss_meta. */ -if (pattern_match_item->pattern_list != - pattern_empty && rss->func == -RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ) { - return rte_flow_error_set(error, ENOTSUP, +if (pattern_match_item->pattern_list == + pattern_empty) { + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,action,
drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, · line 1116
Quoted 2 lines
drivers/net/intel/ice/ice_hash.c +1
-1- "Not supported flow"); + "Invalid empty argument");I think this changes existing semantics a little too far.
The original code disallowed simple XOR only for cases where pattern wasn't empty (if it was, we allowed it - i.e. if it was a global RSS configuration). The fix disallows empty patterns altogether, whereas what it should've done instead is remove this check, and instead modify the second check to look for empty patterns (because otherwise we would go through further checks down the line for non-empty patterns).
Quoted 8 lines
drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, · line 1119
Quoted 3 lines
drivers/net/intel/ice/ice_hash.c +0
-0}else if (rss->func ==RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ){ rss_meta->hash_function =--
Thanks,
Anatoly
Quoted 5 lines
Hi Anatoly,
Thank you for your comments.
I understand the current change disallows all empty patterns altogether and that should be rectified. My doubt is should be allow both empty and non empty patterns to apply forsimple_xorlike symmetric Toeplitz ?
That's what your patch fixes, is it not? It already allowed empty patterns with simple xor (the second branch of the if condition).
Quoted 4 lines
Thanks,
Anurag M
Signature · 2 lines
Thanks, Anatoly
Hi,
In the general case, hash function type is not meaningful for non-empty patterns, because hash function types are per VSI (meaning, they can only be globally set up, not per pattern). So, ideally, we do not want the user to specify a hash function when they also specify a non-empty pattern.
However, the ICE driver is not very well behaved in this matter, and does not enforce neither the "hash functions are only supposed to be globally defined" limitations, nor does it check if a user specified a different hash function from what they configured globally. Therefore, I think the proper fix for this issue should do the following:
- interpret "default" hash function as "whatever is currently set up"
- store the "current" hash function globally somewhere (in VSI context)
- for empty patterns, overwrite the setting
- for non-empty patterns, disallow hash function that is not "default" or does not match currently selected global hash function type
Quoted 84 lines · Anatoly
Quoted 69 lines · Anurag
Quoted 60 lines
-----Original Message-----
From: Burakov, Anatoly <[email protected]>
Sent: 09 March 2026 15:49
To: Mandal, Anurag <[email protected]>; [email protected]
Cc: Richardson, Bruce <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH] net/ice: fix rsssimple_xorhash functionQuoted 7 lines · Anurag Mandal
RSS Simple XOR hash function is supported by the NIC as per datasheet & also in ICE Linux Ethernet kernel driver but the same is not enabled in ICE PMD even though code support is already present.
This patch fixes the issue by removing the
simple_xorcheck & adding proper error log for empty argument.Quoted 6 lines
Bugzilla ID: 1518
Fixes 0b952714e9c1 ("net/ice: refactor PF hash flow")Signed-off-by Anurag Mandal <[email protected]>---
Hi,
drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct
Quoted 9 lines
drivers/net/intel/ice/ice_hash.c| 9 ++++-----1 file changed, 4 insertions(+), 5 deletions(-)drivers/net/intel/ice/ice_hash.c +0
-0@@ -1109,12 +1109,11 @@ ice_hash_parse_action(struct
ice_pattern_match_item*pattern_match_item,drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,
Quoted 11 lines
drivers/net/intel/ice/ice_hash.c +3
-4rss_type = rss->types; /* Check hash function and save it to rss_meta. */ - if (pattern_match_item->pattern_list != - pattern_empty && rss->func == - RTE_ETH_HASH_FUNCTION_SIMPLE_XOR) { - return rte_flow_error_set(error, ENOTSUP, + if (pattern_match_item->pattern_list == + pattern_empty) { + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,action,
drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, · line 1116
Quoted 2 lines
drivers/net/intel/ice/ice_hash.c +1
-1- "Not supported flow"); + "Invalid empty argument");I think this changes existing semantics a little too far.
The original code disallowed simple XOR only for cases where pattern wasn't empty (if it was, we allowed it - i.e. if it was a global RSS configuration). The fix disallows empty patterns altogether, whereas what it should've done instead is remove this check, and instead modify the second check to look for empty patterns (because otherwise we would go through further checks down the line for non-empty patterns).
Quoted 8 lines
Quoted 3 lines
drivers/net/intel/ice/ice_hash.c +0
-0} else if (rss->func == RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){
rss_meta->hash_function=Signature · 2 lines
Thanks, AnatolyQuoted 5 lines
Hi Anatoly,
Thank you for your comments.
I understand the current change disallows all empty patterns altogether and that should be rectified. My doubt is should be allow both empty and non empty patterns to apply forsimple_xorlike symmetric Toeplitz ?That's what your patch fixes, is it not? It already allowed empty patterns with simple xor (the second branch of the if condition).
Quoted 4 lines
Thanks,
Anurag M
Signature · 2 lines
Regards, Vladimir
Quoted 22 lines
-----Original Message-----
From: Medvedkin, Vladimir <[email protected]>
Sent: 09 March 2026 18:56
To: Burakov, Anatoly <[email protected]>; Mandal, Anurag <[email protected]>; [email protected]
Cc: Richardson, Bruce <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH] net/ice: fix rsssimple_xorhash functionHi,
In the general case, hash function type is not meaningful for non-empty patterns, because hash function types are per VSI (meaning, they can only be globally set up, not per pattern). So, ideally, we do not want the user to specify a hash function when they also specify a non-empty pattern.
However, the ICE driver is not very well behaved in this matter, and does not enforce neither the "hash functions are only supposed to be globally defined" limitations, nor does it check if a user specified a different hash function from what they configured globally. Therefore, I think the proper fix for this issue should do the following:
Quoted 6 lines
- interpret "default" hash function as "whatever is currently set up" - store the "current" hash function globally somewhere (in VSI context) - for empty patterns, overwrite the setting
- for non-empty patterns, disallow hash function that is not "default" or does not match currently selected global hash function type
Hi Vladimir,
Thank you for your comments and detailed requirements.
I implemented the same.
However, I am facing an error when empty patterns with hash function is being set.
For simple_xor, it is not coming but for Toeplitz/Symmetric Toeplitz, it is coming.
I checked in DPDK 25.11 as well. It seems empty patterns with symmetric_toeplitz doe not work there as well.
It is failing in below check:ice_hash_parse_action():
if (ice_any_invalid_rss_type(rss->func, rss_type,
pattern_match_item->input_set_mask_o))
return rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ACTION,
action, "RSS type not supported");If I avoid this check, then getting:ICE_DRIVER: ice_add_rss_cfg_wrap(): add rss cfg failed
Scenario:
-> flow create 0 ingress pattern end actions rss types ipv4-udp end queues end func symmetric_toeplitz / endICE_DRIVER: ice_flow_create(): Failed to create flowport_flow_complain(): Caught PMD error type 13 (specific pattern item): cause: 0x7ffcc3e93ac8, Unsupported pattern: Invalid argument
Please let me know.
Thanks,
Anurag M
Quoted 93 lines · Anatoly
Quoted 73 lines · Anurag
Quoted 72 lines
Quoted 61 lines
-----Original Message-----
From: Burakov, Anatoly <[email protected]>
Sent: 09 March 2026 15:49
To: Mandal, Anurag <[email protected]>; [email protected]
Cc: Richardson, Bruce <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH] net/ice: fix rsssimple_xorhash functionQuoted 7 lines · Anurag Mandal
RSS Simple XOR hash function is supported by the NIC as per datasheet & also in ICE Linux Ethernet kernel driver but the same is not enabled in ICE PMD even though code support is already present.
This patch fixes the issue by removing the
simple_xorcheck & adding proper error log for empty argument.Quoted 6 lines
Bugzilla ID: 1518
Fixes 0b952714e9c1 ("net/ice: refactor PF hash flow")Signed-off-by Anurag Mandal <[email protected]>---
Hi,
drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct
Quoted 9 lines
drivers/net/intel/ice/ice_hash.c| 9 ++++-----1 file changed, 4 insertions(+), 5 deletions(-)drivers/net/intel/ice/ice_hash.c +0
-0@@ -1109,12 +1109,11 @@ ice_hash_parse_action(struct
ice_pattern_match_item*pattern_match_item,drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,
Quoted 11 lines
drivers/net/intel/ice/ice_hash.c +3
-4rss_type = rss->types; /* Check hash function and save it to rss_meta. */ - if (pattern_match_item->pattern_list != - pattern_empty && rss->func == - RTE_ETH_HASH_FUNCTION_SIMPLE_XOR) { - return rte_flow_error_set(error, ENOTSUP, + if (pattern_match_item->pattern_list == + pattern_empty) { + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,action,
drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, · line 1116
Quoted 2 lines
drivers/net/intel/ice/ice_hash.c +1
-1- "Not supported flow"); + "Invalid empty argument");I think this changes existing semantics a little too far.
The original code disallowed simple XOR only for cases where pattern wasn't empty (if it was, we allowed it - i.e. if it was a global RSS configuration). The fix disallows empty patterns altogether, whereas what it should've done instead is remove this check, and instead modify the second check to look for empty patterns (because otherwise we would go through further checks down the line for non-empty patterns).
Quoted 8 lines
Quoted 3 lines
drivers/net/intel/ice/ice_hash.c +0
-0} else if (rss->func == RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){
rss_meta->hash_function=--
Thanks,
AnatolyHi Anatoly,
Quoted 15 lines
Quoted 5 lines
Thank you for your comments.
I understand the current change disallows all empty patterns altogether and that should be rectified.
My doubt is should be allow both empty and non empty patterns to apply forsimple_xorlike symmetric Toeplitz ?That's what your patch fixes, is it not? It already allowed empty patterns with simple xor (the second branch of the if condition).
Quoted 4 lines
Thanks,
Anurag M--
Regards,
Vladimir
PATCH v2 1/1 net/ice: fix RSS hash function implementation
In reply to Anurag MandalHash function type is not meaningful for non-empty patterns as they are per VSI i.e. they are set globally only & not per pattern. So, for non-empty patterns, user should not specify hash function. ICE PMD does not adhere to these rules.
This patch fixes that by implementing the following:
- interpret "default" hash function as "currently set up"
- store the "current" hash function globally per VSI
- for empty patterns, overwrite the setting
- for non-empty patterns, disallow hash function that is not "default" or does not match currently selected global hash function type
Tested the following:
1. non-empty pattern with default hash function
2. empty pattern with simple_xor/symmetric_toeplitz hash function
3. non-empty pattern with simple_xor/symmetric_toeplitz hash function
4. empty pattern with no/default hash function
Bugzilla ID: 1518
---
V2: Addressed Vladimir Medvedkin's feedback
- interpret "default" hash function as "whatever is currently set up"
- store the "current" hash function globally somewhere (in VSI context)
- for empty patterns, overwrite the setting
- for non-empty patterns, disallow hash function that is not "default" or does not match currently selected global hash function type
drivers/net/intel/ice/ice_ethdev.c | 3 +++ drivers/net/intel/ice/ice_ethdev.h | 1 + drivers/net/intel/ice/ice_hash.c | 20 ++++++++++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-)
drivers/net/intel/ice/ice_ethdev.c +3 -0
@@ -3741,6 +3741,7 @@ static int ice_init_rss(struct ice_pf *pf) vsi->rss_key_size =ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE +ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE ; vsi->rss_lut_size = pf->hash_lut_size; + vsi->hash_function = rss_conf->algorithm;if (nb_q ==0 ) { PMD_DRV_LOG(WARNING,
@@ -5700,6 +5701,8 @@ ice_rss_hash_update(struct rte_eth_dev *dev,if (rss_conf->rss_hf ==0 ) pf->rss_hf =0 ; + vsi->hash_function = rss_conf->algorithm; +/* RSS hash configuration */ ice_rss_hash_set (pf, rss_conf->rss_hf);
drivers/net/intel/ice/ice_ethdev.h +1 -0
@@ -351,6 +351,7 @@ struct ice_vsi {bool offset_loaded;/* holds previous values so limitations can be enlarged to 64 bits */ struct ice_vsi_get_stats_fields old_get_stats_fields; +enum rte_eth_hash_function hash_function; };enum proto_xtr_type {
drivers/net/intel/ice/ice_hash.c +16 -4
@@ -1084,6 +1084,10 @@ ice_any_invalid_rss_type(enum rte_eth_hash_function rss_func,/* check not allowed RSS type */ rss_type &= ~VALID_RSS_ATTR ; +/* For Empty patterns */ +if (!allow_rss_type) +return false; +return ((rss_type & allow_rss_type) != rss_type); }
@@ -1091,7 +1095,8 @@ static int ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, const struct rte_flow_action actions[], uint64_t pattern_hint, struct ice_rss_meta *rss_meta, - struct rte_flow_error *error) + struct rte_flow_error *error, + enum rte_eth_hash_function *vsi_hash_function) { struct ice_rss_hash_cfg *cfg = pattern_match_item->meta;enum rte_flow_action_type action_type;
@@ -1110,8 +1115,8 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,/* Check hash function and save it to rss_meta. */ if (pattern_match_item->pattern_list != - pattern_empty && rss->func == -RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ) { + pattern_empty && rss->func && + rss->func != *vsi_hash_function) {return rte_flow_error_set (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ACTION , action,"Not supported flow" );
@@ -1119,6 +1124,7 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){ rss_meta->hash_function =RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ; + *vsi_hash_function = rss_meta->hash_function;return 0 ; } else if (rss->func ==RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ ) {
@@ -1161,7 +1167,12 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,RTE_FLOW_ERROR_TYPE_ACTION , action, "RSS type not supported"); +/* For Empty patterns*/ +if (cfg->hash_flds ==ICE_HASH_INVALID ) + cfg->hash_flds =1 ; rss_meta->cfg = *cfg; +if (rss->func) + *vsi_hash_function = rss_meta->hash_function;ice_refine_hash_cfg (&rss_meta->cfg, rss_type, pattern_hint);break ;
@@ -1193,6 +1204,7 @@ ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad,struct ice_pattern_match_item *pattern_match_item;struct ice_rss_meta *rss_meta_ptr;uint64_t phint =ICE_PHINT_NONE ; +struct ice_vsi *vsi = ad->pf.main_vsi;if (priority >=1 )return -rte_errno;
@@ -1230,7 +1242,7 @@ ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad,/* Check rss action. */ ret =ice_hash_parse_action (pattern_match_item, actions, phint, - rss_meta_ptr, error); + rss_meta_ptr, error, &vsi->hash_function); error:if (!ret && meta)
Signature · 1 line
2.34.1
RE: [PATCH v2] net/ice: fix RSS hash function implementation
Hi Bruce/Vladimir/Anatoly,
Friendly ping for review/upstream.
Thank you.
Regards,
Anurag M
Quoted 168 lines
-----Original Message-----
From: Mandal, Anurag <[email protected]>
Sent: 17 March 2026 16:02
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; Burakov, Anatoly <[email protected]>; Medvedkin, Vladimir <[email protected]>; Yang, Qiming <[email protected]>; [email protected]; Mandal, Anurag <[email protected]>; [email protected]
Subject: [PATCH v2] net/ice: fix RSS hash function implementationHash function type is not meaningful for non-empty patterns as they are per VSI i.e. they are set globally only & not per pattern.
So, for non-empty patterns, user should not specify hash function. ICE PMD does not adhere to these rules.This patch fixes that by implementing the following:
- interpret "default" hash function as "currently set up"
- store the "current" hash function globally per VSI
- for empty patterns, overwrite the setting
- for non-empty patterns, disallow hash function that is not "default" or does not match currently selected global hash function typeTested the following:
1. non-empty pattern with default hash function 2. empty pattern with simple_xor/symmetric_toeplitz hash function 3. non-empty pattern with simple_xor/symmetric_toeplitz hash function 4. empty pattern with no/default hash functionBugzilla ID: 1518
Fixes 0b952714e9c1 ("net/ice: refactor PF hash flow")Signed-off-by Anurag Mandal <[email protected]>---
V2: Addressed Vladimir Medvedkin's feedback
- interpret "default" hash function as "whatever is currently set up"
- store the "current" hash function globally somewhere (in VSI context)
- for empty patterns, overwrite the setting
- for non-empty patterns, disallow hash function that is not "default" or does not match currently selected global hash function type
drivers/net/intel/ice/ice_ethdev.c| 3 +++drivers/net/intel/ice/ice_ethdev.h
| 1 +drivers/net/intel/ice/ice_hash.c | 20 ++++++++++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-)drivers/net/intel/ice/ice_ethdev.c +4
-0@@ -3741,6 +3741,7 @@ static int ice_init_rss(struct ice_pf *pf) vsi->rss_key_size = ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE +ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE ; vsi->rss_lut_size = pf->hash_lut_size; + vsi->hash_function = rss_conf->algorithm;if (nb_q ==0 ) { PMD_DRV_LOG(WARNING,@@ -5700,6 +5701,8 @@ ice_rss_hash_update(struct rte_eth_dev *dev,if (rss_conf->rss_hf ==0 ) pf->rss_hf =0 ; + vsi->hash_function = rss_conf->algorithm; +/* RSS hash configuration */ ice_rss_hash_set (pf, rss_conf->rss_hf);drivers/net/intel/ice/ice_ethdev.h +1
-0@@ -351,6 +351,7 @@ struct ice_vsi {bool offset_loaded;/* holds previous values so limitations can be enlarged to 64 bits */ struct ice_vsi_get_stats_fields old_get_stats_fields; +enum rte_eth_hash_function hash_function; };enum proto_xtr_type {drivers/net/intel/ice/ice_hash.c +6
-1@@ -1084,6 +1084,10 @@ ice_any_invalid_rss_type(enumrte_eth_hash_function rss_func,/* check not allowed RSS type */ rss_type &= ~VALID_RSS_ATTR; +/* For Empty patterns */ +if (!allow_rss_type) +return false; +return ((rss_type & allow_rss_type) != rss_type); }@@ -1091,7 +1095,8 @@ static int ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, const struct rte_flow_action actions[], uint64_t pattern_hint, struct ice_rss_meta *rss_meta, - struct rte_flow_error *error) + struct rte_flow_error *error, + enum rte_eth_hash_function *vsi_hash_function) { struct ice_rss_hash_cfg *cfg = pattern_match_item->meta; enum rte_flow_action_type action_type; @@ -1110,8 +1115,8 @@ice_hash_parse_action(struct
ice_pattern_match_item*pattern_match_item,drivers/net/intel/ice/ice_hash.c +2
-2/* Check hash function and save it to rss_meta. */ if (pattern_match_item->pattern_list != - pattern_empty && rss->func == -RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ) { + pattern_empty && rss->func && + rss->func != *vsi_hash_function) { return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,action,
drivers/net/intel/ice/ice_hash.c +1
-0"Not supported flow");@@ -1119,6 +1124,7 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){ rss_meta->hash_function =RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ; + *vsi_hash_function = rss_meta- >hash_function;return 0 ;} else if (
rss->func==
RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) { @@ -1161,7 +1167,12 @@ ice_hash_parse_action(structice_pattern_match_item*pattern_match_item,drivers/net/intel/ice/ice_hash.c +5
-0RTE_FLOW_ERROR_TYPE_ACTION , action, "RSS type not supported"); +/* For Empty patterns*/ +if (cfg->hash_flds ==ICE_HASH_INVALID ) + cfg->hash_flds =1 ; rss_meta->cfg = *cfg; +if (rss->func) + *vsi_hash_function = rss_meta-Quoted 1 line
hash_function;drivers/net/intel/ice/ice_hash.c +1
-0ice_refine_hash_cfg (&rss_meta->cfg, rss_type, pattern_hint);break ;@@ -1193,6 +1204,7 @@ ice_hash_parse_pattern_action(__rte_unusedstruct ice_adapter *ad, struct ice_pattern_match_item *pattern_match_item;struct ice_rss_meta *rss_meta_ptr;uint64_t phint =ICE_PHINT_NONE ; +struct ice_vsi *vsi = ad->pf.main_vsi;if (priority >=1 )drivers/net/intel/ice/ice_hash.c +1
-1return -rte_errno;@@ -1230,7 +1242,7 @@ ice_hash_parse_pattern_action(__rte_unusedstruct ice_adapter *ad,/* Check rss action. */ ret =ice_hash_parse_action (pattern_match_item, actions, phint, - rss_meta_ptr, error); + rss_meta_ptr, error, &vsi->hash_function); error:if (!ret && meta)
--
2.34.1
Re: [PATCH v2] net/ice: fix RSS hash function implementation
In reply to Anurag MandalHi Anurag,
Quoted 41 lines · Anurag Mandal
Hash function type is not meaningful for non-empty patterns as they are per VSI i.e. they are set globally only & not per pattern. So, for non-empty patterns, user should not specify hash function. ICE PMD does not adhere to these rules.
This patch fixes that by implementing the following:
- interpret "default" hash function as "currently set up"
- store the "current" hash function globally per VSI
- for empty patterns, overwrite the setting
- for non-empty patterns, disallow hash function that is not "default" or does not match currently selected global hash function typeTested the following:
1. non-empty pattern with default hash function
2. empty pattern with simple_xor/symmetric_toeplitz hash function
3. non-empty pattern with simple_xor/symmetric_toeplitz hash function
4. empty pattern with no/default hash functionBugzilla ID: 1518
Fixes 0b952714e9c1 ("net/ice: refactor PF hash flow")Signed-off-by Anurag Mandal <[email protected]>---
V2: Addressed Vladimir Medvedkin's feedback
- interpret "default" hash function as "whatever is currently set up"
- store the "current" hash function globally somewhere (in VSI context)
- for empty patterns, overwrite the setting
- for non-empty patterns, disallow hash function that is not "default" or does not match currently selected global hash function typedrivers/net/intel/ice/ice_ethdev.c | 3 +++ drivers/net/intel/ice/ice_ethdev.h | 1 + drivers/net/intel/ice/ice_hash.c | 20 ++++++++++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-)drivers/net/intel/ice/ice_ethdev.c +0
-0
drivers/net/intel/ice/ice_ethdev.c static int ice_init_rss(struct ice_pf *pf) · line 3744
Quoted 4 lines
drivers/net/intel/ice/ice_ethdev.c +1
-0@@ -3741,6 +3741,7 @@ static int ice_init_rss(struct ice_pf *pf) vsi->rss_key_size =ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE +ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE ; vsi->rss_lut_size = pf->hash_lut_size; + vsi->hash_function = rss_conf->algorithm;
ok, you set the hash function in this new field, but you don't change the HW state, hash function for this VSI is still symmetric Toeplitz
drivers/net/intel/ice/ice_ethdev.c ice_rss_hash_update(struct rte_eth_dev *dev, · line 5705
Quoted 9 lines
drivers/net/intel/ice/ice_ethdev.c +2
-0if (nb_q ==0 ) { PMD_DRV_LOG(WARNING,@@ -5700,6 +5701,8 @@ ice_rss_hash_update(struct rte_eth_dev *dev,if (rss_conf->rss_hf ==0 ) pf->rss_hf =0 ; + vsi->hash_function = rss_conf->algorithm; +
Same here
Quoted 20 lines
drivers/net/intel/ice/ice_ethdev.c +0
-0/* RSS hash configuration */ ice_rss_hash_set (pf, rss_conf->rss_hf);drivers/net/intel/ice/ice_ethdev.h +1
-0@@ -351,6 +351,7 @@ struct ice_vsi {bool offset_loaded;/* holds previous values so limitations can be enlarged to 64 bits */ struct ice_vsi_get_stats_fields old_get_stats_fields; +enum rte_eth_hash_function hash_function; };enum proto_xtr_type {drivers/net/intel/ice/ice_hash.c +0
-0
drivers/net/intel/ice/ice_hash.c ice_any_invalid_rss_type(enum rte_eth_hash_function rss_func, · line 1090
Quoted 7 lines
drivers/net/intel/ice/ice_hash.c +4
-0@@ -1084,6 +1084,10 @@ ice_any_invalid_rss_type(enum rte_eth_hash_function rss_func,/* check not allowed RSS type */ rss_type &= ~VALID_RSS_ATTR ; +/* For Empty patterns */ +if (!allow_rss_type) +return false; +
I'm not sure I understood this part, could you please provide a more verbose comment here?
Quoted 33 lines
drivers/net/intel/ice/ice_hash.c +5
-3return ((rss_type & allow_rss_type) != rss_type); }@@ -1091,7 +1095,8 @@ static int ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, const struct rte_flow_action actions[], uint64_t pattern_hint, struct ice_rss_meta *rss_meta, - struct rte_flow_error *error) + struct rte_flow_error *error, + enum rte_eth_hash_function *vsi_hash_function) { struct ice_rss_hash_cfg *cfg = pattern_match_item->meta;enum rte_flow_action_type action_type;@@ -1110,8 +1115,8 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,/* Check hash function and save it to rss_meta. */ if (pattern_match_item->pattern_list != - pattern_empty && rss->func == -RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ) { + pattern_empty && rss->func && + rss->func != *vsi_hash_function) {return rte_flow_error_set (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ACTION , action,"Not supported flow" );@@ -1119,6 +1124,7 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){ rss_meta->hash_function =RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ; + *vsi_hash_function = rss_meta->hash_function;return 0 ; } else if (rss->func ==RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ ) {
drivers/net/intel/ice/ice_hash.c ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, · line 1172
Quoted 6 lines
drivers/net/intel/ice/ice_hash.c +3
-0@@ -1161,7 +1167,12 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,RTE_FLOW_ERROR_TYPE_ACTION , action, "RSS type not supported"); +/* For Empty patterns*/ +if (cfg->hash_flds ==ICE_HASH_INVALID ) + cfg->hash_flds =1 ;
what does this "1" mean here? Hashing on Ethernet DST MAC address? Why?
Quoted 15 lines
drivers/net/intel/ice/ice_hash.c +3
-0rss_meta->cfg = *cfg; +if (rss->func) + *vsi_hash_function = rss_meta->hash_function;ice_refine_hash_cfg (&rss_meta->cfg, rss_type, pattern_hint);break ;@@ -1193,6 +1204,7 @@ ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad,struct ice_pattern_match_item *pattern_match_item;struct ice_rss_meta *rss_meta_ptr;uint64_t phint =ICE_PHINT_NONE ; +struct ice_vsi *vsi = ad->pf.main_vsi;if (priority >=1 )return -rte_errno;
drivers/net/intel/ice/ice_hash.c ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad, · line 1245
Quoted 5 lines
drivers/net/intel/ice/ice_hash.c +1
-1@@ -1230,7 +1242,7 @@ ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad,/* Check rss action. */ ret =ice_hash_parse_action (pattern_match_item, actions, phint, - rss_meta_ptr, error); + rss_meta_ptr, error, &vsi->hash_function);
Ok, your vsi->hash_function may be updated, how does the HW know about this?
Quoted 3 lines
drivers/net/intel/ice/ice_hash.c +0
-0error:if (!ret && meta)
Signature · 2 lines
Regards, Vladimir