diff mbox series

[iwl-net] i40e: fix i40e_count_filters() to count only active/new filters

Message ID 20240312081343.24311-1-aleksandr.loktionov@intel.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [iwl-net] i40e: fix i40e_count_filters() to count only active/new filters | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 956 this patch: 956
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 4 maintainers not CCed: pabeni@redhat.com jesse.brandeburg@intel.com edumazet@google.com kuba@kernel.org
netdev/build_clang success Errors and warnings before: 972 this patch: 972
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 972 this patch: 972
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 13 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-03-12--09-00 (tests: 887)

Commit Message

Aleksandr Loktionov March 12, 2024, 8:13 a.m. UTC
Fix counter to be bumped only for new or active filters.

Fixes: 621650cabee5 ("i40e: Refactoring VF MAC filters counting to make more reliable")
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Przemek Kitszel March 12, 2024, 9:05 a.m. UTC | #1
On 3/12/24 09:13, Aleksandr Loktionov wrote:
> Fix counter to be bumped only for new or active filters.
> 
> Fixes: 621650cabee5 ("i40e: Refactoring VF MAC filters counting to make more reliable")
> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
> ---
>   drivers/net/ethernet/intel/i40e/i40e_main.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 89a3401..6010a49 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -1257,8 +1257,11 @@ int i40e_count_filters(struct i40e_vsi *vsi)
>   	int bkt;
>   	int cnt = 0;
>   
> -	hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist)
> -		++cnt;
> +	hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
> +		if (f->state == I40E_FILTER_NEW ||
> +		    f->state == I40E_FILTER_ACTIVE)
> +			++cnt;
> +	}
>   
>   	return cnt;
>   }

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Paul Menzel March 12, 2024, 9:35 a.m. UTC | #2
Dear Aleksandr,


Thank you for your patch.

Am 12.03.24 um 09:13 schrieb Aleksandr Loktionov:
> Fix counter to be bumped only for new or active filters.

Although it’s a small diffstat, could you please elaborate, and at least 
describe the problem in more detail.

How can this be tested?

> Fixes: 621650cabee5 ("i40e: Refactoring VF MAC filters counting to make more reliable")
> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
> ---
>   drivers/net/ethernet/intel/i40e/i40e_main.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 89a3401..6010a49 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -1257,8 +1257,11 @@ int i40e_count_filters(struct i40e_vsi *vsi)
>   	int bkt;
>   	int cnt = 0;
>   
> -	hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist)
> -		++cnt;
> +	hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
> +		if (f->state == I40E_FILTER_NEW ||
> +		    f->state == I40E_FILTER_ACTIVE)
> +			++cnt;
> +	}
>   
>   	return cnt;
>   }


Kind regards,

Paul
Aleksandr Loktionov March 12, 2024, 10:44 a.m. UTC | #3
> -----Original Message-----
> From: Paul Menzel <pmenzel@molgen.mpg.de>
> Sent: Tuesday, March 12, 2024 10:36 AM
> To: Loktionov, Aleksandr <aleksandr.loktionov@intel.com>
> Cc: intel-wired-lan@lists.osuosl.org; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; netdev@vger.kernel.org; Kubalewski,
> Arkadiusz <arkadiusz.kubalewski@intel.com>
> Subject: Re: [Intel-wired-lan] [PATCH iwl-net] i40e: fix
> i40e_count_filters() to count only active/new filters
> 
> Dear Aleksandr,
> 
> 
> Thank you for your patch.
> 
> Am 12.03.24 um 09:13 schrieb Aleksandr Loktionov:
> > Fix counter to be bumped only for new or active filters.
> 
> Although it’s a small diffstat, could you please elaborate, and at
> least describe the problem in more detail.
> 
> How can this be tested?
> 
The bug usually affects untrusted VFs, because they are limited to 18MACs, it affects them badly, not letting to create MAC filters.
Not stable to reproduce, it happens when VF user creates MAC filters when other MACVLAN operations are happened in parallel.
But consequence is that VF can't receive desired traffic.

> > Fixes: 621650cabee5 ("i40e: Refactoring VF MAC filters counting
> to
> > make more reliable")
> > Signed-off-by: Aleksandr Loktionov
> <aleksandr.loktionov@intel.com>
> > Reviewed-by: Arkadiusz Kubalewski
> <arkadiusz.kubalewski@intel.com>
> > ---
> >   drivers/net/ethernet/intel/i40e/i40e_main.c | 7 +++++--
> >   1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c
> > b/drivers/net/ethernet/intel/i40e/i40e_main.c
> > index 89a3401..6010a49 100644
> > --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> > @@ -1257,8 +1257,11 @@ int i40e_count_filters(struct i40e_vsi
> *vsi)
> >   	int bkt;
> >   	int cnt = 0;
> >
> > -	hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist)
> > -		++cnt;
> > +	hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
> > +		if (f->state == I40E_FILTER_NEW ||
> > +		    f->state == I40E_FILTER_ACTIVE)
> > +			++cnt;
> > +	}
> >
> >   	return cnt;
> >   }
> 
> 
> Kind regards,
> 
> Paul
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 89a3401..6010a49 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -1257,8 +1257,11 @@  int i40e_count_filters(struct i40e_vsi *vsi)
 	int bkt;
 	int cnt = 0;
 
-	hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist)
-		++cnt;
+	hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
+		if (f->state == I40E_FILTER_NEW ||
+		    f->state == I40E_FILTER_ACTIVE)
+			++cnt;
+	}
 
 	return cnt;
 }