Skip to content

Commit 220f4fb

Browse files
jpirkodavem330
authored andcommitted
mlxsw: spectrum_acl: Put this_is_rollback to rehash context struct
Put the this_is_rollback flag into rehash context struct in preparations for interrupt/continue of rehash work. 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 2c33159 commit 220f4fb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ struct mlxsw_sp_acl_tcam_vgroup {
182182

183183
struct mlxsw_sp_acl_tcam_rehash_ctx {
184184
void *hints_priv;
185+
bool this_is_rollback;
185186
};
186187

187188
struct mlxsw_sp_acl_tcam_vregion {
@@ -1195,7 +1196,7 @@ static int
11951196
mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
11961197
struct mlxsw_sp_acl_tcam_vchunk *vchunk,
11971198
struct mlxsw_sp_acl_tcam_region *region,
1198-
bool this_is_rollback)
1199+
struct mlxsw_sp_acl_tcam_rehash_ctx *ctx)
11991200
{
12001201
struct mlxsw_sp_acl_tcam_chunk *new_chunk;
12011202
struct mlxsw_sp_acl_tcam_ventry *ventry;
@@ -1204,7 +1205,7 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
12041205

12051206
new_chunk = mlxsw_sp_acl_tcam_chunk_create(mlxsw_sp, vchunk, region);
12061207
if (IS_ERR(new_chunk)) {
1207-
if (this_is_rollback)
1208+
if (ctx->this_is_rollback)
12081209
vchunk->vregion->failed_rollback = true;
12091210
return PTR_ERR(new_chunk);
12101211
}
@@ -1215,7 +1216,7 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
12151216
err = mlxsw_sp_acl_tcam_ventry_migrate(mlxsw_sp, ventry,
12161217
vchunk->chunk);
12171218
if (err) {
1218-
if (this_is_rollback) {
1219+
if (ctx->this_is_rollback) {
12191220
vchunk->vregion->failed_rollback = true;
12201221
return err;
12211222
}
@@ -1251,15 +1252,16 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
12511252

12521253
static int
12531254
mlxsw_sp_acl_tcam_vchunk_migrate_all(struct mlxsw_sp *mlxsw_sp,
1254-
struct mlxsw_sp_acl_tcam_vregion *vregion)
1255+
struct mlxsw_sp_acl_tcam_vregion *vregion,
1256+
struct mlxsw_sp_acl_tcam_rehash_ctx *ctx)
12551257
{
12561258
struct mlxsw_sp_acl_tcam_vchunk *vchunk;
12571259
int err;
12581260

12591261
list_for_each_entry(vchunk, &vregion->vchunk_list, list) {
12601262
err = mlxsw_sp_acl_tcam_vchunk_migrate_one(mlxsw_sp, vchunk,
12611263
vregion->region,
1262-
false);
1264+
ctx);
12631265
if (err)
12641266
goto rollback;
12651267
}
@@ -1270,10 +1272,12 @@ mlxsw_sp_acl_tcam_vchunk_migrate_all(struct mlxsw_sp *mlxsw_sp,
12701272
* so the original region pointer is assigned again to vregion->region.
12711273
*/
12721274
swap(vregion->region, vregion->region2);
1275+
ctx->this_is_rollback = true;
12731276
list_for_each_entry_continue_reverse(vchunk, &vregion->vchunk_list,
12741277
list) {
12751278
mlxsw_sp_acl_tcam_vchunk_migrate_one(mlxsw_sp, vchunk,
1276-
vregion->region, true);
1279+
vregion->region,
1280+
ctx);
12771281
}
12781282
return err;
12791283
}
@@ -1287,7 +1291,7 @@ mlxsw_sp_acl_tcam_vregion_migrate(struct mlxsw_sp *mlxsw_sp,
12871291

12881292
trace_mlxsw_sp_acl_tcam_vregion_migrate(mlxsw_sp, vregion);
12891293
mutex_lock(&vregion->lock);
1290-
err = mlxsw_sp_acl_tcam_vchunk_migrate_all(mlxsw_sp, vregion);
1294+
err = mlxsw_sp_acl_tcam_vchunk_migrate_all(mlxsw_sp, vregion, ctx);
12911295
mutex_unlock(&vregion->lock);
12921296
trace_mlxsw_sp_acl_tcam_vregion_migrate_end(mlxsw_sp, vregion);
12931297
return err;
@@ -1332,6 +1336,7 @@ mlxsw_sp_acl_tcam_vregion_rehash_start(struct mlxsw_sp *mlxsw_sp,
13321336
goto err_group_region_attach;
13331337

13341338
ctx->hints_priv = hints_priv;
1339+
ctx->this_is_rollback = false;
13351340

13361341
return 0;
13371342

0 commit comments

Comments
 (0)