[2/6] net/hns3: fix inconsistent enabled RSS behavior

Message ID 20220228032146.37407-3-humin29@huawei.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series bugfixes for hns3 PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

humin (Q) Feb. 28, 2022, 3:21 a.m. UTC
  From: Huisong Li <lihuisong@huawei.com>

RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
dev_configure phase. However, if this flag isn't set, RSS can be enabled
through the ethdev ops and rte_flow API. This behavior is contrary to each
other.

Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
 drivers/net/hns3/hns3_flow.c |  5 +++++
 drivers/net/hns3/hns3_rss.c  | 12 ++++++++++++
 2 files changed, 17 insertions(+)
  

Comments

Ferruh Yigit Feb. 28, 2022, 4:42 p.m. UTC | #1
On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
> From: Huisong Li <lihuisong@huawei.com>
> 
> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
> dev_configure phase. However, if this flag isn't set, RSS can be enabled
> through the ethdev ops and rte_flow API. This behavior is contrary to each
> other.
> 
> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>


Hi Huisong, Connor,

Let's get a little more feedback for this patch, cc'ed more people.


To enable RSS, multi queue mode should be set to 'RTE_ETH_MQ_RX_RSS_FLAG'.

But I wonder if it is required to configure RSS via flow API,
and if other PMDs check this configuration for flow API?
  
lihuisong (C) March 2, 2022, 2:09 a.m. UTC | #2
在 2022/3/1 0:42, Ferruh Yigit 写道:
> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
>> From: Huisong Li <lihuisong@huawei.com>
>>
>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
>> dev_configure phase. However, if this flag isn't set, RSS can be enabled
>> through the ethdev ops and rte_flow API. This behavior is contrary to 
>> each
>> other.
>>
>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>
>
> Hi Huisong, Connor,
>
> Let's get a little more feedback for this patch, cc'ed more people.
>
>
> To enable RSS, multi queue mode should be set to 
> 'RTE_ETH_MQ_RX_RSS_FLAG'.
>
> But I wonder if it is required to configure RSS via flow API,

I do not know the original purpose of adding the RSS configuration in 
flow API.

However, as far as I know, the hash algorithm can be configured via this 
API,

but not via ethdev ops API.

> and if other PMDs check this configuration for flow API?

Some PMDs already have similar check in RSS releated ops or rte_flow API.

For example, hinic, axbge, bnxt, cnxk, otx2, and ena.

> .
  
Ori Kam March 2, 2022, 2:07 p.m. UTC | #3
Hi Lihuisong,

> -----Original Message-----
> From: lihuisong (C) <lihuisong@huawei.com>
> Sent: Wednesday, March 2, 2022 4:10 AM
> Subject: Re: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS behavior
> 
> 
> 在 2022/3/1 0:42, Ferruh Yigit 写道:
> > On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
> >> From: Huisong Li <lihuisong@huawei.com>
> >>
> >> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
> >> dev_configure phase. However, if this flag isn't set, RSS can be enabled
> >> through the ethdev ops and rte_flow API. This behavior is contrary to
> >> each
> >> other.
> >>
> >> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
> >> Cc: stable@dpdk.org
> >>
> >> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> >
> >
> > Hi Huisong, Connor,
> >
> > Let's get a little more feedback for this patch, cc'ed more people.
> >
> >
> > To enable RSS, multi queue mode should be set to
> > 'RTE_ETH_MQ_RX_RSS_FLAG'.
> >
> > But I wonder if it is required to configure RSS via flow API,
> 
> I do not know the original purpose of adding the RSS configuration in
> flow API.
> 
The purpose is simple, this allow to create RSS per rule and not a global one.
For example create RSS that sends TCP to some queues while othe RSS will send
UDP traffic to different queues.

> However, as far as I know, the hash algorithm can be configured via this
> API,
> 
> but not via ethdev ops API.
> 
> > and if other PMDs check this configuration for flow API?
> 
> Some PMDs already have similar check in RSS releated ops or rte_flow API.
> 
> For example, hinic, axbge, bnxt, cnxk, otx2, and ena.
> 
> > .
From my view point those are two different settings.
The RTE_ETH_MQ_RX_RSS_FLAG is global per port while
rte_flow is per rule.

I think, that if a PMD needs this flag, in order to enable it also for rte_flow then
it should be documented in the release note of the PMD.
It is a valid use case that the default traffic will not have RSS and only rules created by
rte_flow will have the RSS, for matching traffc.

Best,
Ori
  
Thomas Monjalon March 2, 2022, 2:46 p.m. UTC | #4
02/03/2022 15:07, Ori Kam:
> From: lihuisong (C) <lihuisong@huawei.com>
> > 在 2022/3/1 0:42, Ferruh Yigit 写道:
> > > On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
> > >> From: Huisong Li <lihuisong@huawei.com>
> > >>
> > >> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
> > >> dev_configure phase. However, if this flag isn't set, RSS can be enabled
> > >> through the ethdev ops and rte_flow API. This behavior is contrary to
> > >> each
> > >> other.
> > >>
> > >> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
> > >> Cc: stable@dpdk.org
> > >>
> > >> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> > >
> > >
> > > Hi Huisong, Connor,
> > >
> > > Let's get a little more feedback for this patch, cc'ed more people.
> > >
> > >
> > > To enable RSS, multi queue mode should be set to
> > > 'RTE_ETH_MQ_RX_RSS_FLAG'.
> > >
> > > But I wonder if it is required to configure RSS via flow API,
> > 
> > I do not know the original purpose of adding the RSS configuration in
> > flow API.
> > 
> The purpose is simple, this allow to create RSS per rule and not a global one.
> For example create RSS that sends TCP to some queues while othe RSS will send
> UDP traffic to different queues.
> 
> > However, as far as I know, the hash algorithm can be configured via this
> > API,
> > 
> > but not via ethdev ops API.
> > 
> > > and if other PMDs check this configuration for flow API?
> > 
> > Some PMDs already have similar check in RSS releated ops or rte_flow API.
> > 
> > For example, hinic, axbge, bnxt, cnxk, otx2, and ena.

I suggest removing these checks.

> From my view point those are two different settings.
> The RTE_ETH_MQ_RX_RSS_FLAG is global per port while
> rte_flow is per rule.
> 
> I think, that if a PMD needs this flag, in order to enable it also for rte_flow then
> it should be documented in the release note of the PMD.
> It is a valid use case that the default traffic will not have RSS and only rules created by
> rte_flow will have the RSS, for matching traffc.

I think RTE_ETH_MQ_RX_RSS_FLAG should not be required by any PMD
for rte_flow RSS rules.
  
Stephen Hemminger March 2, 2022, 4:59 p.m. UTC | #5
On Wed, 02 Mar 2022 15:46:37 +0100
Thomas Monjalon <thomas@monjalon.net> wrote:

> 02/03/2022 15:07, Ori Kam:
> > From: lihuisong (C) <lihuisong@huawei.com>  
> > > 在 2022/3/1 0:42, Ferruh Yigit 写道:  
> > > > On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:  
> > > >> From: Huisong Li <lihuisong@huawei.com>
> > > >>
> > > >> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
> > > >> dev_configure phase. However, if this flag isn't set, RSS can be enabled
> > > >> through the ethdev ops and rte_flow API. This behavior is contrary to
> > > >> each
> > > >> other.
> > > >>
> > > >> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
> > > >> Cc: stable@dpdk.org
> > > >>
> > > >> Signed-off-by: Huisong Li <lihuisong@huawei.com>  
> > > >
> > > >
> > > > Hi Huisong, Connor,
> > > >
> > > > Let's get a little more feedback for this patch, cc'ed more people.
> > > >
> > > >
> > > > To enable RSS, multi queue mode should be set to
> > > > 'RTE_ETH_MQ_RX_RSS_FLAG'.
> > > >
> > > > But I wonder if it is required to configure RSS via flow API,  
> > > 
> > > I do not know the original purpose of adding the RSS configuration in
> > > flow API.
> > >   
> > The purpose is simple, this allow to create RSS per rule and not a global one.
> > For example create RSS that sends TCP to some queues while othe RSS will send
> > UDP traffic to different queues.
> >   
> > > However, as far as I know, the hash algorithm can be configured via this
> > > API,
> > > 
> > > but not via ethdev ops API.
> > >   
> > > > and if other PMDs check this configuration for flow API?  
> > > 
> > > Some PMDs already have similar check in RSS releated ops or rte_flow API.
> > > 
> > > For example, hinic, axbge, bnxt, cnxk, otx2, and ena.  
> 
> I suggest removing these checks.
> 
> > From my view point those are two different settings.
> > The RTE_ETH_MQ_RX_RSS_FLAG is global per port while
> > rte_flow is per rule.
> > 
> > I think, that if a PMD needs this flag, in order to enable it also for rte_flow then
> > it should be documented in the release note of the PMD.
> > It is a valid use case that the default traffic will not have RSS and only rules created by
> > rte_flow will have the RSS, for matching traffc.  
> 
> I think RTE_ETH_MQ_RX_RSS_FLAG should not be required by any PMD
> for rte_flow RSS rules.
> 
> 

Agreed.

The ideal state around RSS would be:
   - global settings affect the default started queues when device is started.
     if RSS is enabled and 4 queues are started, then RSS would happen for received
     packets across those 4 queues.
   - when adding new flow related rx:
      - new queues could be started - BUT not part of original RSS
      - new rte_flow rule can do RSS against the new flow:
            example:
              start queues 4,5,6,7
              rte_flow match TCP port 80 and process on queues 4,5,6,7 with RSS

This is a mess today, most devices work differently and there is no reference software
implementation.  In an ideal state, there would be a reference software implementation
that implements all of rte_flow, and all new hardware support would have to work the same
as the reference implementation. And there would be a full CI test suite around rte_flow.
  
lihuisong (C) March 3, 2022, 2:47 a.m. UTC | #6
Hi, Ori,

