diff options
author | Baowen Zheng <baowen.zheng@corigine.com> | 2021-12-17 21:16:21 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-12-19 17:08:48 +0300 |
commit | c54e1d920f04d528ab558f09326a78d2ae59e323 (patch) | |
tree | f92cbf847c229695ae68b2e87f07571dbfc578d8 /net/sched/act_skbedit.c | |
parent | 9c1c0e124ca25589e6cf040e105ab0857f9e9c3e (diff) | |
download | linux-c54e1d920f04d528ab558f09326a78d2ae59e323.tar.xz |
flow_offload: add ops to tc_action_ops for flow action setup
Add a new ops to tc_action_ops for flow action setup.
Refactor function tc_setup_flow_action to use this new ops.
We make this change to facilitate to add standalone action module.
We will also use this ops to offload action independent of filter
in following patch.
Signed-off-by: Baowen Zheng <baowen.zheng@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_skbedit.c')
-rw-r--r-- | net/sched/act_skbedit.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index f6df717b9f17..c380f9e6cc95 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c @@ -327,6 +327,32 @@ static size_t tcf_skbedit_get_fill_size(const struct tc_action *act) + nla_total_size_64bit(sizeof(u64)); /* TCA_SKBEDIT_FLAGS */ } +static int tcf_skbedit_offload_act_setup(struct tc_action *act, void *entry_data, + u32 *index_inc, bool bind) +{ + if (bind) { + struct flow_action_entry *entry = entry_data; + + if (is_tcf_skbedit_mark(act)) { + entry->id = FLOW_ACTION_MARK; + entry->mark = tcf_skbedit_mark(act); + } else if (is_tcf_skbedit_ptype(act)) { + entry->id = FLOW_ACTION_PTYPE; + entry->ptype = tcf_skbedit_ptype(act); + } else if (is_tcf_skbedit_priority(act)) { + entry->id = FLOW_ACTION_PRIORITY; + entry->priority = tcf_skbedit_priority(act); + } else { + return -EOPNOTSUPP; + } + *index_inc = 1; + } else { + return -EOPNOTSUPP; + } + + return 0; +} + static struct tc_action_ops act_skbedit_ops = { .kind = "skbedit", .id = TCA_ID_SKBEDIT, @@ -339,6 +365,7 @@ static struct tc_action_ops act_skbedit_ops = { .walk = tcf_skbedit_walker, .get_fill_size = tcf_skbedit_get_fill_size, .lookup = tcf_skbedit_search, + .offload_act_setup = tcf_skbedit_offload_act_setup, .size = sizeof(struct tcf_skbedit), }; |