Commit bb0a1b44 authored by Nir Dotan's avatar Nir Dotan Committed by Greg Kroah-Hartman

mlxsw: spectrum_acl: Add cleanup after C-TCAM update error condition

[ Upstream commit ff0db43c ]

When writing to C-TCAM, mlxsw driver uses cregion->ops->entry_insert().
In case of C-TCAM HW insertion error, the opposite action should take
place.
Add error handling case in which the C-TCAM region entry is removed, by
calling cregion->ops->entry_remove().

Fixes: a0a777b9 ("mlxsw: spectrum_acl: Start using A-TCAM")
Signed-off-by: 's avatarNir Dotan <nird@mellanox.com>
Reviewed-by: 's avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: 's avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
parent cd7db7c9
......@@ -75,7 +75,15 @@ mlxsw_sp_acl_ctcam_region_entry_insert(struct mlxsw_sp *mlxsw_sp,
act_set = mlxsw_afa_block_first_set(rulei->act_block);
mlxsw_reg_ptce2_flex_action_set_memcpy_to(ptce2_pl, act_set);
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptce2), ptce2_pl);
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptce2), ptce2_pl);
if (err)
goto err_ptce2_write;
return 0;
err_ptce2_write:
cregion->ops->entry_remove(cregion, centry);
return err;
}
static void
......
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