在 2022/3/2 22:07, Ori Kam 写道:
> Hi Lihuisong,
>
>> -----Original Message-----
>> From: lihuisong (C) <lihuisong@huawei.com>
>> Sent: Wednesday, March 2, 2022 4:10 AM
>> Subject: Re: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS behavior
>>
>>
>> 在 2022/3/1 0:42, Ferruh Yigit 写道:
>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>
>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
>>>> dev_configure phase. However, if this flag isn't set, RSS can be enabled
>>>> through the ethdev ops and rte_flow API. This behavior is contrary to
>>>> each
>>>> other.
>>>>
>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>
>>> Hi Huisong, Connor,
>>>
>>> Let's get a little more feedback for this patch, cc'ed more people.
>>>
>>>
>>> To enable RSS, multi queue mode should be set to
>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
>>>
>>> But I wonder if it is required to configure RSS via flow API,
>> I do not know the original purpose of adding the RSS configuration in
>> flow API.
>>
> The purpose is simple, this allow to create RSS per rule and not a global one.
> For example create RSS that sends TCP to some queues while othe RSS will send
> UDP traffic to different queues.
I'm a little confused now. The "per rule" also seems to be a global 
configuration.
Example:
  - start PMD with 0,1,2,3
  - create TCP packets to 2,3 queues. At this moment, only 2,3 queues 
can be received for other types of packets.
Because this rule is implemented by modifying the entry of the 
redirection table which is global for this device.
>
>> However, as far as I know, the hash algorithm can be configured via this
>> API,
>>
>> but not via ethdev ops API.
>>
>>> and if other PMDs check this configuration for flow API?
>> Some PMDs already have similar check in RSS releated ops or rte_flow API.
>>
>> For example, hinic, axbge, bnxt, cnxk, otx2, and ena.
>>
>>> .
>  From my view point those are two different settings.
> The RTE_ETH_MQ_RX_RSS_FLAG is global per port while
> rte_flow is per rule.
>
> I think, that if a PMD needs this flag, in order to enable it also for rte_flow then
> it should be documented in the release note of the PMD.
> It is a valid use case that the default traffic will not have RSS and only rules created by
> rte_flow will have the RSS, for matching traffc.
>
> Best,
> Ori
  
lihuisong (C) March 3, 2022, 2:48 a.m. UTC | #7
Thanks, Stephen.

在 2022/3/3 0:59, Stephen Hemminger 写道:
> On Wed, 02 Mar 2022 15:46:37 +0100
> Thomas Monjalon <thomas@monjalon.net> wrote:
>
>> 02/03/2022 15:07, Ori Kam:
>>> From: lihuisong (C) <lihuisong@huawei.com>
>>>> 在 2022/3/1 0:42, Ferruh Yigit 写道:
>>>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
>>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>>
>>>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
>>>>>> dev_configure phase. However, if this flag isn't set, RSS can be enabled
>>>>>> through the ethdev ops and rte_flow API. This behavior is contrary to
>>>>>> each
>>>>>> other.
>>>>>>
>>>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
>>>>>> Cc: stable@dpdk.org
>>>>>>
>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>>>
>>>>> Hi Huisong, Connor,
>>>>>
>>>>> Let's get a little more feedback for this patch, cc'ed more people.
>>>>>
>>>>>
>>>>> To enable RSS, multi queue mode should be set to
>>>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
>>>>>
>>>>> But I wonder if it is required to configure RSS via flow API,
>>>> I do not know the original purpose of adding the RSS configuration in
>>>> flow API.
>>>>    
>>> The purpose is simple, this allow to create RSS per rule and not a global one.
>>> For example create RSS that sends TCP to some queues while othe RSS will send
>>> UDP traffic to different queues.
>>>    
>>>> However, as far as I know, the hash algorithm can be configured via this
>>>> API,
>>>>
>>>> but not via ethdev ops API.
>>>>    
>>>>> and if other PMDs check this configuration for flow API?
>>>> Some PMDs already have similar check in RSS releated ops or rte_flow API.
>>>>
>>>> For example, hinic, axbge, bnxt, cnxk, otx2, and ena.
>> I suggest removing these checks.
>>
>>>  From my view point those are two different settings.
>>> The RTE_ETH_MQ_RX_RSS_FLAG is global per port while
>>> rte_flow is per rule.
>>>
>>> I think, that if a PMD needs this flag, in order to enable it also for rte_flow then
>>> it should be documented in the release note of the PMD.
>>> It is a valid use case that the default traffic will not have RSS and only rules created by
>>> rte_flow will have the RSS, for matching traffc.
>> I think RTE_ETH_MQ_RX_RSS_FLAG should not be required by any PMD
>> for rte_flow RSS rules.
>>
>>
> Agreed.
>
> The ideal state around RSS would be:
>     - global settings affect the default started queues when device is started.
>       if RSS is enabled and 4 queues are started, then RSS would happen for received
>       packets across those 4 queues.
>     - when adding new flow related rx:
>        - new queues could be started - BUT not part of original RSS
How should I understand this? If do this, we have to increase queue numbers.
>        - new rte_flow rule can do RSS against the new flow:
>              example:
>                start queues 4,5,6,7
>                rte_flow match TCP port 80 and process on queues 4,5,6,7 with RSS
I think you have the same view as Ori. But some original RSS hash 
configuration
has been overwritten by a new rule, such as redirection table.
>
> This is a mess today, most devices work differently and there is no reference software
> implementation.  In an ideal state, there would be a reference software implementation
> that implements all of rte_flow, and all new hardware support would have to work the same
> as the reference implementation. And there would be a full CI test suite around rte_flow.
> .
  
lihuisong (C) March 9, 2022, 8:03 a.m. UTC | #8
在 2022/3/3 10:47, lihuisong (C) 写道:
> Hi, Ori,
>
> 在 2022/3/2 22:07, Ori Kam 写道:
>> Hi Lihuisong,
>>
>>> -----Original Message-----
>>> From: lihuisong (C) <lihuisong@huawei.com>
>>> Sent: Wednesday, March 2, 2022 4:10 AM
>>> Subject: Re: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS 
>>> behavior
>>>
>>>
>>> 在 2022/3/1 0:42, Ferruh Yigit 写道:
>>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>
>>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
>>>>> dev_configure phase. However, if this flag isn't set, RSS can be 
>>>>> enabled
>>>>> through the ethdev ops and rte_flow API. This behavior is contrary to
>>>>> each
>>>>> other.
>>>>>
>>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
>>>>> Cc: stable@dpdk.org
>>>>>
>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>>
>>>> Hi Huisong, Connor,
>>>>
>>>> Let's get a little more feedback for this patch, cc'ed more people.
>>>>
>>>>
>>>> To enable RSS, multi queue mode should be set to
>>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
>>>>
>>>> But I wonder if it is required to configure RSS via flow API,
>>> I do not know the original purpose of adding the RSS configuration in
>>> flow API.
>>>
>> The purpose is simple, this allow to create RSS per rule and not a 
>> global one.
>> For example create RSS that sends TCP to some queues while othe RSS 
>> will send
>> UDP traffic to different queues.
> I'm a little confused now. The "per rule" also seems to be a global 
> configuration.
> Example:
>  - start PMD with 0,1,2,3
>  - create TCP packets to 2,3 queues. At this moment, only 2,3 queues 
> can be received for other types of packets.
> Because this rule is implemented by modifying the entry of the 
> redirection table which is global for this device.
Hi, Ori and Stephen.
Can you help me clear up the confusion above? If some NICs behave like 
this, what should we do about it?
>>
>>> However, as far as I know, the hash algorithm can be configured via 
>>> this
>>> API,
>>>
>>> but not via ethdev ops API.
>>>
>>>> and if other PMDs check this configuration for flow API?
>>> Some PMDs already have similar check in RSS releated ops or rte_flow 
>>> API.
>>>
>>> For example, hinic, axbge, bnxt, cnxk, otx2, and ena.
>>>
>>>> .
>>  From my view point those are two different settings.
>> The RTE_ETH_MQ_RX_RSS_FLAG is global per port while
>> rte_flow is per rule.
>>
>> I think, that if a PMD needs this flag, in order to enable it also 
>> for rte_flow then
>> it should be documented in the release note of the PMD.
>> It is a valid use case that the default traffic will not have RSS and 
>> only rules created by
>> rte_flow will have the RSS, for matching traffc.
>>
>> Best,
>> Ori
  
Ori Kam March 9, 2022, 9:55 a.m. UTC | #9
Hi Lihusiong,

> -----Original Message-----
> From: lihuisong (C) <lihuisong@huawei.com>
> Sent: Wednesday, March 9, 2022 10:03 AM
> Subject: Re: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS behavior
> 
> 
> 在 2022/3/3 10:47, lihuisong (C) 写道:
> > Hi, Ori,
> >
> > 在 2022/3/2 22:07, Ori Kam 写道:
> >> Hi Lihuisong,
> >>
> >>> -----Original Message-----
> >>> From: lihuisong (C) <lihuisong@huawei.com>
> >>> Sent: Wednesday, March 2, 2022 4:10 AM
> >>> Subject: Re: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS
> >>> behavior
> >>>
> >>>
> >>> 在 2022/3/1 0:42, Ferruh Yigit 写道:
> >>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
> >>>>> From: Huisong Li <lihuisong@huawei.com>
> >>>>>
> >>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
> >>>>> dev_configure phase. However, if this flag isn't set, RSS can be
> >>>>> enabled
> >>>>> through the ethdev ops and rte_flow API. This behavior is contrary to
> >>>>> each
> >>>>> other.
> >>>>>
> >>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
> >>>>> Cc: stable@dpdk.org
> >>>>>
> >>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> >>>>
> >>>> Hi Huisong, Connor,
> >>>>
> >>>> Let's get a little more feedback for this patch, cc'ed more people.
> >>>>
> >>>>
> >>>> To enable RSS, multi queue mode should be set to
> >>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
> >>>>
> >>>> But I wonder if it is required to configure RSS via flow API,
> >>> I do not know the original purpose of adding the RSS configuration in
> >>> flow API.
> >>>
> >> The purpose is simple, this allow to create RSS per rule and not a
> >> global one.
> >> For example create RSS that sends TCP to some queues while othe RSS
> >> will send
> >> UDP traffic to different queues.
> > I'm a little confused now. The "per rule" also seems to be a global
> > configuration.
> > Example:
> >  - start PMD with 0,1,2,3
> >  - create TCP packets to 2,3 queues. At this moment, only 2,3 queues
> > can be received for other types of packets.
> > Because this rule is implemented by modifying the entry of the
> > redirection table which is global for this device.
> Hi, Ori and Stephen.
> Can you help me clear up the confusion above? If some NICs behave like
> this, what should we do about it?

I'm not sure I understand the issue, maybe it is releated to some HW/PMD limitation.
In your example non TCP traffic will be routed to one of the 4 queues (0,1,2,3),
While TCP traffic will only be routed to queues 2,3.

Now I can add new rule that matches on UDP packet and RSS to queue 0 and 3 in this case:
TCP packets will be routed to queues 0,3.
UDP packets will be routed to queues 2,3.
All the rest of the traffic will be routed to queues 0,1,2,3

And just to be clear if now I add a rule to match all packets in higher priority,
with RSS to queues 1,2. Then all traffic will be routed to queues 1,2.

At least this is what is expected, from API point of view.

Best,
Ori

> >>
> >>> However, as far as I know, the hash algorithm can be configured via
> >>> this
> >>> API,
> >>>
> >>> but not via ethdev ops API.
> >>>
> >>>> and if other PMDs check this configuration for flow API?
> >>> Some PMDs already have similar check in RSS releated ops or rte_flow
> >>> API.
> >>>
> >>> For example, hinic, axbge, bnxt, cnxk, otx2, and ena.
> >>>
> >>>> .
> >>  From my view point those are two different settings.
> >> The RTE_ETH_MQ_RX_RSS_FLAG is global per port while
> >> rte_flow is per rule.
> >>
> >> I think, that if a PMD needs this flag, in order to enable it also
> >> for rte_flow then
> >> it should be documented in the release note of the PMD.
> >> It is a valid use case that the default traffic will not have RSS and
> >> only rules created by
> >> rte_flow will have the RSS, for matching traffc.
> >>
> >> Best,
> >> Ori
  
lihuisong (C) March 10, 2022, 8:08 a.m. UTC | #10
在 2022/3/9 17:55, Ori Kam 写道:
> Hi Lihusiong,
>
>> -----Original Message-----
>> From: lihuisong (C) <lihuisong@huawei.com>
>> Sent: Wednesday, March 9, 2022 10:03 AM
>> Subject: Re: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS behavior
>>
>>
>> 在 2022/3/3 10:47, lihuisong (C) 写道:
>>> Hi, Ori,
>>>
>>> 在 2022/3/2 22:07, Ori Kam 写道:
>>>> Hi Lihuisong,
>>>>
>>>>> -----Original Message-----
>>>>> From: lihuisong (C) <lihuisong@huawei.com>
>>>>> Sent: Wednesday, March 2, 2022 4:10 AM
>>>>> Subject: Re: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS
>>>>> behavior
>>>>>
>>>>>
>>>>> 在 2022/3/1 0:42, Ferruh Yigit 写道:
>>>>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
>>>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>>>
>>>>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
>>>>>>> dev_configure phase. However, if this flag isn't set, RSS can be
>>>>>>> enabled
>>>>>>> through the ethdev ops and rte_flow API. This behavior is contrary to
>>>>>>> each
>>>>>>> other.
>>>>>>>
>>>>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
>>>>>>> Cc: stable@dpdk.org
>>>>>>>
>>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>>>> Hi Huisong, Connor,
>>>>>>
>>>>>> Let's get a little more feedback for this patch, cc'ed more people.
>>>>>>
>>>>>>
>>>>>> To enable RSS, multi queue mode should be set to
>>>>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
>>>>>>
>>>>>> But I wonder if it is required to configure RSS via flow API,
>>>>> I do not know the original purpose of adding the RSS configuration in
>>>>> flow API.
>>>>>
>>>> The purpose is simple, this allow to create RSS per rule and not a
>>>> global one.
>>>> For example create RSS that sends TCP to some queues while othe RSS
>>>> will send
>>>> UDP traffic to different queues.
>>> I'm a little confused now. The "per rule" also seems to be a global
>>> configuration.
>>> Example:
>>>   - start PMD with 0,1,2,3
>>>   - create TCP packets to 2,3 queues. At this moment, only 2,3 queues
>>> can be received for other types of packets.
>>> Because this rule is implemented by modifying the entry of the
>>> redirection table which is global for this device.
>> Hi, Ori and Stephen.
>> Can you help me clear up the confusion above? If some NICs behave like
>> this, what should we do about it?
> I'm not sure I understand the issue, maybe it is releated to some HW/PMD limitation.
> In your example non TCP traffic will be routed to one of the 4 queues (0,1,2,3),
> While TCP traffic will only be routed to queues 2,3.
>
> Now I can add new rule that matches on UDP packet and RSS to queue 0 and 3 in this case:
> TCP packets will be routed to queues 0,3.
> UDP packets will be routed to queues 2,3.
> All the rest of the traffic will be routed to queues 0,1,2,3
>
> And just to be clear if now I add a rule to match all packets in higher priority,
> with RSS to queues 1,2. Then all traffic will be routed to queues 1,2.
>
> At least this is what is expected, from API point of view.
>
> Best,
> Ori
Thank you for your answer. I understand it.
hns3 PMD cannot implement the above functions due to hardware limitation.
we may need add a check that specified RSS queues cannot be supported 
when specified packets types.
And only the packet type is specified, which meets the requirements of 
rte_flow API.
The check for the RTE_ETH_MQ_RX_RSS_FLAG flag in rte_flow is not correct.
Thanks, Ori and Stephen😁

But, I think, it is necessary for the '.rss_hash_update' and 
'.reta_update' APIs
in eth_dev_ops to verify this flag. What do you think? @Thomas, @Ferruh, 
@Ori and @Stephen.
>
>>>>> However, as far as I know, the hash algorithm can be configured via
>>>>> this
>>>>> API,
>>>>>
>>>>> but not via ethdev ops API.
>>>>>
>>>>>> and if other PMDs check this configuration for flow API?
>>>>> Some PMDs already have similar check in RSS releated ops or rte_flow
>>>>> API.
>>>>>
>>>>> For example, hinic, axbge, bnxt, cnxk, otx2, and ena.
>>>>>
>>>>>> .
>>>>   From my view point those are two different settings.
>>>> The RTE_ETH_MQ_RX_RSS_FLAG is global per port while
>>>> rte_flow is per rule.
>>>>
>>>> I think, that if a PMD needs this flag, in order to enable it also
>>>> for rte_flow then
>>>> it should be documented in the release note of the PMD.
>>>> It is a valid use case that the default traffic will not have RSS and
>>>> only rules created by
>>>> rte_flow will have the RSS, for matching traffc.
>>>>
>>>> Best,
>>>> Ori
  
lihuisong (C) March 21, 2022, 7:14 a.m. UTC | #11
Hi, all,

在 2022/3/10 16:08, lihuisong (C) 写道:
>
> 在 2022/3/9 17:55, Ori Kam 写道:
>> Hi Lihusiong,
>>
>>> -----Original Message-----
>>> From: lihuisong (C) <lihuisong@huawei.com>
>>> Sent: Wednesday, March 9, 2022 10:03 AM
>>> Subject: Re: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS 
>>> behavior
>>>
>>>
>>> 在 2022/3/3 10:47, lihuisong (C) 写道:
>>>> Hi, Ori,
>>>>
>>>> 在 2022/3/2 22:07, Ori Kam 写道:
>>>>> Hi Lihuisong,
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: lihuisong (C) <lihuisong@huawei.com>
>>>>>> Sent: Wednesday, March 2, 2022 4:10 AM
>>>>>> Subject: Re: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS
>>>>>> behavior
>>>>>>
>>>>>>
>>>>>> 在 2022/3/1 0:42, Ferruh Yigit 写道:
>>>>>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
>>>>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>>>>
>>>>>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be 
>>>>>>>> set in
>>>>>>>> dev_configure phase. However, if this flag isn't set, RSS can be
>>>>>>>> enabled
>>>>>>>> through the ethdev ops and rte_flow API. This behavior is 
>>>>>>>> contrary to
>>>>>>>> each
>>>>>>>> other.
>>>>>>>>
>>>>>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
>>>>>>>> Cc: stable@dpdk.org
>>>>>>>>
>>>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>>>>> Hi Huisong, Connor,
>>>>>>>
>>>>>>> Let's get a little more feedback for this patch, cc'ed more people.
>>>>>>>
>>>>>>>
>>>>>>> To enable RSS, multi queue mode should be set to
>>>>>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
>>>>>>>
>>>>>>> But I wonder if it is required to configure RSS via flow API,
>>>>>> I do not know the original purpose of adding the RSS 
>>>>>> configuration in
>>>>>> flow API.
>>>>>>
>>>>> The purpose is simple, this allow to create RSS per rule and not a
>>>>> global one.
>>>>> For example create RSS that sends TCP to some queues while othe RSS
>>>>> will send
>>>>> UDP traffic to different queues.
>>>> I'm a little confused now. The "per rule" also seems to be a global
>>>> configuration.
>>>> Example:
>>>>   - start PMD with 0,1,2,3
>>>>   - create TCP packets to 2,3 queues. At this moment, only 2,3 queues
>>>> can be received for other types of packets.
>>>> Because this rule is implemented by modifying the entry of the
>>>> redirection table which is global for this device.
>>> Hi, Ori and Stephen.
>>> Can you help me clear up the confusion above? If some NICs behave like
>>> this, what should we do about it?
>> I'm not sure I understand the issue, maybe it is releated to some 
>> HW/PMD limitation.
>> In your example non TCP traffic will be routed to one of the 4 queues 
>> (0,1,2,3),
>> While TCP traffic will only be routed to queues 2,3.
>>
>> Now I can add new rule that matches on UDP packet and RSS to queue 0 
>> and 3 in this case:
>> TCP packets will be routed to queues 0,3.
>> UDP packets will be routed to queues 2,3.
>> All the rest of the traffic will be routed to queues 0,1,2,3
>>
>> And just to be clear if now I add a rule to match all packets in 
>> higher priority,
>> with RSS to queues 1,2. Then all traffic will be routed to queues 1,2.
>>
>> At least this is what is expected, from API point of view.
>>
>> Best,
>> Ori
> Thank you for your answer. I understand it.
> hns3 PMD cannot implement the above functions due to hardware limitation.
> we may need add a check that specified RSS queues cannot be supported 
> when specified packets types.
> And only the packet type is specified, which meets the requirements of 
> rte_flow API.
> The check for the RTE_ETH_MQ_RX_RSS_FLAG flag in rte_flow is not correct.
> Thanks, Ori and Stephen😁
>
> But, I think, it is necessary for the '.rss_hash_update' and 
> '.reta_update' APIs
> in eth_dev_ops to verify this flag. What do you think? @Thomas, 
> @Ferruh, @Ori and @Stephen.
What's your take on it? I am looking forward to your reply. Thanks!
>>
>>>>>> However, as far as I know, the hash algorithm can be configured via
>>>>>> this
>>>>>> API,
>>>>>>
>>>>>> but not via ethdev ops API.
>>>>>>
>>>>>>> and if other PMDs check this configuration for flow API?
>>>>>> Some PMDs already have similar check in RSS releated ops or rte_flow
>>>>>> API.
>>>>>>
>>>>>> For example, hinic, axbge, bnxt, cnxk, otx2, and ena.
>>>>>>
>>>>>>> .
>>>>>   From my view point those are two different settings.
>>>>> The RTE_ETH_MQ_RX_RSS_FLAG is global per port while
>>>>> rte_flow is per rule.
>>>>>
>>>>> I think, that if a PMD needs this flag, in order to enable it also
>>>>> for rte_flow then
>>>>> it should be documented in the release note of the PMD.
>>>>> It is a valid use case that the default traffic will not have RSS and
>>>>> only rules created by
>>>>> rte_flow will have the RSS, for matching traffc.
>>>>>
>>>>> Best,
>>>>> Ori
> .
  
Thomas Monjalon March 22, 2022, 5:13 p.m. UTC | #12
21/03/2022 08:14, lihuisong (C):
> 2022/3/10 16:08, lihuisong (C):
> > 2022/3/9 17:55, Ori Kam:
> >> From: lihuisong (C) <lihuisong@huawei.com>
> >>> 2022/3/3 10:47, lihuisong (C):
> >>>> 2022/3/2 22:07, Ori Kam:
> >>>>> From: lihuisong (C) <lihuisong@huawei.com>
> >>>>>> 2022/3/1 0:42, Ferruh Yigit:
> >>>>>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
> >>>>>>>> From: Huisong Li <lihuisong@huawei.com>
> >>>>>>>>
> >>>>>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be 
> >>>>>>>> set in
> >>>>>>>> dev_configure phase. However, if this flag isn't set, RSS can be
> >>>>>>>> enabled
> >>>>>>>> through the ethdev ops and rte_flow API. This behavior is 
> >>>>>>>> contrary to
> >>>>>>>> each
> >>>>>>>> other.
> >>>>>>>>
> >>>>>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
> >>>>>>>> Cc: stable@dpdk.org
> >>>>>>>>
> >>>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> >>>>>>> Hi Huisong, Connor,
> >>>>>>>
> >>>>>>> Let's get a little more feedback for this patch, cc'ed more people.
> >>>>>>>
> >>>>>>> To enable RSS, multi queue mode should be set to
> >>>>>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
> >>>>>>>
> >>>>>>> But I wonder if it is required to configure RSS via flow API,
> >>>>>> I do not know the original purpose of adding the RSS 
> >>>>>> configuration in
> >>>>>> flow API.
> >>>>>>
> >>>>> The purpose is simple, this allow to create RSS per rule and not a
> >>>>> global one.
> >>>>> For example create RSS that sends TCP to some queues while othe RSS
> >>>>> will send
> >>>>> UDP traffic to different queues.
> >>>> I'm a little confused now. The "per rule" also seems to be a global
> >>>> configuration.
> >>>> Example:
> >>>>   - start PMD with 0,1,2,3
> >>>>   - create TCP packets to 2,3 queues. At this moment, only 2,3 queues
> >>>> can be received for other types of packets.
> >>>> Because this rule is implemented by modifying the entry of the
> >>>> redirection table which is global for this device.
> >>> Hi, Ori and Stephen.
> >>> Can you help me clear up the confusion above? If some NICs behave like
> >>> this, what should we do about it?
> >> I'm not sure I understand the issue, maybe it is releated to some 
> >> HW/PMD limitation.
> >> In your example non TCP traffic will be routed to one of the 4 queues 
> >> (0,1,2,3),
> >> While TCP traffic will only be routed to queues 2,3.
> >>
> >> Now I can add new rule that matches on UDP packet and RSS to queue 0 
> >> and 3 in this case:
> >> TCP packets will be routed to queues 0,3.
> >> UDP packets will be routed to queues 2,3.
> >> All the rest of the traffic will be routed to queues 0,1,2,3
> >>
> >> And just to be clear if now I add a rule to match all packets in 
> >> higher priority,
> >> with RSS to queues 1,2. Then all traffic will be routed to queues 1,2.
> >>
> >> At least this is what is expected, from API point of view.
> >>
> >> Best,
> >> Ori
> > Thank you for your answer. I understand it.
> > hns3 PMD cannot implement the above functions due to hardware limitation.
> > we may need add a check that specified RSS queues cannot be supported 
> > when specified packets types.
> > And only the packet type is specified, which meets the requirements of 
> > rte_flow API.
> > The check for the RTE_ETH_MQ_RX_RSS_FLAG flag in rte_flow is not correct.
> > Thanks, Ori and Stephen😁
> >
> > But, I think, it is necessary for the '.rss_hash_update' and 
> > '.reta_update' APIs
> > in eth_dev_ops to verify this flag. What do you think? @Thomas, 
> > @Ferruh, @Ori and @Stephen.
> What's your take on it? I am looking forward to your reply. Thanks!

I am not sure why you want to check this flag.
I can imagine we configure the hash and the table before enabling RSS
with the RTE_ETH_MQ_RX_RSS_FLAG flag.
  
lihuisong (C) March 23, 2022, 3:05 a.m. UTC | #13
在 2022/3/23 1:13, Thomas Monjalon 写道:
> 21/03/2022 08:14, lihuisong (C):
>> 2022/3/10 16:08, lihuisong (C):
>>> 2022/3/9 17:55, Ori Kam:
>>>> From: lihuisong (C) <lihuisong@huawei.com>
>>>>> 2022/3/3 10:47, lihuisong (C):
>>>>>> 2022/3/2 22:07, Ori Kam:
>>>>>>> From: lihuisong (C) <lihuisong@huawei.com>
>>>>>>>> 2022/3/1 0:42, Ferruh Yigit:
>>>>>>>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
>>>>>>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>>>>>>
>>>>>>>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be
>>>>>>>>>> set in
>>>>>>>>>> dev_configure phase. However, if this flag isn't set, RSS can be
>>>>>>>>>> enabled
>>>>>>>>>> through the ethdev ops and rte_flow API. This behavior is
>>>>>>>>>> contrary to
>>>>>>>>>> each
>>>>>>>>>> other.
>>>>>>>>>>
>>>>>>>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
>>>>>>>>>> Cc: stable@dpdk.org
>>>>>>>>>>
>>>>>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>>>>>>> Hi Huisong, Connor,
>>>>>>>>>
>>>>>>>>> Let's get a little more feedback for this patch, cc'ed more people.
>>>>>>>>>
>>>>>>>>> To enable RSS, multi queue mode should be set to
>>>>>>>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
>>>>>>>>>
>>>>>>>>> But I wonder if it is required to configure RSS via flow API,
>>>>>>>> I do not know the original purpose of adding the RSS
>>>>>>>> configuration in
>>>>>>>> flow API.
>>>>>>>>
>>>>>>> The purpose is simple, this allow to create RSS per rule and not a
>>>>>>> global one.
>>>>>>> For example create RSS that sends TCP to some queues while othe RSS
>>>>>>> will send
>>>>>>> UDP traffic to different queues.
>>>>>> I'm a little confused now. The "per rule" also seems to be a global
>>>>>> configuration.
>>>>>> Example:
>>>>>>    - start PMD with 0,1,2,3
>>>>>>    - create TCP packets to 2,3 queues. At this moment, only 2,3 queues
>>>>>> can be received for other types of packets.
>>>>>> Because this rule is implemented by modifying the entry of the
>>>>>> redirection table which is global for this device.
>>>>> Hi, Ori and Stephen.
>>>>> Can you help me clear up the confusion above? If some NICs behave like
>>>>> this, what should we do about it?
>>>> I'm not sure I understand the issue, maybe it is releated to some
>>>> HW/PMD limitation.
>>>> In your example non TCP traffic will be routed to one of the 4 queues
>>>> (0,1,2,3),
>>>> While TCP traffic will only be routed to queues 2,3.
>>>>
>>>> Now I can add new rule that matches on UDP packet and RSS to queue 0
>>>> and 3 in this case:
>>>> TCP packets will be routed to queues 0,3.
>>>> UDP packets will be routed to queues 2,3.
>>>> All the rest of the traffic will be routed to queues 0,1,2,3
>>>>
>>>> And just to be clear if now I add a rule to match all packets in
>>>> higher priority,
>>>> with RSS to queues 1,2. Then all traffic will be routed to queues 1,2.
>>>>
>>>> At least this is what is expected, from API point of view.
>>>>
>>>> Best,
>>>> Ori
>>> Thank you for your answer. I understand it.
>>> hns3 PMD cannot implement the above functions due to hardware limitation.
>>> we may need add a check that specified RSS queues cannot be supported
>>> when specified packets types.
>>> And only the packet type is specified, which meets the requirements of
>>> rte_flow API.
>>> The check for the RTE_ETH_MQ_RX_RSS_FLAG flag in rte_flow is not correct.
>>> Thanks, Ori and Stephen😁
>>>
>>> But, I think, it is necessary for the '.rss_hash_update' and
>>> '.reta_update' APIs
>>> in eth_dev_ops to verify this flag. What do you think? @Thomas,
>>> @Ferruh, @Ori and @Stephen.
>> What's your take on it? I am looking forward to your reply. Thanks!
> I am not sure why you want to check this flag.
I want to make sure that the behavior that PMD configured RSS is
consistent across different interfaces. The RTE_ETH_MQ_RX_RSS_FLAG
flag is a switch to enable RSS hash. If the switch isn't open, some
PMD do not configure RSS function. I think the consistency is necessary.
If not set RSS muti-queue mode, it is unnecessary to configure RSS.
> I can imagine we configure the hash and the table before enabling RSS
> with the RTE_ETH_MQ_RX_RSS_FLAG flag.
The flag is derived from dev_configure() which also configures
hash and key. I don't think it makes sense to configure hash and
reta before calling dev_configure. Because they'll be updated.
This is similar to configuring mtu.
>
>
> .
  
Thomas Monjalon March 23, 2022, 9:14 a.m. UTC | #14
23/03/2022 04:05, lihuisong (C):
> 在 2022/3/23 1:13, Thomas Monjalon 写道:
> > 21/03/2022 08:14, lihuisong (C):
> >> 2022/3/10 16:08, lihuisong (C):
> >>> 2022/3/9 17:55, Ori Kam:
> >>>> From: lihuisong (C) <lihuisong@huawei.com>
> >>>>> 2022/3/3 10:47, lihuisong (C):
> >>>>>> 2022/3/2 22:07, Ori Kam:
> >>>>>>> From: lihuisong (C) <lihuisong@huawei.com>
> >>>>>>>> 2022/3/1 0:42, Ferruh Yigit:
> >>>>>>>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
> >>>>>>>>>> From: Huisong Li <lihuisong@huawei.com>
> >>>>>>>>>>
> >>>>>>>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be
> >>>>>>>>>> set in
> >>>>>>>>>> dev_configure phase. However, if this flag isn't set, RSS can be
> >>>>>>>>>> enabled
> >>>>>>>>>> through the ethdev ops and rte_flow API. This behavior is
> >>>>>>>>>> contrary to
> >>>>>>>>>> each
> >>>>>>>>>> other.
> >>>>>>>>>>
> >>>>>>>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
> >>>>>>>>>> Cc: stable@dpdk.org
> >>>>>>>>>>
> >>>>>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> >>>>>>>>> Hi Huisong, Connor,
> >>>>>>>>>
> >>>>>>>>> Let's get a little more feedback for this patch, cc'ed more people.
> >>>>>>>>>
> >>>>>>>>> To enable RSS, multi queue mode should be set to
> >>>>>>>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
> >>>>>>>>>
> >>>>>>>>> But I wonder if it is required to configure RSS via flow API,
> >>>>>>>> I do not know the original purpose of adding the RSS
> >>>>>>>> configuration in
> >>>>>>>> flow API.
> >>>>>>>>
> >>>>>>> The purpose is simple, this allow to create RSS per rule and not a
> >>>>>>> global one.
> >>>>>>> For example create RSS that sends TCP to some queues while othe RSS
> >>>>>>> will send
> >>>>>>> UDP traffic to different queues.
> >>>>>> I'm a little confused now. The "per rule" also seems to be a global
> >>>>>> configuration.
> >>>>>> Example:
> >>>>>>    - start PMD with 0,1,2,3
> >>>>>>    - create TCP packets to 2,3 queues. At this moment, only 2,3 queues
> >>>>>> can be received for other types of packets.
> >>>>>> Because this rule is implemented by modifying the entry of the
> >>>>>> redirection table which is global for this device.
> >>>>> Hi, Ori and Stephen.
> >>>>> Can you help me clear up the confusion above? If some NICs behave like
> >>>>> this, what should we do about it?
> >>>> I'm not sure I understand the issue, maybe it is releated to some
> >>>> HW/PMD limitation.
> >>>> In your example non TCP traffic will be routed to one of the 4 queues
> >>>> (0,1,2,3),
> >>>> While TCP traffic will only be routed to queues 2,3.
> >>>>
> >>>> Now I can add new rule that matches on UDP packet and RSS to queue 0
> >>>> and 3 in this case:
> >>>> TCP packets will be routed to queues 0,3.
> >>>> UDP packets will be routed to queues 2,3.
> >>>> All the rest of the traffic will be routed to queues 0,1,2,3
> >>>>
> >>>> And just to be clear if now I add a rule to match all packets in
> >>>> higher priority,
> >>>> with RSS to queues 1,2. Then all traffic will be routed to queues 1,2.
> >>>>
> >>>> At least this is what is expected, from API point of view.
> >>>>
> >>>> Best,
> >>>> Ori
> >>> Thank you for your answer. I understand it.
> >>> hns3 PMD cannot implement the above functions due to hardware limitation.
> >>> we may need add a check that specified RSS queues cannot be supported
> >>> when specified packets types.
> >>> And only the packet type is specified, which meets the requirements of
> >>> rte_flow API.
> >>> The check for the RTE_ETH_MQ_RX_RSS_FLAG flag in rte_flow is not correct.
> >>> Thanks, Ori and Stephen😁
> >>>
> >>> But, I think, it is necessary for the '.rss_hash_update' and
> >>> '.reta_update' APIs
> >>> in eth_dev_ops to verify this flag. What do you think? @Thomas,
> >>> @Ferruh, @Ori and @Stephen.
> >> What's your take on it? I am looking forward to your reply. Thanks!
> > 
> > I am not sure why you want to check this flag.
> 
> I want to make sure that the behavior that PMD configured RSS is
> consistent across different interfaces. The RTE_ETH_MQ_RX_RSS_FLAG
> flag is a switch to enable RSS hash. If the switch isn't open, some
> PMD do not configure RSS function. I think the consistency is necessary.
> If not set RSS muti-queue mode, it is unnecessary to configure RSS.
> 
> > I can imagine we configure the hash and the table before enabling RSS
> > with the RTE_ETH_MQ_RX_RSS_FLAG flag.
> 
> The flag is derived from dev_configure() which also configures
> hash and key. I don't think it makes sense to configure hash and
> reta before calling dev_configure. Because they'll be updated.
> This is similar to configuring mtu.

OK I see your point.
So you would like to return an error in RSS functions
if the flag RTE_ETH_MQ_RX_RSS_FLAG is not set?
Should it be checked in ethdev library or PMDs?
  
lihuisong (C) March 23, 2022, 11:04 a.m. UTC | #15
在 2022/3/23 17:14, Thomas Monjalon 写道:
> 23/03/2022 04:05, lihuisong (C):
>> 在 2022/3/23 1:13, Thomas Monjalon 写道:
>>> 21/03/2022 08:14, lihuisong (C):
>>>> 2022/3/10 16:08, lihuisong (C):
>>>>> 2022/3/9 17:55, Ori Kam:
>>>>>> From: lihuisong (C) <lihuisong@huawei.com>
>>>>>>> 2022/3/3 10:47, lihuisong (C):
>>>>>>>> 2022/3/2 22:07, Ori Kam:
>>>>>>>>> From: lihuisong (C) <lihuisong@huawei.com>
>>>>>>>>>> 2022/3/1 0:42, Ferruh Yigit:
>>>>>>>>>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
>>>>>>>>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>>>>>>>>
>>>>>>>>>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be
>>>>>>>>>>>> set in
>>>>>>>>>>>> dev_configure phase. However, if this flag isn't set, RSS can be
>>>>>>>>>>>> enabled
>>>>>>>>>>>> through the ethdev ops and rte_flow API. This behavior is
>>>>>>>>>>>> contrary to
>>>>>>>>>>>> each
>>>>>>>>>>>> other.
>>>>>>>>>>>>
>>>>>>>>>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
>>>>>>>>>>>> Cc: stable@dpdk.org
>>>>>>>>>>>>
>>>>>>>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>>>>>>>>> Hi Huisong, Connor,
>>>>>>>>>>>
>>>>>>>>>>> Let's get a little more feedback for this patch, cc'ed more people.
>>>>>>>>>>>
>>>>>>>>>>> To enable RSS, multi queue mode should be set to
>>>>>>>>>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
>>>>>>>>>>>
>>>>>>>>>>> But I wonder if it is required to configure RSS via flow API,
>>>>>>>>>> I do not know the original purpose of adding the RSS
>>>>>>>>>> configuration in
>>>>>>>>>> flow API.
>>>>>>>>>>
>>>>>>>>> The purpose is simple, this allow to create RSS per rule and not a
>>>>>>>>> global one.
>>>>>>>>> For example create RSS that sends TCP to some queues while othe RSS
>>>>>>>>> will send
>>>>>>>>> UDP traffic to different queues.
>>>>>>>> I'm a little confused now. The "per rule" also seems to be a global
>>>>>>>> configuration.
>>>>>>>> Example:
>>>>>>>>     - start PMD with 0,1,2,3
>>>>>>>>     - create TCP packets to 2,3 queues. At this moment, only 2,3 queues
>>>>>>>> can be received for other types of packets.
>>>>>>>> Because this rule is implemented by modifying the entry of the
>>>>>>>> redirection table which is global for this device.
>>>>>>> Hi, Ori and Stephen.
>>>>>>> Can you help me clear up the confusion above? If some NICs behave like
>>>>>>> this, what should we do about it?
>>>>>> I'm not sure I understand the issue, maybe it is releated to some
>>>>>> HW/PMD limitation.
>>>>>> In your example non TCP traffic will be routed to one of the 4 queues
>>>>>> (0,1,2,3),
>>>>>> While TCP traffic will only be routed to queues 2,3.
>>>>>>
>>>>>> Now I can add new rule that matches on UDP packet and RSS to queue 0
>>>>>> and 3 in this case:
>>>>>> TCP packets will be routed to queues 0,3.
>>>>>> UDP packets will be routed to queues 2,3.
>>>>>> All the rest of the traffic will be routed to queues 0,1,2,3
>>>>>>
>>>>>> And just to be clear if now I add a rule to match all packets in
>>>>>> higher priority,
>>>>>> with RSS to queues 1,2. Then all traffic will be routed to queues 1,2.
>>>>>>
>>>>>> At least this is what is expected, from API point of view.
>>>>>>
>>>>>> Best,
>>>>>> Ori
>>>>> Thank you for your answer. I understand it.
>>>>> hns3 PMD cannot implement the above functions due to hardware limitation.
>>>>> we may need add a check that specified RSS queues cannot be supported
>>>>> when specified packets types.
>>>>> And only the packet type is specified, which meets the requirements of
>>>>> rte_flow API.
>>>>> The check for the RTE_ETH_MQ_RX_RSS_FLAG flag in rte_flow is not correct.
>>>>> Thanks, Ori and Stephen😁
>>>>>
>>>>> But, I think, it is necessary for the '.rss_hash_update' and
>>>>> '.reta_update' APIs
>>>>> in eth_dev_ops to verify this flag. What do you think? @Thomas,
>>>>> @Ferruh, @Ori and @Stephen.
>>>> What's your take on it? I am looking forward to your reply. Thanks!
>>> I am not sure why you want to check this flag.
>> I want to make sure that the behavior that PMD configured RSS is
>> consistent across different interfaces. The RTE_ETH_MQ_RX_RSS_FLAG
>> flag is a switch to enable RSS hash. If the switch isn't open, some
>> PMD do not configure RSS function. I think the consistency is necessary.
>> If not set RSS muti-queue mode, it is unnecessary to configure RSS.
>>
>>> I can imagine we configure the hash and the table before enabling RSS
>>> with the RTE_ETH_MQ_RX_RSS_FLAG flag.
>> The flag is derived from dev_configure() which also configures
>> hash and key. I don't think it makes sense to configure hash and
>> reta before calling dev_configure. Because they'll be updated.
>> This is similar to configuring mtu.
> OK I see your point.
> So you would like to return an error in RSS functions
> if the flag RTE_ETH_MQ_RX_RSS_FLAG is not set?
Yes
> Should it be checked in ethdev library or PMDs?
I think it's better to put it in the ethdev layer if we do it.
Should we add this check in 'rss_hash_update' and 'reta_update' APIs?
>
>
>
> .
  
Thomas Monjalon March 23, 2022, 7:04 p.m. UTC | #16
23/03/2022 12:04, lihuisong (C):
> 在 2022/3/23 17:14, Thomas Monjalon 写道:
> > 23/03/2022 04:05, lihuisong (C):
> >> 在 2022/3/23 1:13, Thomas Monjalon 写道:
> >>> 21/03/2022 08:14, lihuisong (C):
> >>>> 2022/3/10 16:08, lihuisong (C):
> >>>>> 2022/3/9 17:55, Ori Kam:
> >>>>>> From: lihuisong (C) <lihuisong@huawei.com>
> >>>>>>> 2022/3/3 10:47, lihuisong (C):
> >>>>>>>> 2022/3/2 22:07, Ori Kam:
> >>>>>>>>> From: lihuisong (C) <lihuisong@huawei.com>
> >>>>>>>>>> 2022/3/1 0:42, Ferruh Yigit:
> >>>>>>>>>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
> >>>>>>>>>>>> From: Huisong Li <lihuisong@huawei.com>
> >>>>>>>>>>>>
> >>>>>>>>>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be
> >>>>>>>>>>>> set in
> >>>>>>>>>>>> dev_configure phase. However, if this flag isn't set, RSS can be
> >>>>>>>>>>>> enabled
> >>>>>>>>>>>> through the ethdev ops and rte_flow API. This behavior is
> >>>>>>>>>>>> contrary to
> >>>>>>>>>>>> each
> >>>>>>>>>>>> other.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
> >>>>>>>>>>>> Cc: stable@dpdk.org
> >>>>>>>>>>>>
> >>>>>>>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> >>>>>>>>>>> Hi Huisong, Connor,
> >>>>>>>>>>>
> >>>>>>>>>>> Let's get a little more feedback for this patch, cc'ed more people.
> >>>>>>>>>>>
> >>>>>>>>>>> To enable RSS, multi queue mode should be set to
> >>>>>>>>>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
> >>>>>>>>>>>
> >>>>>>>>>>> But I wonder if it is required to configure RSS via flow API,
> >>>>>>>>>> I do not know the original purpose of adding the RSS
> >>>>>>>>>> configuration in
> >>>>>>>>>> flow API.
> >>>>>>>>>>
> >>>>>>>>> The purpose is simple, this allow to create RSS per rule and not a
> >>>>>>>>> global one.
> >>>>>>>>> For example create RSS that sends TCP to some queues while othe RSS
> >>>>>>>>> will send
> >>>>>>>>> UDP traffic to different queues.
> >>>>>>>> I'm a little confused now. The "per rule" also seems to be a global
> >>>>>>>> configuration.
> >>>>>>>> Example:
> >>>>>>>>     - start PMD with 0,1,2,3
> >>>>>>>>     - create TCP packets to 2,3 queues. At this moment, only 2,3 queues
> >>>>>>>> can be received for other types of packets.
> >>>>>>>> Because this rule is implemented by modifying the entry of the
> >>>>>>>> redirection table which is global for this device.
> >>>>>>> Hi, Ori and Stephen.
> >>>>>>> Can you help me clear up the confusion above? If some NICs behave like
> >>>>>>> this, what should we do about it?
> >>>>>> I'm not sure I understand the issue, maybe it is releated to some
> >>>>>> HW/PMD limitation.
> >>>>>> In your example non TCP traffic will be routed to one of the 4 queues
> >>>>>> (0,1,2,3),
> >>>>>> While TCP traffic will only be routed to queues 2,3.
> >>>>>>
> >>>>>> Now I can add new rule that matches on UDP packet and RSS to queue 0
> >>>>>> and 3 in this case:
> >>>>>> TCP packets will be routed to queues 0,3.
> >>>>>> UDP packets will be routed to queues 2,3.
> >>>>>> All the rest of the traffic will be routed to queues 0,1,2,3
> >>>>>>
> >>>>>> And just to be clear if now I add a rule to match all packets in
> >>>>>> higher priority,
> >>>>>> with RSS to queues 1,2. Then all traffic will be routed to queues 1,2.
> >>>>>>
> >>>>>> At least this is what is expected, from API point of view.
> >>>>>>
> >>>>>> Best,
> >>>>>> Ori
> >>>>> Thank you for your answer. I understand it.
> >>>>> hns3 PMD cannot implement the above functions due to hardware limitation.
> >>>>> we may need add a check that specified RSS queues cannot be supported
> >>>>> when specified packets types.
> >>>>> And only the packet type is specified, which meets the requirements of
> >>>>> rte_flow API.
> >>>>> The check for the RTE_ETH_MQ_RX_RSS_FLAG flag in rte_flow is not correct.
> >>>>> Thanks, Ori and Stephen😁
> >>>>>
> >>>>> But, I think, it is necessary for the '.rss_hash_update' and
> >>>>> '.reta_update' APIs
> >>>>> in eth_dev_ops to verify this flag. What do you think? @Thomas,
> >>>>> @Ferruh, @Ori and @Stephen.
> >>>> What's your take on it? I am looking forward to your reply. Thanks!
> >>> I am not sure why you want to check this flag.
> >> I want to make sure that the behavior that PMD configured RSS is
> >> consistent across different interfaces. The RTE_ETH_MQ_RX_RSS_FLAG
> >> flag is a switch to enable RSS hash. If the switch isn't open, some
> >> PMD do not configure RSS function. I think the consistency is necessary.
> >> If not set RSS muti-queue mode, it is unnecessary to configure RSS.
> >>
> >>> I can imagine we configure the hash and the table before enabling RSS
> >>> with the RTE_ETH_MQ_RX_RSS_FLAG flag.
> >> The flag is derived from dev_configure() which also configures
> >> hash and key. I don't think it makes sense to configure hash and
> >> reta before calling dev_configure. Because they'll be updated.
> >> This is similar to configuring mtu.
> > OK I see your point.
> > So you would like to return an error in RSS functions
> > if the flag RTE_ETH_MQ_RX_RSS_FLAG is not set?
> Yes
> > Should it be checked in ethdev library or PMDs?
> I think it's better to put it in the ethdev layer if we do it.
> Should we add this check in 'rss_hash_update' and 'reta_update' APIs?

I'm OK with adding the check in ethdev.
  
Ajit Khaparde March 23, 2022, 7:50 p.m. UTC | #17
On Wed, Mar 23, 2022 at 12:04 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 23/03/2022 12:04, lihuisong (C):
> > 在 2022/3/23 17:14, Thomas Monjalon 写道:
> > > 23/03/2022 04:05, lihuisong (C):
> > >> 在 2022/3/23 1:13, Thomas Monjalon 写道:
> > >>> 21/03/2022 08:14, lihuisong (C):
> > >>>> 2022/3/10 16:08, lihuisong (C):
> > >>>>> 2022/3/9 17:55, Ori Kam:
> > >>>>>> From: lihuisong (C) <lihuisong@huawei.com>
> > >>>>>>> 2022/3/3 10:47, lihuisong (C):
> > >>>>>>>> 2022/3/2 22:07, Ori Kam:
> > >>>>>>>>> From: lihuisong (C) <lihuisong@huawei.com>
> > >>>>>>>>>> 2022/3/1 0:42, Ferruh Yigit:
> > >>>>>>>>>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
> > >>>>>>>>>>>> From: Huisong Li <lihuisong@huawei.com>
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be
> > >>>>>>>>>>>> set in
> > >>>>>>>>>>>> dev_configure phase. However, if this flag isn't set, RSS can be
> > >>>>>>>>>>>> enabled
> > >>>>>>>>>>>> through the ethdev ops and rte_flow API. This behavior is
> > >>>>>>>>>>>> contrary to
> > >>>>>>>>>>>> each
> > >>>>>>>>>>>> other.
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
> > >>>>>>>>>>>> Cc: stable@dpdk.org
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> > >>>>>>>>>>> Hi Huisong, Connor,
> > >>>>>>>>>>>
> > >>>>>>>>>>> Let's get a little more feedback for this patch, cc'ed more people.
> > >>>>>>>>>>>
> > >>>>>>>>>>> To enable RSS, multi queue mode should be set to
> > >>>>>>>>>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
> > >>>>>>>>>>>
> > >>>>>>>>>>> But I wonder if it is required to configure RSS via flow API,
> > >>>>>>>>>> I do not know the original purpose of adding the RSS
> > >>>>>>>>>> configuration in
> > >>>>>>>>>> flow API.
> > >>>>>>>>>>
> > >>>>>>>>> The purpose is simple, this allow to create RSS per rule and not a
> > >>>>>>>>> global one.
> > >>>>>>>>> For example create RSS that sends TCP to some queues while othe RSS
> > >>>>>>>>> will send
> > >>>>>>>>> UDP traffic to different queues.
> > >>>>>>>> I'm a little confused now. The "per rule" also seems to be a global
> > >>>>>>>> configuration.
> > >>>>>>>> Example:
> > >>>>>>>>     - start PMD with 0,1,2,3
> > >>>>>>>>     - create TCP packets to 2,3 queues. At this moment, only 2,3 queues
> > >>>>>>>> can be received for other types of packets.
> > >>>>>>>> Because this rule is implemented by modifying the entry of the
> > >>>>>>>> redirection table which is global for this device.
> > >>>>>>> Hi, Ori and Stephen.
> > >>>>>>> Can you help me clear up the confusion above? If some NICs behave like
> > >>>>>>> this, what should we do about it?
> > >>>>>> I'm not sure I understand the issue, maybe it is releated to some
> > >>>>>> HW/PMD limitation.
> > >>>>>> In your example non TCP traffic will be routed to one of the 4 queues
> > >>>>>> (0,1,2,3),
> > >>>>>> While TCP traffic will only be routed to queues 2,3.
> > >>>>>>
> > >>>>>> Now I can add new rule that matches on UDP packet and RSS to queue 0
> > >>>>>> and 3 in this case:
> > >>>>>> TCP packets will be routed to queues 0,3.
> > >>>>>> UDP packets will be routed to queues 2,3.
> > >>>>>> All the rest of the traffic will be routed to queues 0,1,2,3
> > >>>>>>
> > >>>>>> And just to be clear if now I add a rule to match all packets in
> > >>>>>> higher priority,
> > >>>>>> with RSS to queues 1,2. Then all traffic will be routed to queues 1,2.
> > >>>>>>
> > >>>>>> At least this is what is expected, from API point of view.
> > >>>>>>
> > >>>>>> Best,
> > >>>>>> Ori
> > >>>>> Thank you for your answer. I understand it.
> > >>>>> hns3 PMD cannot implement the above functions due to hardware limitation.
> > >>>>> we may need add a check that specified RSS queues cannot be supported
> > >>>>> when specified packets types.
> > >>>>> And only the packet type is specified, which meets the requirements of
> > >>>>> rte_flow API.
> > >>>>> The check for the RTE_ETH_MQ_RX_RSS_FLAG flag in rte_flow is not correct.
> > >>>>> Thanks, Ori and Stephen😁
> > >>>>>
> > >>>>> But, I think, it is necessary for the '.rss_hash_update' and
> > >>>>> '.reta_update' APIs
> > >>>>> in eth_dev_ops to verify this flag. What do you think? @Thomas,
> > >>>>> @Ferruh, @Ori and @Stephen.
> > >>>> What's your take on it? I am looking forward to your reply. Thanks!
> > >>> I am not sure why you want to check this flag.
> > >> I want to make sure that the behavior that PMD configured RSS is
> > >> consistent across different interfaces. The RTE_ETH_MQ_RX_RSS_FLAG
> > >> flag is a switch to enable RSS hash. If the switch isn't open, some
> > >> PMD do not configure RSS function. I think the consistency is necessary.
> > >> If not set RSS muti-queue mode, it is unnecessary to configure RSS.
> > >>
> > >>> I can imagine we configure the hash and the table before enabling RSS
> > >>> with the RTE_ETH_MQ_RX_RSS_FLAG flag.
> > >> The flag is derived from dev_configure() which also configures
> > >> hash and key. I don't think it makes sense to configure hash and
> > >> reta before calling dev_configure. Because they'll be updated.
> > >> This is similar to configuring mtu.
> > > OK I see your point.
> > > So you would like to return an error in RSS functions
> > > if the flag RTE_ETH_MQ_RX_RSS_FLAG is not set?
> > Yes
> > > Should it be checked in ethdev library or PMDs?
> > I think it's better to put it in the ethdev layer if we do it.
> > Should we add this check in 'rss_hash_update' and 'reta_update' APIs?
>
> I'm OK with adding the check in ethdev.
+1

