Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mlxsw: spectrum_acl: Remove failed_rollback dead end

Currently if a rollback ends with error, the vregion is in a zombie
state until end of the existence. Instead of that, rather try to
continue where rollback ended later on (after rehash interval).

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>

authored by

Jiri Pirko and committed by
David S. Miller
7c33c72b f3d4ef1a

+10 -10
+10 -10
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
··· 216 216 struct mlxsw_sp_acl_tcam_rehash_ctx ctx; 217 217 } rehash; 218 218 struct mlxsw_sp *mlxsw_sp; 219 - bool failed_rollback; /* Indicates failed rollback during migration */ 220 219 unsigned int ref_count; 221 220 }; 222 221 ··· 1314 1315 err = mlxsw_sp_acl_tcam_ventry_migrate(mlxsw_sp, ventry, 1315 1316 vchunk->chunk, credits); 1316 1317 if (err) { 1317 - if (ctx->this_is_rollback) 1318 + if (ctx->this_is_rollback) { 1319 + /* Save the ventry which we ended with and try 1320 + * to continue later on. 1321 + */ 1322 + ctx->start_ventry = ventry; 1318 1323 return err; 1324 + } 1319 1325 /* Swap the chunk and chunk2 pointers so the follow-up 1320 1326 * rollback call will see the original chunk pointer 1321 1327 * in vchunk->chunk. ··· 1399 1395 err2 = mlxsw_sp_acl_tcam_vchunk_migrate_all(mlxsw_sp, vregion, 1400 1396 ctx, credits); 1401 1397 if (err2) { 1402 - vregion->failed_rollback = true; 1403 1398 trace_mlxsw_sp_acl_tcam_vregion_rehash_dis(mlxsw_sp, 1404 1399 vregion); 1405 1400 dev_err(mlxsw_sp->bus_info->dev, "Failed to rollback during vregion migration fail\n"); 1401 + /* Let the rollback to be continued later on. */ 1406 1402 } 1407 1403 } 1408 1404 mutex_unlock(&vregion->lock); ··· 1428 1424 int err; 1429 1425 1430 1426 trace_mlxsw_sp_acl_tcam_vregion_rehash(mlxsw_sp, vregion); 1431 - if (vregion->failed_rollback) 1432 - return -EBUSY; 1433 1427 1434 1428 hints_priv = ops->region_rehash_hints_get(vregion->region->priv); 1435 1429 if (IS_ERR(hints_priv)) ··· 1474 1472 struct mlxsw_sp_acl_tcam_region *unused_region = vregion->region2; 1475 1473 const struct mlxsw_sp_acl_tcam_ops *ops = mlxsw_sp->acl_tcam_ops; 1476 1474 1477 - if (!vregion->failed_rollback) { 1478 - vregion->region2 = NULL; 1479 - mlxsw_sp_acl_tcam_group_region_detach(mlxsw_sp, unused_region); 1480 - mlxsw_sp_acl_tcam_region_destroy(mlxsw_sp, unused_region); 1481 - } 1475 + vregion->region2 = NULL; 1476 + mlxsw_sp_acl_tcam_group_region_detach(mlxsw_sp, unused_region); 1477 + mlxsw_sp_acl_tcam_region_destroy(mlxsw_sp, unused_region); 1482 1478 ops->region_rehash_hints_put(ctx->hints_priv); 1483 1479 ctx->hints_priv = NULL; 1484 1480 }