mlxsw: spectrum_acl: Propagate errors from mlxsw_afa_block_jump/continue
Propagate error instead of doing WARN_ON right away. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5b52e57c3d
commit
2a52a8c6e5
@ -399,23 +399,25 @@ u32 mlxsw_afa_block_first_set_kvdl_index(struct mlxsw_afa_block *block)
|
||||
}
|
||||
EXPORT_SYMBOL(mlxsw_afa_block_first_set_kvdl_index);
|
||||
|
||||
void mlxsw_afa_block_continue(struct mlxsw_afa_block *block)
|
||||
int mlxsw_afa_block_continue(struct mlxsw_afa_block *block)
|
||||
{
|
||||
if (WARN_ON(block->finished))
|
||||
return;
|
||||
if (block->finished)
|
||||
return -EINVAL;
|
||||
mlxsw_afa_set_goto_set(block->cur_set,
|
||||
MLXSW_AFA_SET_GOTO_BINDING_CMD_NONE, 0);
|
||||
block->finished = true;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(mlxsw_afa_block_continue);
|
||||
|
||||
void mlxsw_afa_block_jump(struct mlxsw_afa_block *block, u16 group_id)
|
||||
int mlxsw_afa_block_jump(struct mlxsw_afa_block *block, u16 group_id)
|
||||
{
|
||||
if (WARN_ON(block->finished))
|
||||
return;
|
||||
if (block->finished)
|
||||
return -EINVAL;
|
||||
mlxsw_afa_set_goto_set(block->cur_set,
|
||||
MLXSW_AFA_SET_GOTO_BINDING_CMD_JUMP, group_id);
|
||||
block->finished = true;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(mlxsw_afa_block_jump);
|
||||
|
||||
|
@ -57,8 +57,8 @@ void mlxsw_afa_block_destroy(struct mlxsw_afa_block *block);
|
||||
int mlxsw_afa_block_commit(struct mlxsw_afa_block *block);
|
||||
char *mlxsw_afa_block_first_set(struct mlxsw_afa_block *block);
|
||||
u32 mlxsw_afa_block_first_set_kvdl_index(struct mlxsw_afa_block *block);
|
||||
void mlxsw_afa_block_continue(struct mlxsw_afa_block *block);
|
||||
void mlxsw_afa_block_jump(struct mlxsw_afa_block *block, u16 group_id);
|
||||
int mlxsw_afa_block_continue(struct mlxsw_afa_block *block);
|
||||
int mlxsw_afa_block_jump(struct mlxsw_afa_block *block, u16 group_id);
|
||||
int mlxsw_afa_block_append_drop(struct mlxsw_afa_block *block);
|
||||
int mlxsw_afa_block_append_trap(struct mlxsw_afa_block *block, u16 trap_id);
|
||||
int mlxsw_afa_block_append_fwd(struct mlxsw_afa_block *block,
|
||||
|
@ -468,9 +468,9 @@ void mlxsw_sp_acl_rulei_keymask_buf(struct mlxsw_sp_acl_rule_info *rulei,
|
||||
enum mlxsw_afk_element element,
|
||||
const char *key_value,
|
||||
const char *mask_value, unsigned int len);
|
||||
void mlxsw_sp_acl_rulei_act_continue(struct mlxsw_sp_acl_rule_info *rulei);
|
||||
void mlxsw_sp_acl_rulei_act_jump(struct mlxsw_sp_acl_rule_info *rulei,
|
||||
u16 group_id);
|
||||
int mlxsw_sp_acl_rulei_act_continue(struct mlxsw_sp_acl_rule_info *rulei);
|
||||
int mlxsw_sp_acl_rulei_act_jump(struct mlxsw_sp_acl_rule_info *rulei,
|
||||
u16 group_id);
|
||||
int mlxsw_sp_acl_rulei_act_drop(struct mlxsw_sp_acl_rule_info *rulei);
|
||||
int mlxsw_sp_acl_rulei_act_trap(struct mlxsw_sp_acl_rule_info *rulei);
|
||||
int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp,
|
||||
|
@ -378,15 +378,15 @@ void mlxsw_sp_acl_rulei_keymask_buf(struct mlxsw_sp_acl_rule_info *rulei,
|
||||
key_value, mask_value, len);
|
||||
}
|
||||
|
||||
void mlxsw_sp_acl_rulei_act_continue(struct mlxsw_sp_acl_rule_info *rulei)
|
||||
int mlxsw_sp_acl_rulei_act_continue(struct mlxsw_sp_acl_rule_info *rulei)
|
||||
{
|
||||
mlxsw_afa_block_continue(rulei->act_block);
|
||||
return mlxsw_afa_block_continue(rulei->act_block);
|
||||
}
|
||||
|
||||
void mlxsw_sp_acl_rulei_act_jump(struct mlxsw_sp_acl_rule_info *rulei,
|
||||
u16 group_id)
|
||||
int mlxsw_sp_acl_rulei_act_jump(struct mlxsw_sp_acl_rule_info *rulei,
|
||||
u16 group_id)
|
||||
{
|
||||
mlxsw_afa_block_jump(rulei->act_block, group_id);
|
||||
return mlxsw_afa_block_jump(rulei->act_block, group_id);
|
||||
}
|
||||
|
||||
int mlxsw_sp_acl_rulei_act_drop(struct mlxsw_sp_acl_rule_info *rulei)
|
||||
|
@ -608,7 +608,10 @@ mlxsw_sp_acl_tcam_region_catchall_add(struct mlxsw_sp *mlxsw_sp,
|
||||
goto err_rulei_create;
|
||||
}
|
||||
|
||||
mlxsw_sp_acl_rulei_act_continue(rulei);
|
||||
err = mlxsw_sp_acl_rulei_act_continue(rulei);
|
||||
if (WARN_ON(err))
|
||||
goto err_rulei_act_continue;
|
||||
|
||||
err = mlxsw_sp_acl_rulei_commit(rulei);
|
||||
if (err)
|
||||
goto err_rulei_commit;
|
||||
@ -623,6 +626,7 @@ mlxsw_sp_acl_tcam_region_catchall_add(struct mlxsw_sp *mlxsw_sp,
|
||||
|
||||
err_rule_insert:
|
||||
err_rulei_commit:
|
||||
err_rulei_act_continue:
|
||||
mlxsw_sp_acl_rulei_destroy(rulei);
|
||||
err_rulei_create:
|
||||
parman_item_remove(region->parman, parman_prio, parman_item);
|
||||
|
@ -84,7 +84,9 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
|
||||
return PTR_ERR(ruleset);
|
||||
|
||||
group_id = mlxsw_sp_acl_ruleset_group_id(ruleset);
|
||||
mlxsw_sp_acl_rulei_act_jump(rulei, group_id);
|
||||
err = mlxsw_sp_acl_rulei_act_jump(rulei, group_id);
|
||||
if (err)
|
||||
return err;
|
||||
} else if (is_tcf_mirred_egress_redirect(a)) {
|
||||
int ifindex = tcf_mirred_ifindex(a);
|
||||
struct net_device *out_dev;
|
||||
|
Loading…
Reference in New Issue
Block a user