Apologies for getting late to this thread.
  
Harold Huang March 24, 2022, 7:16 a.m. UTC | #18
Hi, all,

On Thu, Mar 3, 2022 at 12:59 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> On Wed, 02 Mar 2022 15:46:37 +0100
> Thomas Monjalon <thomas@monjalon.net> wrote:
>
> > 02/03/2022 15:07, Ori Kam:
> > > From: lihuisong (C) <lihuisong@huawei.com>
> > > > 在 2022/3/1 0:42, Ferruh Yigit 写道:
> > > > > On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
> > > > >> From: Huisong Li <lihuisong@huawei.com>
> > > > >>
> > > > >> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
> > > > >> dev_configure phase. However, if this flag isn't set, RSS can be enabled
> > > > >> through the ethdev ops and rte_flow API. This behavior is contrary to
> > > > >> each
> > > > >> other.
> > > > >>
> > > > >> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
> > > > >> Cc: stable@dpdk.org
> > > > >>
> > > > >> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> > > > >
> > > > >
> > > > > Hi Huisong, Connor,
> > > > >
> > > > > Let's get a little more feedback for this patch, cc'ed more people.
> > > > >
> > > > >
> > > > > To enable RSS, multi queue mode should be set to
> > > > > 'RTE_ETH_MQ_RX_RSS_FLAG'.
> > > > >
> > > > > But I wonder if it is required to configure RSS via flow API,
> > > >
> > > > I do not know the original purpose of adding the RSS configuration in
> > > > flow API.

In OVS-DPDK, there is a use case to add mark+rss action via flow API. See [1]:
[1]: https://github.com/openvswitch/ovs/blob/master/lib/netdev-offload-dpdk.c#L1677

> > > >
> > > The purpose is simple, this allow to create RSS per rule and not a global one.
> > > For example create RSS that sends TCP to some queues while othe RSS will send
> > > UDP traffic to different queues.
> > >
> > > > However, as far as I know, the hash algorithm can be configured via this
> > > > API,
> > > >
> > > > but not via ethdev ops API.
> > > >
> > > > > and if other PMDs check this configuration for flow API?
> > > >
> > > > Some PMDs already have similar check in RSS releated ops or rte_flow API.
> > > >
> > > > For example, hinic, axbge, bnxt, cnxk, otx2, and ena.
> >
> > I suggest removing these checks.
> >
> > > From my view point those are two different settings.
> > > The RTE_ETH_MQ_RX_RSS_FLAG is global per port while
> > > rte_flow is per rule.
> > >
> > > I think, that if a PMD needs this flag, in order to enable it also for rte_flow then
> > > it should be documented in the release note of the PMD.
> > > It is a valid use case that the default traffic will not have RSS and only rules created by
> > > rte_flow will have the RSS, for matching traffc.
> >
> > I think RTE_ETH_MQ_RX_RSS_FLAG should not be required by any PMD
> > for rte_flow RSS rules.
> >
> >
>
> Agreed.
>
> The ideal state around RSS would be:
>    - global settings affect the default started queues when device is started.
>      if RSS is enabled and 4 queues are started, then RSS would happen for received
>      packets across those 4 queues.
>    - when adding new flow related rx:
>       - new queues could be started - BUT not part of original RSS
>       - new rte_flow rule can do RSS against the new flow:
>             example:
>               start queues 4,5,6,7
>               rte_flow match TCP port 80 and process on queues 4,5,6,7 with RSS
>
> This is a mess today, most devices work differently and there is no reference software
> implementation.  In an ideal state, there would be a reference software implementation
> that implements all of rte_flow, and all new hardware support would have to work the same
> as the reference implementation. And there would be a full CI test suite around rte_flow.

When adding a new flow with RSS action, does the RSS hash type have to
be set or it could inherit the global setting? I see there are some
different behaviors when we use RSS actions without hash types. In my
test, the E810 and Broadcom NetXtreme-E work well but there are some
problems in MLX5. There is a patch in [2]. Anyone could give some
suggestions?

[2]: https://patchwork.ozlabs.org/project/openvswitch/patch/20220316080842.811478-1-baymaxhuang@gmail.com/
  
lihuisong (C) March 24, 2022, 12:44 p.m. UTC | #19
在 2022/3/24 3:50, Ajit Khaparde 写道:
> On Wed, Mar 23, 2022 at 12:04 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>> 23/03/2022 12:04, lihuisong (C):
>>> 在 2022/3/23 17:14, Thomas Monjalon 写道:
>>>> 23/03/2022 04:05, lihuisong (C):
>>>>> 在 2022/3/23 1:13, Thomas Monjalon 写道:
>>>>>> 21/03/2022 08:14, lihuisong (C):
>>>>>>> 2022/3/10 16:08, lihuisong (C):
>>>>>>>> 2022/3/9 17:55, Ori Kam:
>>>>>>>>> From: lihuisong (C) <lihuisong@huawei.com>
>>>>>>>>>> 2022/3/3 10:47, lihuisong (C):
>>>>>>>>>>> 2022/3/2 22:07, Ori Kam:
>>>>>>>>>>>> From: lihuisong (C) <lihuisong@huawei.com>
>>>>>>>>>>>>> 2022/3/1 0:42, Ferruh Yigit:
>>>>>>>>>>>>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
>>>>>>>>>>>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be
>>>>>>>>>>>>>>> set in
>>>>>>>>>>>>>>> dev_configure phase. However, if this flag isn't set, RSS can be
>>>>>>>>>>>>>>> enabled
>>>>>>>>>>>>>>> through the ethdev ops and rte_flow API. This behavior is
>>>>>>>>>>>>>>> contrary to
>>>>>>>>>>>>>>> each
>>>>>>>>>>>>>>> other.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
>>>>>>>>>>>>>>> Cc: stable@dpdk.org
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>>>>>>>>>>>> Hi Huisong, Connor,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Let's get a little more feedback for this patch, cc'ed more people.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> To enable RSS, multi queue mode should be set to
>>>>>>>>>>>>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> But I wonder if it is required to configure RSS via flow API,
>>>>>>>>>>>>> I do not know the original purpose of adding the RSS
>>>>>>>>>>>>> configuration in
>>>>>>>>>>>>> flow API.
>>>>>>>>>>>>>
>>>>>>>>>>>> The purpose is simple, this allow to create RSS per rule and not a
>>>>>>>>>>>> global one.
>>>>>>>>>>>> For example create RSS that sends TCP to some queues while othe RSS
>>>>>>>>>>>> will send
>>>>>>>>>>>> UDP traffic to different queues.
>>>>>>>>>>> I'm a little confused now. The "per rule" also seems to be a global
>>>>>>>>>>> configuration.
>>>>>>>>>>> Example:
>>>>>>>>>>>      - start PMD with 0,1,2,3
>>>>>>>>>>>      - create TCP packets to 2,3 queues. At this moment, only 2,3 queues
>>>>>>>>>>> can be received for other types of packets.
>>>>>>>>>>> Because this rule is implemented by modifying the entry of the
>>>>>>>>>>> redirection table which is global for this device.
>>>>>>>>>> Hi, Ori and Stephen.
>>>>>>>>>> Can you help me clear up the confusion above? If some NICs behave like
>>>>>>>>>> this, what should we do about it?
>>>>>>>>> I'm not sure I understand the issue, maybe it is releated to some
>>>>>>>>> HW/PMD limitation.
>>>>>>>>> In your example non TCP traffic will be routed to one of the 4 queues
>>>>>>>>> (0,1,2,3),
>>>>>>>>> While TCP traffic will only be routed to queues 2,3.
>>>>>>>>>
>>>>>>>>> Now I can add new rule that matches on UDP packet and RSS to queue 0
>>>>>>>>> and 3 in this case:
>>>>>>>>> TCP packets will be routed to queues 0,3.
>>>>>>>>> UDP packets will be routed to queues 2,3.
>>>>>>>>> All the rest of the traffic will be routed to queues 0,1,2,3
>>>>>>>>>
>>>>>>>>> And just to be clear if now I add a rule to match all packets in
>>>>>>>>> higher priority,
>>>>>>>>> with RSS to queues 1,2. Then all traffic will be routed to queues 1,2.
>>>>>>>>>
>>>>>>>>> At least this is what is expected, from API point of view.
>>>>>>>>>
>>>>>>>>> Best,
>>>>>>>>> Ori
>>>>>>>> Thank you for your answer. I understand it.
>>>>>>>> hns3 PMD cannot implement the above functions due to hardware limitation.
>>>>>>>> we may need add a check that specified RSS queues cannot be supported
>>>>>>>> when specified packets types.
>>>>>>>> And only the packet type is specified, which meets the requirements of
>>>>>>>> rte_flow API.
>>>>>>>> The check for the RTE_ETH_MQ_RX_RSS_FLAG flag in rte_flow is not correct.
>>>>>>>> Thanks, Ori and Stephen😁
>>>>>>>>
>>>>>>>> But, I think, it is necessary for the '.rss_hash_update' and
>>>>>>>> '.reta_update' APIs
>>>>>>>> in eth_dev_ops to verify this flag. What do you think? @Thomas,
>>>>>>>> @Ferruh, @Ori and @Stephen.
>>>>>>> What's your take on it? I am looking forward to your reply. Thanks!
>>>>>> I am not sure why you want to check this flag.
>>>>> I want to make sure that the behavior that PMD configured RSS is
>>>>> consistent across different interfaces. The RTE_ETH_MQ_RX_RSS_FLAG
>>>>> flag is a switch to enable RSS hash. If the switch isn't open, some
>>>>> PMD do not configure RSS function. I think the consistency is necessary.
>>>>> If not set RSS muti-queue mode, it is unnecessary to configure RSS.
>>>>>
>>>>>> I can imagine we configure the hash and the table before enabling RSS
>>>>>> with the RTE_ETH_MQ_RX_RSS_FLAG flag.
>>>>> The flag is derived from dev_configure() which also configures
>>>>> hash and key. I don't think it makes sense to configure hash and
>>>>> reta before calling dev_configure. Because they'll be updated.
>>>>> This is similar to configuring mtu.
>>>> OK I see your point.
>>>> So you would like to return an error in RSS functions
>>>> if the flag RTE_ETH_MQ_RX_RSS_FLAG is not set?
>>> Yes
>>>> Should it be checked in ethdev library or PMDs?
>>> I think it's better to put it in the ethdev layer if we do it.
>>> Should we add this check in 'rss_hash_update' and 'reta_update' APIs?
>> I'm OK with adding the check in ethdev.
> +1
>
> Apologies for getting late to this thread.
Thanks. I'll fix it.
  
