]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.1/mlxsw-spectrum_acl-avoid-warning-after-identical-rules-insertion.patch
b622a42496f42c5181d2d4c30962d6cbec864c59
[thirdparty/kernel/stable-queue.git] / queue-5.1 / mlxsw-spectrum_acl-avoid-warning-after-identical-rules-insertion.patch
1 From foo@baz Fri 31 May 2019 03:16:39 PM PDT
2 From: Jiri Pirko <jiri@mellanox.com>
3 Date: Wed, 29 May 2019 10:59:44 +0300
4 Subject: mlxsw: spectrum_acl: Avoid warning after identical rules insertion
5
6 From: Jiri Pirko <jiri@mellanox.com>
7
8 [ Upstream commit ef74422020aa8c224b00a927e3e47faac4d8fae3 ]
9
10 When identical rules are inserted, the latter one goes to C-TCAM. For
11 that, a second eRP with the same mask is created. These 2 eRPs by the
12 nature cannot be merged and also one cannot be parent of another.
13 Teach mlxsw_sp_acl_erp_delta_fill() about this possibility and handle it
14 gracefully.
15
16 Reported-by: Alex Kushnarov <alexanderk@mellanox.com>
17 Fixes: c22291f7cf45 ("mlxsw: spectrum: acl: Implement delta for ERP")
18 Signed-off-by: Jiri Pirko <jiri@mellanox.com>
19 Signed-off-by: Ido Schimmel <idosch@mellanox.com>
20 Signed-off-by: David S. Miller <davem@davemloft.net>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 ---
23 drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c | 11 +++++------
24 1 file changed, 5 insertions(+), 6 deletions(-)
25
26 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c
27 +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c
28 @@ -1171,13 +1171,12 @@ mlxsw_sp_acl_erp_delta_fill(const struct
29 return -EINVAL;
30 }
31 if (si == -1) {
32 - /* The masks are the same, this cannot happen.
33 - * That means the caller is broken.
34 + /* The masks are the same, this can happen in case eRPs with
35 + * the same mask were created in both A-TCAM and C-TCAM.
36 + * The only possible condition under which this can happen
37 + * is identical rule insertion. Delta is not possible here.
38 */
39 - WARN_ON(1);
40 - *delta_start = 0;
41 - *delta_mask = 0;
42 - return 0;
43 + return -EINVAL;
44 }
45 pmask = (unsigned char) parent_key->mask[__MASK_IDX(si)];
46 mask = (unsigned char) key->mask[__MASK_IDX(si)];