Commit 14a0d032 authored by David S. Miller's avatar David S. Miller

Merge branch 'mlxsw-pass-gact'

Jiri Pirko says:

====================
mlxsw: Introduce support for "pass" gact action offloading

Very simple patchset adds ability for user to insert filters with "pass"
gact action and offload it. That allows scenarios like this:

$ tc filter add dev enp3s0np19 ingress protocol ip pref 10 flower skip_sw dst_ip 192.168.101.0/24 action drop
$ tc filter add dev enp3s0np19 ingress protocol ip pref 9 flower skip_sw dst_ip 192.168.101.1 action pass
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 5b52e57c b2925957
...@@ -399,23 +399,25 @@ u32 mlxsw_afa_block_first_set_kvdl_index(struct mlxsw_afa_block *block) ...@@ -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); 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)) if (block->finished)
return; return -EINVAL;
mlxsw_afa_set_goto_set(block->cur_set, mlxsw_afa_set_goto_set(block->cur_set,
MLXSW_AFA_SET_GOTO_BINDING_CMD_NONE, 0); MLXSW_AFA_SET_GOTO_BINDING_CMD_NONE, 0);
block->finished = true; block->finished = true;
return 0;
} }
EXPORT_SYMBOL(mlxsw_afa_block_continue); 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)) if (block->finished)
return; return -EINVAL;
mlxsw_afa_set_goto_set(block->cur_set, mlxsw_afa_set_goto_set(block->cur_set,
MLXSW_AFA_SET_GOTO_BINDING_CMD_JUMP, group_id); MLXSW_AFA_SET_GOTO_BINDING_CMD_JUMP, group_id);
block->finished = true; block->finished = true;
return 0;
} }
EXPORT_SYMBOL(mlxsw_afa_block_jump); EXPORT_SYMBOL(mlxsw_afa_block_jump);
......
...@@ -57,8 +57,8 @@ void mlxsw_afa_block_destroy(struct mlxsw_afa_block *block); ...@@ -57,8 +57,8 @@ void mlxsw_afa_block_destroy(struct mlxsw_afa_block *block);
int mlxsw_afa_block_commit(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); char *mlxsw_afa_block_first_set(struct mlxsw_afa_block *block);
u32 mlxsw_afa_block_first_set_kvdl_index(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); int 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_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_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_trap(struct mlxsw_afa_block *block, u16 trap_id);
int mlxsw_afa_block_append_fwd(struct mlxsw_afa_block *block, int mlxsw_afa_block_append_fwd(struct mlxsw_afa_block *block,
......
...@@ -468,8 +468,8 @@ void mlxsw_sp_acl_rulei_keymask_buf(struct mlxsw_sp_acl_rule_info *rulei, ...@@ -468,8 +468,8 @@ void mlxsw_sp_acl_rulei_keymask_buf(struct mlxsw_sp_acl_rule_info *rulei,
enum mlxsw_afk_element element, enum mlxsw_afk_element element,
const char *key_value, const char *key_value,
const char *mask_value, unsigned int len); const char *mask_value, unsigned int 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);
void mlxsw_sp_acl_rulei_act_jump(struct mlxsw_sp_acl_rule_info *rulei, int mlxsw_sp_acl_rulei_act_jump(struct mlxsw_sp_acl_rule_info *rulei,
u16 group_id); u16 group_id);
int mlxsw_sp_acl_rulei_act_drop(struct mlxsw_sp_acl_rule_info *rulei); 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_trap(struct mlxsw_sp_acl_rule_info *rulei);
......
...@@ -378,15 +378,15 @@ void mlxsw_sp_acl_rulei_keymask_buf(struct mlxsw_sp_acl_rule_info *rulei, ...@@ -378,15 +378,15 @@ void mlxsw_sp_acl_rulei_keymask_buf(struct mlxsw_sp_acl_rule_info *rulei,
key_value, mask_value, len); 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, int mlxsw_sp_acl_rulei_act_jump(struct mlxsw_sp_acl_rule_info *rulei,
u16 group_id) 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) 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, ...@@ -608,7 +608,10 @@ mlxsw_sp_acl_tcam_region_catchall_add(struct mlxsw_sp *mlxsw_sp,
goto err_rulei_create; 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); err = mlxsw_sp_acl_rulei_commit(rulei);
if (err) if (err)
goto err_rulei_commit; goto err_rulei_commit;
...@@ -623,6 +626,7 @@ mlxsw_sp_acl_tcam_region_catchall_add(struct mlxsw_sp *mlxsw_sp, ...@@ -623,6 +626,7 @@ mlxsw_sp_acl_tcam_region_catchall_add(struct mlxsw_sp *mlxsw_sp,
err_rule_insert: err_rule_insert:
err_rulei_commit: err_rulei_commit:
err_rulei_act_continue:
mlxsw_sp_acl_rulei_destroy(rulei); mlxsw_sp_acl_rulei_destroy(rulei);
err_rulei_create: err_rulei_create:
parman_item_remove(region->parman, parman_prio, parman_item); parman_item_remove(region->parman, parman_prio, parman_item);
......
...@@ -63,7 +63,11 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, ...@@ -63,7 +63,11 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
tcf_exts_to_list(exts, &actions); tcf_exts_to_list(exts, &actions);
list_for_each_entry(a, &actions, list) { list_for_each_entry(a, &actions, list) {
if (is_tcf_gact_shot(a)) { if (is_tcf_gact_ok(a)) {
err = mlxsw_sp_acl_rulei_act_continue(rulei);
if (err)
return err;
} else if (is_tcf_gact_shot(a)) {
err = mlxsw_sp_acl_rulei_act_drop(rulei); err = mlxsw_sp_acl_rulei_act_drop(rulei);
if (err) if (err)
return err; return err;
...@@ -84,7 +88,9 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, ...@@ -84,7 +88,9 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
return PTR_ERR(ruleset); return PTR_ERR(ruleset);
group_id = mlxsw_sp_acl_ruleset_group_id(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)) { } else if (is_tcf_mirred_egress_redirect(a)) {
int ifindex = tcf_mirred_ifindex(a); int ifindex = tcf_mirred_ifindex(a);
struct net_device *out_dev; struct net_device *out_dev;
......
...@@ -33,6 +33,11 @@ static inline bool __is_tcf_gact_act(const struct tc_action *a, int act, ...@@ -33,6 +33,11 @@ static inline bool __is_tcf_gact_act(const struct tc_action *a, int act,
return false; return false;
} }
static inline bool is_tcf_gact_ok(const struct tc_action *a)
{
return __is_tcf_gact_act(a, TC_ACT_OK, false);
}
static inline bool is_tcf_gact_shot(const struct tc_action *a) static inline bool is_tcf_gact_shot(const struct tc_action *a)
{ {
return __is_tcf_gact_act(a, TC_ACT_SHOT, false); return __is_tcf_gact_act(a, TC_ACT_SHOT, false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment