Commit d466423f authored by Jiri Pirko's avatar Jiri Pirko Committed by Greg Kroah-Hartman

mlxsw: spectrum_acl: Avoid warning after identical rules insertion

[ Upstream commit ef744220 ]

When identical rules are inserted, the latter one goes to C-TCAM. For
that, a second eRP with the same mask is created. These 2 eRPs by the
nature cannot be merged and also one cannot be parent of another.
Teach mlxsw_sp_acl_erp_delta_fill() about this possibility and handle it
gracefully.
Reported-by: default avatarAlex Kushnarov <alexanderk@mellanox.com>
Fixes: c22291f7 ("mlxsw: spectrum: acl: Implement delta for ERP")
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 27b6b156
...@@ -1171,13 +1171,12 @@ mlxsw_sp_acl_erp_delta_fill(const struct mlxsw_sp_acl_erp_key *parent_key, ...@@ -1171,13 +1171,12 @@ mlxsw_sp_acl_erp_delta_fill(const struct mlxsw_sp_acl_erp_key *parent_key,
return -EINVAL; return -EINVAL;
} }
if (si == -1) { if (si == -1) {
/* The masks are the same, this cannot happen. /* The masks are the same, this can happen in case eRPs with
* That means the caller is broken. * the same mask were created in both A-TCAM and C-TCAM.
* The only possible condition under which this can happen
* is identical rule insertion. Delta is not possible here.
*/ */
WARN_ON(1); return -EINVAL;
*delta_start = 0;
*delta_mask = 0;
return 0;
} }
pmask = (unsigned char) parent_key->mask[__MASK_IDX(si)]; pmask = (unsigned char) parent_key->mask[__MASK_IDX(si)];
mask = (unsigned char) key->mask[__MASK_IDX(si)]; mask = (unsigned char) key->mask[__MASK_IDX(si)];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment