* [PATCH] net/ice: fix rss simple_xor hash function
@ 2026-03-09 2:32 Anurag Mandal
2026-03-09 10:19 ` Burakov, Anatoly
2026-03-17 10:32 ` [PATCH v2] net/ice: fix RSS hash function implementation Anurag Mandal
0 siblings, 2 replies; 9+ messages in thread
From: Anurag Mandal @ 2026-03-09 2:32 UTC (permalink / raw)
To: dev; +Cc: bruce.richardson, anatoly.burakov, alex.chapman, Anurag Mandal,
stable
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
Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow")
Cc: stable@dpdk.org
Signed-off-by: Anurag Mandal <anurag.mandal@intel.com>
---
drivers/net/intel/ice/ice_hash.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/net/intel/ice/ice_hash.c b/drivers/net/intel/ice/ice_hash.c
index 77829e607b..d57b5ee0e4 100644
--- a/drivers/net/intel/ice/ice_hash.c
+++ b/drivers/net/intel/ice/ice_hash.c
@@ -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 =
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] net/ice: fix rss simple_xor hash function 2026-03-09 2:32 [PATCH] net/ice: fix rss simple_xor hash function Anurag Mandal @ 2026-03-09 10:19 ` Burakov, Anatoly 2026-03-09 11:17 ` Mandal, Anurag 2026-03-17 10:32 ` [PATCH v2] net/ice: fix RSS hash function implementation Anurag Mandal 1 sibling, 1 reply; 9+ messages in thread From: Burakov, Anatoly @ 2026-03-09 10:19 UTC (permalink / raw) To: Anurag Mandal, dev; +Cc: bruce.richardson, alex.chapman, stable On 3/9/2026 3:32 AM, Anurag Mandal wrote: > 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 > Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow") > Cc: stable@dpdk.org > > Signed-off-by: Anurag Mandal <anurag.mandal@intel.com> > --- Hi, > drivers/net/intel/ice/ice_hash.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/intel/ice/ice_hash.c b/drivers/net/intel/ice/ice_hash.c > index 77829e607b..d57b5ee0e4 100644 > --- a/drivers/net/intel/ice/ice_hash.c > +++ b/drivers/net/intel/ice/ice_hash.c > @@ -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"); 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). > } else if (rss->func == > RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){ > rss_meta->hash_function = -- Thanks, Anatoly ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH] net/ice: fix rss simple_xor hash function 2026-03-09 10:19 ` Burakov, Anatoly @ 2026-03-09 11:17 ` Mandal, Anurag 2026-03-09 11:48 ` Burakov, Anatoly 0 siblings, 1 reply; 9+ messages in thread From: Mandal, Anurag @ 2026-03-09 11:17 UTC (permalink / raw) To: Burakov, Anatoly, dev@dpdk.org Cc: Richardson, Bruce, alex.chapman@arm.com, stable@dpdk.org > -----Original Message----- > From: Burakov, Anatoly <anatoly.burakov@intel.com> > Sent: 09 March 2026 15:49 > To: Mandal, Anurag <anurag.mandal@intel.com>; dev@dpdk.org > Cc: Richardson, Bruce <bruce.richardson@intel.com>; > alex.chapman@arm.com; stable@dpdk.org > Subject: Re: [PATCH] net/ice: fix rss simple_xor hash function > > On 3/9/2026 3:32 AM, Anurag Mandal wrote: > > 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 > > Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow") > > Cc: stable@dpdk.org > > > > Signed-off-by: Anurag Mandal <anurag.mandal@intel.com> > > --- > > Hi, > > > drivers/net/intel/ice/ice_hash.c | 9 ++++----- > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/net/intel/ice/ice_hash.c > > b/drivers/net/intel/ice/ice_hash.c > > index 77829e607b..d57b5ee0e4 100644 > > --- a/drivers/net/intel/ice/ice_hash.c > > +++ b/drivers/net/intel/ice/ice_hash.c > > @@ -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"); > > 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). > > > } 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] net/ice: fix rss simple_xor hash function 2026-03-09 11:17 ` Mandal, Anurag @ 2026-03-09 11:48 ` Burakov, Anatoly 2026-03-09 13:26 ` Medvedkin, Vladimir 0 siblings, 1 reply; 9+ messages in thread From: Burakov, Anatoly @ 2026-03-09 11:48 UTC (permalink / raw) To: Mandal, Anurag, dev@dpdk.org Cc: Richardson, Bruce, alex.chapman@arm.com, stable@dpdk.org On 3/9/2026 12:17 PM, Mandal, Anurag wrote: > >> -----Original Message----- >> From: Burakov, Anatoly <anatoly.burakov@intel.com> >> Sent: 09 March 2026 15:49 >> To: Mandal, Anurag <anurag.mandal@intel.com>; dev@dpdk.org >> Cc: Richardson, Bruce <bruce.richardson@intel.com>; >> alex.chapman@arm.com; stable@dpdk.org >> Subject: Re: [PATCH] net/ice: fix rss simple_xor hash function >> >> On 3/9/2026 3:32 AM, Anurag Mandal wrote: >>> 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 >>> Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow") >>> Cc: stable@dpdk.org >>> >>> Signed-off-by: Anurag Mandal <anurag.mandal@intel.com> >>> --- >> >> Hi, >> >>> drivers/net/intel/ice/ice_hash.c | 9 ++++----- >>> 1 file changed, 4 insertions(+), 5 deletions(-) >>> >>> diff --git a/drivers/net/intel/ice/ice_hash.c >>> b/drivers/net/intel/ice/ice_hash.c >>> index 77829e607b..d57b5ee0e4 100644 >>> --- a/drivers/net/intel/ice/ice_hash.c >>> +++ b/drivers/net/intel/ice/ice_hash.c >>> @@ -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"); >> >> 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). >> >>> } 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 ? That's what your patch fixes, is it not? It already allowed empty patterns with simple xor (the second branch of the if condition). > > Thanks, > Anurag M > -- Thanks, Anatoly ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] net/ice: fix rss simple_xor hash function 2026-03-09 11:48 ` Burakov, Anatoly @ 2026-03-09 13:26 ` Medvedkin, Vladimir 2026-03-16 11:10 ` Mandal, Anurag 0 siblings, 1 reply; 9+ messages in thread From: Medvedkin, Vladimir @ 2026-03-09 13:26 UTC (permalink / raw) To: Burakov, Anatoly, Mandal, Anurag, dev@dpdk.org Cc: Richardson, Bruce, alex.chapman@arm.com, stable@dpdk.org 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 On 3/9/2026 11:48 AM, Burakov, Anatoly wrote: > On 3/9/2026 12:17 PM, Mandal, Anurag wrote: >> >>> -----Original Message----- >>> From: Burakov, Anatoly <anatoly.burakov@intel.com> >>> Sent: 09 March 2026 15:49 >>> To: Mandal, Anurag <anurag.mandal@intel.com>; dev@dpdk.org >>> Cc: Richardson, Bruce <bruce.richardson@intel.com>; >>> alex.chapman@arm.com; stable@dpdk.org >>> Subject: Re: [PATCH] net/ice: fix rss simple_xor hash function >>> >>> On 3/9/2026 3:32 AM, Anurag Mandal wrote: >>>> 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 >>>> Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow") >>>> Cc: stable@dpdk.org >>>> >>>> Signed-off-by: Anurag Mandal <anurag.mandal@intel.com> >>>> --- >>> >>> Hi, >>> >>>> drivers/net/intel/ice/ice_hash.c | 9 ++++----- >>>> 1 file changed, 4 insertions(+), 5 deletions(-) >>>> >>>> diff --git a/drivers/net/intel/ice/ice_hash.c >>>> b/drivers/net/intel/ice/ice_hash.c >>>> index 77829e607b..d57b5ee0e4 100644 >>>> --- a/drivers/net/intel/ice/ice_hash.c >>>> +++ b/drivers/net/intel/ice/ice_hash.c >>>> @@ -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"); >>> >>> 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). >>> >>>> } 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 ? > > That's what your patch fixes, is it not? It already allowed empty > patterns with simple xor (the second branch of the if condition). > >> >> Thanks, >> Anurag M >> > > -- Regards, Vladimir ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH] net/ice: fix rss simple_xor hash function 2026-03-09 13:26 ` Medvedkin, Vladimir @ 2026-03-16 11:10 ` Mandal, Anurag 0 siblings, 0 replies; 9+ messages in thread From: Mandal, Anurag @ 2026-03-16 11:10 UTC (permalink / raw) To: Medvedkin, Vladimir, Burakov, Anatoly, dev@dpdk.org Cc: Richardson, Bruce, alex.chapman@arm.com, stable@dpdk.org > -----Original Message----- > From: Medvedkin, Vladimir <vladimir.medvedkin@intel.com> > Sent: 09 March 2026 18:56 > To: Burakov, Anatoly <anatoly.burakov@intel.com>; Mandal, Anurag > <anurag.mandal@intel.com>; dev@dpdk.org > Cc: Richardson, Bruce <bruce.richardson@intel.com>; > alex.chapman@arm.com; stable@dpdk.org > Subject: Re: [PATCH] net/ice: fix rss simple_xor hash function > > 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 > 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 / end ICE_DRIVER: ice_flow_create(): Failed to create flow port_flow_complain(): Caught PMD error type 13 (specific pattern item): cause: 0x7ffcc3e93ac8, Unsupported pattern: Invalid argument Please let me know. Thanks, Anurag M > > On 3/9/2026 11:48 AM, Burakov, Anatoly wrote: > > On 3/9/2026 12:17 PM, Mandal, Anurag wrote: > >> > >>> -----Original Message----- > >>> From: Burakov, Anatoly <anatoly.burakov@intel.com> > >>> Sent: 09 March 2026 15:49 > >>> To: Mandal, Anurag <anurag.mandal@intel.com>; dev@dpdk.org > >>> Cc: Richardson, Bruce <bruce.richardson@intel.com>; > >>> alex.chapman@arm.com; stable@dpdk.org > >>> Subject: Re: [PATCH] net/ice: fix rss simple_xor hash function > >>> > >>> On 3/9/2026 3:32 AM, Anurag Mandal wrote: > >>>> 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 > >>>> Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow") > >>>> Cc: stable@dpdk.org > >>>> > >>>> Signed-off-by: Anurag Mandal <anurag.mandal@intel.com> > >>>> --- > >>> > >>> Hi, > >>> > >>>> drivers/net/intel/ice/ice_hash.c | 9 ++++----- > >>>> 1 file changed, 4 insertions(+), 5 deletions(-) > >>>> > >>>> diff --git a/drivers/net/intel/ice/ice_hash.c > >>>> b/drivers/net/intel/ice/ice_hash.c > >>>> index 77829e607b..d57b5ee0e4 100644 > >>>> --- a/drivers/net/intel/ice/ice_hash.c > >>>> +++ b/drivers/net/intel/ice/ice_hash.c > >>>> @@ -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"); > >>> > >>> 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). > >>> > >>>> } 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 ? > > > > That's what your patch fixes, is it not? It already allowed empty > > patterns with simple xor (the second branch of the if condition). > > > >> > >> Thanks, > >> Anurag M > >> > > > > > -- > Regards, > Vladimir ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] net/ice: fix RSS hash function implementation 2026-03-09 2:32 [PATCH] net/ice: fix rss simple_xor hash function Anurag Mandal 2026-03-09 10:19 ` Burakov, Anatoly @ 2026-03-17 10:32 ` Anurag Mandal 2026-03-23 10:13 ` Mandal, Anurag 2026-03-23 17:55 ` Medvedkin, Vladimir 1 sibling, 2 replies; 9+ messages in thread From: Anurag Mandal @ 2026-03-17 10:32 UTC (permalink / raw) To: dev Cc: bruce.richardson, anatoly.burakov, vladimir.medvedkin, qiming.yang, alex.chapman, Anurag Mandal, stable 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 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 Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow") Cc: stable@dpdk.org Signed-off-by: Anurag Mandal <anurag.mandal@intel.com> --- 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(-) diff --git a/drivers/net/intel/ice/ice_ethdev.c b/drivers/net/intel/ice/ice_ethdev.c index 0d6b030536..0948a8cb23 100644 --- a/drivers/net/intel/ice/ice_ethdev.c +++ b/drivers/net/intel/ice/ice_ethdev.c @@ -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); diff --git a/drivers/net/intel/ice/ice_ethdev.h b/drivers/net/intel/ice/ice_ethdev.h index 4b3718f715..d8a01fe7fa 100644 --- a/drivers/net/intel/ice/ice_ethdev.h +++ b/drivers/net/intel/ice/ice_ethdev.h @@ -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 { diff --git a/drivers/net/intel/ice/ice_hash.c b/drivers/net/intel/ice/ice_hash.c index 77829e607b..8e97a6fd42 100644 --- a/drivers/net/intel/ice/ice_hash.c +++ b/drivers/net/intel/ice/ice_hash.c @@ -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) -- 2.34.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* RE: [PATCH v2] net/ice: fix RSS hash function implementation 2026-03-17 10:32 ` [PATCH v2] net/ice: fix RSS hash function implementation Anurag Mandal @ 2026-03-23 10:13 ` Mandal, Anurag 2026-03-23 17:55 ` Medvedkin, Vladimir 1 sibling, 0 replies; 9+ messages in thread From: Mandal, Anurag @ 2026-03-23 10:13 UTC (permalink / raw) To: dev@dpdk.org Cc: Richardson, Bruce, Burakov, Anatoly, Medvedkin, Vladimir, Yang, Qiming, alex.chapman@arm.com, stable@dpdk.org Hi Bruce/Vladimir/Anatoly, Friendly ping for review/upstream. Thank you. Regards, Anurag M > -----Original Message----- > From: Mandal, Anurag <anurag.mandal@intel.com> > Sent: 17 March 2026 16:02 > To: dev@dpdk.org > Cc: Richardson, Bruce <bruce.richardson@intel.com>; Burakov, Anatoly > <anatoly.burakov@intel.com>; Medvedkin, Vladimir > <vladimir.medvedkin@intel.com>; Yang, Qiming <qiming.yang@intel.com>; > alex.chapman@arm.com; Mandal, Anurag <anurag.mandal@intel.com>; > stable@dpdk.org > Subject: [PATCH v2] net/ice: fix RSS hash function implementation > > 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 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 > Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow") > Cc: stable@dpdk.org > > Signed-off-by: Anurag Mandal <anurag.mandal@intel.com> > --- > 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(-) > > diff --git a/drivers/net/intel/ice/ice_ethdev.c > b/drivers/net/intel/ice/ice_ethdev.c > index 0d6b030536..0948a8cb23 100644 > --- a/drivers/net/intel/ice/ice_ethdev.c > +++ b/drivers/net/intel/ice/ice_ethdev.c > @@ -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); > > diff --git a/drivers/net/intel/ice/ice_ethdev.h > b/drivers/net/intel/ice/ice_ethdev.h > index 4b3718f715..d8a01fe7fa 100644 > --- a/drivers/net/intel/ice/ice_ethdev.h > +++ b/drivers/net/intel/ice/ice_ethdev.h > @@ -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 { > diff --git a/drivers/net/intel/ice/ice_hash.c b/drivers/net/intel/ice/ice_hash.c > index 77829e607b..8e97a6fd42 100644 > --- a/drivers/net/intel/ice/ice_hash.c > +++ b/drivers/net/intel/ice/ice_hash.c > @@ -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) > -- > 2.34.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] net/ice: fix RSS hash function implementation 2026-03-17 10:32 ` [PATCH v2] net/ice: fix RSS hash function implementation Anurag Mandal 2026-03-23 10:13 ` Mandal, Anurag @ 2026-03-23 17:55 ` Medvedkin, Vladimir 1 sibling, 0 replies; 9+ messages in thread From: Medvedkin, Vladimir @ 2026-03-23 17:55 UTC (permalink / raw) To: Anurag Mandal, dev Cc: bruce.richardson, anatoly.burakov, qiming.yang, alex.chapman, stable Hi Anurag, On 3/17/2026 10:32 AM, Anurag Mandal wrote: > 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 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 > Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow") > Cc: stable@dpdk.org > > Signed-off-by: Anurag Mandal <anurag.mandal@intel.com> > --- > 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(-) > > diff --git a/drivers/net/intel/ice/ice_ethdev.c b/drivers/net/intel/ice/ice_ethdev.c > index 0d6b030536..0948a8cb23 100644 > --- a/drivers/net/intel/ice/ice_ethdev.c > +++ b/drivers/net/intel/ice/ice_ethdev.c > @@ -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 > > 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; > + Same here > /* RSS hash configuration */ > ice_rss_hash_set(pf, rss_conf->rss_hf); > > diff --git a/drivers/net/intel/ice/ice_ethdev.h b/drivers/net/intel/ice/ice_ethdev.h > index 4b3718f715..d8a01fe7fa 100644 > --- a/drivers/net/intel/ice/ice_ethdev.h > +++ b/drivers/net/intel/ice/ice_ethdev.h > @@ -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 { > diff --git a/drivers/net/intel/ice/ice_hash.c b/drivers/net/intel/ice/ice_hash.c > index 77829e607b..8e97a6fd42 100644 > --- a/drivers/net/intel/ice/ice_hash.c > +++ b/drivers/net/intel/ice/ice_hash.c > @@ -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? > 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; what does this "1" mean here? Hashing on Ethernet DST MAC address? Why? > 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); Ok, your vsi->hash_function may be updated, how does the HW know about this? > > error: > if (!ret && meta) -- Regards, Vladimir ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-03-23 17:56 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-03-09 2:32 [PATCH] net/ice: fix rss simple_xor hash function Anurag Mandal 2026-03-09 10:19 ` Burakov, Anatoly 2026-03-09 11:17 ` Mandal, Anurag 2026-03-09 11:48 ` Burakov, Anatoly 2026-03-09 13:26 ` Medvedkin, Vladimir 2026-03-16 11:10 ` Mandal, Anurag 2026-03-17 10:32 ` [PATCH v2] net/ice: fix RSS hash function implementation Anurag Mandal 2026-03-23 10:13 ` Mandal, Anurag 2026-03-23 17:55 ` Medvedkin, Vladimir
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox