[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190228065850.7471-8-idosch@mellanox.com>
Date: Thu, 28 Feb 2019 06:59:21 +0000
From: Ido Schimmel <idosch@...lanox.com>
To: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "davem@...emloft.net" <davem@...emloft.net>,
Jiri Pirko <jiri@...lanox.com>, mlxsw <mlxsw@...lanox.com>,
Ido Schimmel <idosch@...lanox.com>
Subject: [PATCH net-next 07/14] mlxsw: spectrum_acl: assign vchunk->chunk by
the newly created chunk
From: Jiri Pirko <jiri@...lanox.com>
Make the vchunk->chunk contain pointer of a new chunk we migrate to.
In case of a rollback, it contains the original chunk.
Signed-off-by: Jiri Pirko <jiri@...lanox.com>
Signed-off-by: Ido Schimmel <idosch@...lanox.com>
---
.../mellanox/mlxsw/spectrum_acl_tcam.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
index 72734ee60a1e..6a50266b6809 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
@@ -1197,21 +1197,23 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_tcam_region *region,
bool this_is_rollback)
{
+ struct mlxsw_sp_acl_tcam_chunk *new_chunk;
struct mlxsw_sp_acl_tcam_ventry *ventry;
- struct mlxsw_sp_acl_tcam_chunk *chunk2;
int err;
int err2;
- chunk2 = mlxsw_sp_acl_tcam_chunk_create(mlxsw_sp, vchunk, region);
- if (IS_ERR(chunk2)) {
+ new_chunk = mlxsw_sp_acl_tcam_chunk_create(mlxsw_sp, vchunk, region);
+ if (IS_ERR(new_chunk)) {
if (this_is_rollback)
vchunk->vregion->failed_rollback = true;
- return PTR_ERR(chunk2);
+ return PTR_ERR(new_chunk);
}
- vchunk->chunk2 = chunk2;
+ vchunk->chunk2 = vchunk->chunk;
+ vchunk->chunk = new_chunk;
+
list_for_each_entry(ventry, &vchunk->ventry_list, list) {
err = mlxsw_sp_acl_tcam_ventry_migrate(mlxsw_sp, ventry,
- vchunk->chunk2);
+ vchunk->chunk);
if (err) {
if (this_is_rollback) {
vchunk->vregion->failed_rollback = true;
@@ -1220,8 +1222,7 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
goto rollback;
}
}
- mlxsw_sp_acl_tcam_chunk_destroy(mlxsw_sp, vchunk->chunk);
- vchunk->chunk = chunk2;
+ mlxsw_sp_acl_tcam_chunk_destroy(mlxsw_sp, vchunk->chunk2);
vchunk->chunk2 = NULL;
return 0;
@@ -1230,6 +1231,7 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
* migration fails, there's no good way how to proceed. Set the
* vregion with "failed_rollback" flag.
*/
+ swap(vchunk->chunk, vchunk->chunk2);
list_for_each_entry_continue_reverse(ventry, &vchunk->ventry_list,
list) {
err2 = mlxsw_sp_acl_tcam_ventry_migrate(mlxsw_sp, ventry,
--
2.20.1
Powered by blists - more mailing lists