Skip to content

Commit 844f01d

Browse files
jpirkodavem330
authored andcommitted
mlxsw: spectrum_acl: Put vchunk migrate start/end code into separate functions
In preparations of interrupt/continue of rehash work, put the code that is done at the beginning/end of vchunk migrate function into separate functions. 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>
1 parent 220f4fb commit 844f01d

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,15 +1193,12 @@ mlxsw_sp_acl_tcam_ventry_migrate(struct mlxsw_sp *mlxsw_sp,
11931193
}
11941194

11951195
static int
1196-
mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
1197-
struct mlxsw_sp_acl_tcam_vchunk *vchunk,
1198-
struct mlxsw_sp_acl_tcam_region *region,
1199-
struct mlxsw_sp_acl_tcam_rehash_ctx *ctx)
1196+
mlxsw_sp_acl_tcam_vchunk_migrate_start(struct mlxsw_sp *mlxsw_sp,
1197+
struct mlxsw_sp_acl_tcam_vchunk *vchunk,
1198+
struct mlxsw_sp_acl_tcam_region *region,
1199+
struct mlxsw_sp_acl_tcam_rehash_ctx *ctx)
12001200
{
12011201
struct mlxsw_sp_acl_tcam_chunk *new_chunk;
1202-
struct mlxsw_sp_acl_tcam_ventry *ventry;
1203-
int err;
1204-
int err2;
12051202

12061203
new_chunk = mlxsw_sp_acl_tcam_chunk_create(mlxsw_sp, vchunk, region);
12071204
if (IS_ERR(new_chunk)) {
@@ -1211,6 +1208,31 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
12111208
}
12121209
vchunk->chunk2 = vchunk->chunk;
12131210
vchunk->chunk = new_chunk;
1211+
return 0;
1212+
}
1213+
1214+
static void
1215+
mlxsw_sp_acl_tcam_vchunk_migrate_end(struct mlxsw_sp *mlxsw_sp,
1216+
struct mlxsw_sp_acl_tcam_vchunk *vchunk)
1217+
{
1218+
mlxsw_sp_acl_tcam_chunk_destroy(mlxsw_sp, vchunk->chunk2);
1219+
vchunk->chunk2 = NULL;
1220+
}
1221+
1222+
static int
1223+
mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
1224+
struct mlxsw_sp_acl_tcam_vchunk *vchunk,
1225+
struct mlxsw_sp_acl_tcam_region *region,
1226+
struct mlxsw_sp_acl_tcam_rehash_ctx *ctx)
1227+
{
1228+
struct mlxsw_sp_acl_tcam_ventry *ventry;
1229+
int err;
1230+
int err2;
1231+
1232+
err = mlxsw_sp_acl_tcam_vchunk_migrate_start(mlxsw_sp, vchunk,
1233+
region, ctx);
1234+
if (err)
1235+
return err;
12141236

12151237
list_for_each_entry(ventry, &vchunk->ventry_list, list) {
12161238
err = mlxsw_sp_acl_tcam_ventry_migrate(mlxsw_sp, ventry,
@@ -1223,8 +1245,8 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
12231245
goto rollback;
12241246
}
12251247
}
1226-
mlxsw_sp_acl_tcam_chunk_destroy(mlxsw_sp, vchunk->chunk2);
1227-
vchunk->chunk2 = NULL;
1248+
1249+
mlxsw_sp_acl_tcam_vchunk_migrate_end(mlxsw_sp, vchunk);
12281250
return 0;
12291251

12301252
rollback:
@@ -1243,8 +1265,7 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
12431265
}
12441266
}
12451267

1246-
mlxsw_sp_acl_tcam_chunk_destroy(mlxsw_sp, vchunk->chunk2);
1247-
vchunk->chunk2 = NULL;
1268+
mlxsw_sp_acl_tcam_vchunk_migrate_end(mlxsw_sp, vchunk);
12481269

12491270
err_rollback:
12501271
return err;

0 commit comments

Comments
 (0)