diff options
| author | Jiri Pirko <jiri@mellanox.com> | 2019-05-29 03:59:44 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2019-05-30 15:30:47 -0400 |
| commit | ef74422020aa8c224b00a927e3e47faac4d8fae3 (patch) | |
| tree | a8701de675aa99c7bfa9c6561b491eba1c4516ea | |
| parent | 84b3fd1fc9592d431e23b077e692fa4e3fd0f086 (diff) | |
mlxsw: spectrum_acl: Avoid warning after identical rules insertion
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: Alex Kushnarov <alexanderk@mellanox.com>
Fixes: c22291f7cf45 ("mlxsw: spectrum: acl: Implement delta for ERP")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c index c1a9cc9a3292..4c98950380d5 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c | |||
| @@ -1171,13 +1171,12 @@ mlxsw_sp_acl_erp_delta_fill(const struct mlxsw_sp_acl_erp_key *parent_key, | |||
| 1171 | return -EINVAL; | 1171 | return -EINVAL; |
| 1172 | } | 1172 | } |
| 1173 | if (si == -1) { | 1173 | if (si == -1) { |
| 1174 | /* The masks are the same, this cannot happen. | 1174 | /* The masks are the same, this can happen in case eRPs with |
| 1175 | * That means the caller is broken. | 1175 | * the same mask were created in both A-TCAM and C-TCAM. |
| 1176 | * The only possible condition under which this can happen | ||
| 1177 | * is identical rule insertion. Delta is not possible here. | ||
| 1176 | */ | 1178 | */ |
| 1177 | WARN_ON(1); | 1179 | return -EINVAL; |
| 1178 | *delta_start = 0; | ||
| 1179 | *delta_mask = 0; | ||
| 1180 | return 0; | ||
| 1181 | } | 1180 | } |
| 1182 | pmask = (unsigned char) parent_key->mask[__MASK_IDX(si)]; | 1181 | pmask = (unsigned char) parent_key->mask[__MASK_IDX(si)]; |
| 1183 | mask = (unsigned char) key->mask[__MASK_IDX(si)]; | 1182 | mask = (unsigned char) key->mask[__MASK_IDX(si)]; |
