mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 19:23:57 +08:00
mlxsw: spectrum_acl: Push rehash start/end code into separate functions
In preparations for interrupt/continue of rehash work, put the code at the beginning/end of the rehash 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>
This commit is contained in:
parent
559c276810
commit
1667f7667d
@ -1334,26 +1334,50 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mlxsw_sp_acl_tcam_vregion_rehash(struct mlxsw_sp *mlxsw_sp,
|
mlxsw_sp_acl_tcam_vregion_rehash_start(struct mlxsw_sp *mlxsw_sp,
|
||||||
struct mlxsw_sp_acl_tcam_vregion *vregion)
|
struct mlxsw_sp_acl_tcam_vregion *vregion,
|
||||||
|
struct mlxsw_sp_acl_tcam_rehash_ctx *ctx)
|
||||||
{
|
{
|
||||||
const struct mlxsw_sp_acl_tcam_ops *ops = mlxsw_sp->acl_tcam_ops;
|
const struct mlxsw_sp_acl_tcam_ops *ops = mlxsw_sp->acl_tcam_ops;
|
||||||
struct mlxsw_sp_acl_tcam_rehash_ctx *ctx = &vregion->rehash.ctx;
|
|
||||||
void *hints_priv;
|
void *hints_priv;
|
||||||
int err;
|
|
||||||
|
|
||||||
trace_mlxsw_sp_acl_tcam_vregion_rehash(mlxsw_sp, vregion);
|
trace_mlxsw_sp_acl_tcam_vregion_rehash(mlxsw_sp, vregion);
|
||||||
if (vregion->failed_rollback)
|
if (vregion->failed_rollback)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
hints_priv = ops->region_rehash_hints_get(vregion->region->priv);
|
hints_priv = ops->region_rehash_hints_get(vregion->region->priv);
|
||||||
if (IS_ERR(hints_priv)) {
|
if (IS_ERR(hints_priv))
|
||||||
err = PTR_ERR(hints_priv);
|
return PTR_ERR(hints_priv);
|
||||||
|
|
||||||
|
ctx->hints_priv = hints_priv;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mlxsw_sp_acl_tcam_vregion_rehash_end(struct mlxsw_sp *mlxsw_sp,
|
||||||
|
struct mlxsw_sp_acl_tcam_vregion *vregion,
|
||||||
|
struct mlxsw_sp_acl_tcam_rehash_ctx *ctx)
|
||||||
|
{
|
||||||
|
const struct mlxsw_sp_acl_tcam_ops *ops = mlxsw_sp->acl_tcam_ops;
|
||||||
|
|
||||||
|
ops->region_rehash_hints_put(ctx->hints_priv);
|
||||||
|
ctx->hints_priv = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
mlxsw_sp_acl_tcam_vregion_rehash(struct mlxsw_sp *mlxsw_sp,
|
||||||
|
struct mlxsw_sp_acl_tcam_vregion *vregion)
|
||||||
|
{
|
||||||
|
struct mlxsw_sp_acl_tcam_rehash_ctx *ctx = &vregion->rehash.ctx;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = mlxsw_sp_acl_tcam_vregion_rehash_start(mlxsw_sp, vregion, ctx);
|
||||||
|
if (err) {
|
||||||
if (err != -EAGAIN)
|
if (err != -EAGAIN)
|
||||||
dev_err(mlxsw_sp->bus_info->dev, "Failed get rehash hints\n");
|
dev_err(mlxsw_sp->bus_info->dev, "Failed get rehash hints\n");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
ctx->hints_priv = hints_priv;
|
|
||||||
|
|
||||||
err = mlxsw_sp_acl_tcam_vregion_migrate(mlxsw_sp, vregion, ctx);
|
err = mlxsw_sp_acl_tcam_vregion_migrate(mlxsw_sp, vregion, ctx);
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -1365,8 +1389,7 @@ mlxsw_sp_acl_tcam_vregion_rehash(struct mlxsw_sp *mlxsw_sp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ops->region_rehash_hints_put(ctx->hints_priv);
|
mlxsw_sp_acl_tcam_vregion_rehash_end(mlxsw_sp, vregion, ctx);
|
||||||
ctx->hints_priv = NULL;
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user