]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.10/i40e-fix-i40e_count_filters-to-count-only-active-new-filters.patch
5.10-stable patches
[thirdparty/kernel/stable-queue.git] / queue-5.10 / i40e-fix-i40e_count_filters-to-count-only-active-new-filters.patch
1 From eb58c598ce45b7e787568fe27016260417c3d807 Mon Sep 17 00:00:00 2001
2 From: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
3 Date: Wed, 13 Mar 2024 10:44:00 +0100
4 Subject: i40e: fix i40e_count_filters() to count only active/new filters
5
6 From: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
7
8 commit eb58c598ce45b7e787568fe27016260417c3d807 upstream.
9
10 The bug usually affects untrusted VFs, because they are limited to 18 MACs,
11 it affects them badly, not letting to create MAC all filters.
12 Not stable to reproduce, it happens when VF user creates MAC filters
13 when other MACVLAN operations are happened in parallel.
14 But consequence is that VF can't receive desired traffic.
15
16 Fix counter to be bumped only for new or active filters.
17
18 Fixes: 621650cabee5 ("i40e: Refactoring VF MAC filters counting to make more reliable")
19 Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
20 Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
21 Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
22 Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
23 Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 drivers/net/ethernet/intel/i40e/i40e_main.c | 7 +++++--
27 1 file changed, 5 insertions(+), 2 deletions(-)
28
29 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
30 +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
31 @@ -1230,8 +1230,11 @@ int i40e_count_filters(struct i40e_vsi *
32 int bkt;
33 int cnt = 0;
34
35 - hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist)
36 - ++cnt;
37 + hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
38 + if (f->state == I40E_FILTER_NEW ||
39 + f->state == I40E_FILTER_ACTIVE)
40 + ++cnt;
41 + }
42
43 return cnt;
44 }