Add the new flow action and related support so that drivers can offload the trap_fwd action.
Signed-off-by: Petr Machata <pe...@nvidia.com> Reviewed-by: Jiri Pirko <j...@nvidia.com> Reviewed-by: Ido Schimmel <ido...@nvidia.com> --- include/net/flow_offload.h | 1 + include/net/tc_act/tc_gact.h | 5 +++++ net/sched/cls_api.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index dc5c1e69cd9f..5f35523f12b5 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -121,6 +121,7 @@ enum flow_action_id { FLOW_ACTION_ACCEPT = 0, FLOW_ACTION_DROP, FLOW_ACTION_TRAP, + FLOW_ACTION_TRAP_FWD, FLOW_ACTION_GOTO, FLOW_ACTION_REDIRECT, FLOW_ACTION_MIRRED, diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h index eb8f01c819e6..df9e0a19c826 100644 --- a/include/net/tc_act/tc_gact.h +++ b/include/net/tc_act/tc_gact.h @@ -49,6 +49,11 @@ static inline bool is_tcf_gact_trap(const struct tc_action *a) return __is_tcf_gact_act(a, TC_ACT_TRAP, false); } +static inline bool is_tcf_gact_trap_fwd(const struct tc_action *a) +{ + return __is_tcf_gact_act(a, TC_ACT_TRAP_FWD, false); +} + static inline bool is_tcf_gact_goto_chain(const struct tc_action *a) { return __is_tcf_gact_act(a, TC_ACT_GOTO_CHAIN, true); diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index d3db70865d66..95e37eb50173 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -3582,6 +3582,8 @@ int tc_setup_flow_action(struct flow_action *flow_action, entry->id = FLOW_ACTION_DROP; } else if (is_tcf_gact_trap(act)) { entry->id = FLOW_ACTION_TRAP; + } else if (is_tcf_gact_trap_fwd(act)) { + entry->id = FLOW_ACTION_TRAP_FWD; } else if (is_tcf_gact_goto_chain(act)) { entry->id = FLOW_ACTION_GOTO; entry->chain_index = tcf_gact_goto_chain_index(act); -- 2.26.2