Ferruh Yigit May 12, 2022, 2:13 p.m. UTC | #20
On 3/9/2022 9:55 AM, Ori Kam wrote:
> Hi Lihusiong,
> 
>> -----Original Message-----
>> From: lihuisong (C) <lihuisong@huawei.com>
>> Sent: Wednesday, March 9, 2022 10:03 AM
>> Subject: Re: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS behavior
>>
>>
>> 在 2022/3/3 10:47, lihuisong (C) 写道:
>>> Hi, Ori,
>>>
>>> 在 2022/3/2 22:07, Ori Kam 写道:
>>>> Hi Lihuisong,
>>>>
>>>>> -----Original Message-----
>>>>> From: lihuisong (C) <lihuisong@huawei.com>
>>>>> Sent: Wednesday, March 2, 2022 4:10 AM
>>>>> Subject: Re: [PATCH 2/6] net/hns3: fix inconsistent enabled RSS
>>>>> behavior
>>>>>
>>>>>
>>>>> 在 2022/3/1 0:42, Ferruh Yigit 写道:
>>>>>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
>>>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>>>
>>>>>>> RSS will not be enabled if the RTE_ETH_MQ_RX_RSS_FLAG isn't be set in
>>>>>>> dev_configure phase. However, if this flag isn't set, RSS can be
>>>>>>> enabled
>>>>>>> through the ethdev ops and rte_flow API. This behavior is contrary to
>>>>>>> each
>>>>>>> other.
>>>>>>>
>>>>>>> Fixes: c37ca66f2b27 ("net/hns3: support RSS")
>>>>>>> Cc: stable@dpdk.org
>>>>>>>
>>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>>>>
>>>>>> Hi Huisong, Connor,
>>>>>>
>>>>>> Let's get a little more feedback for this patch, cc'ed more people.
>>>>>>
>>>>>>
>>>>>> To enable RSS, multi queue mode should be set to
>>>>>> 'RTE_ETH_MQ_RX_RSS_FLAG'.
>>>>>>
>>>>>> But I wonder if it is required to configure RSS via flow API,
>>>>> I do not know the original purpose of adding the RSS configuration in
>>>>> flow API.
>>>>>
>>>> The purpose is simple, this allow to create RSS per rule and not a
>>>> global one.
>>>> For example create RSS that sends TCP to some queues while othe RSS
>>>> will send
>>>> UDP traffic to different queues.
>>> I'm a little confused now. The "per rule" also seems to be a global
>>> configuration.
>>> Example:
>>>   - start PMD with 0,1,2,3
>>>   - create TCP packets to 2,3 queues. At this moment, only 2,3 queues
>>> can be received for other types of packets.
>>> Because this rule is implemented by modifying the entry of the
>>> redirection table which is global for this device.
>> Hi, Ori and Stephen.
>> Can you help me clear up the confusion above? If some NICs behave like
>> this, what should we do about it?
> 
> I'm not sure I understand the issue, maybe it is releated to some HW/PMD limitation.
> In your example non TCP traffic will be routed to one of the 4 queues (0,1,2,3),
> While TCP traffic will only be routed to queues 2,3.
> 
> Now I can add new rule that matches on UDP packet and RSS to queue 0 and 3 in this case:
> TCP packets will be routed to queues 0,3.
> UDP packets will be routed to queues 2,3.
> All the rest of the traffic will be routed to queues 0,1,2,3
> 

Hi Ori,

How RETA is managed for per flow RSS configuration? And is there a limit 
on how many per flow RSS rule can be created?

> And just to be clear if now I add a rule to match all packets in higher priority,
> with RSS to queues 1,2. Then all traffic will be routed to queues 1,2.
> 
> At least this is what is expected, from API point of view.
> 
> Best,
> Ori
> 
>>>>
>>>>> However, as far as I know, the hash algorithm can be configured via
>>>>> this
>>>>> API,
>>>>>
>>>>> but not via ethdev ops API.
>>>>>
>>>>>> and if other PMDs check this configuration for flow API?
>>>>> Some PMDs already have similar check in RSS releated ops or rte_flow
>>>>> API.
>>>>>
>>>>> For example, hinic, axbge, bnxt, cnxk, otx2, and ena.
>>>>>
>>>>>> .
>>>>   From my view point those are two different settings.
>>>> The RTE_ETH_MQ_RX_RSS_FLAG is global per port while
>>>> rte_flow is per rule.
>>>>
>>>> I think, that if a PMD needs this flag, in order to enable it also
>>>> for rte_flow then
>>>> it should be documented in the release note of the PMD.
>>>> It is a valid use case that the default traffic will not have RSS and
>>>> only rules created by
>>>> rte_flow will have the RSS, for matching traffc.
>>>>
>>>> Best,
>>>> Ori
  

Patch

diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index aba07aaa6f..46371c4190 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1371,6 +1371,7 @@  hns3_parse_rss_filter(struct rte_eth_dev *dev,
 		      const struct rte_flow_action *actions,
 		      struct rte_flow_error *error)
 {
+	enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode;
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_hw *hw = &hns->hw;
 	struct hns3_rss_conf *rss_conf = &hw->rss_info;
@@ -1426,6 +1427,10 @@  hns3_parse_rss_filter(struct rte_eth_dev *dev,
 					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
 					  &rss->types,
 					  "input RSS types are not supported");
+	if (!((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
+					  act, "multi-queue RSS isn't enabled");
 
 	act_index++;
 
diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c
index 1782d63883..e0eab05fb9 100644
--- a/drivers/net/hns3/hns3_rss.c
+++ b/drivers/net/hns3/hns3_rss.c
@@ -399,6 +399,7 @@  int
 hns3_dev_rss_hash_update(struct rte_eth_dev *dev,
 			 struct rte_eth_rss_conf *rss_conf)
 {
+	enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode;
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_hw *hw = &hns->hw;
 	struct hns3_rss_tuple_cfg *tuple = &hw->rss_info.rss_tuple_sets;
@@ -408,6 +409,11 @@  hns3_dev_rss_hash_update(struct rte_eth_dev *dev,
 	uint8_t *key = rss_conf->rss_key;
 	int ret;
 
+	if (!((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) {
+		hns3_err(hw, "multi-queue RSS isn't enabled.");
+		return -EOPNOTSUPP;
+	}
+
 	if (hw->rss_dis_flag)
 		return -EINVAL;
 
@@ -498,6 +504,7 @@  hns3_dev_rss_reta_update(struct rte_eth_dev *dev,
 			 struct rte_eth_rss_reta_entry64 *reta_conf,
 			 uint16_t reta_size)
 {
+	enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode;
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_hw *hw = &hns->hw;
 	struct hns3_rss_conf *rss_cfg = &hw->rss_info;
@@ -506,6 +513,11 @@  hns3_dev_rss_reta_update(struct rte_eth_dev *dev,
 	uint16_t i;
 	int ret;
 
+	if (!((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) {
+		hns3_err(hw, "multi-queue RSS isn't enabled.");
+		return -EOPNOTSUPP;
+	}
+
 	if (reta_size != hw->rss_ind_tbl_size) {
 		hns3_err(hw, "The size of hash lookup table configured (%u)"
 			 "doesn't match the number hardware can supported"