Skip to content

Commit e457d86

Browse files
jpirkodavem330
authored andcommitted
net: sched: add couple of goto_chain helpers
Add helpers to find out if a gact instance is goto_chain termination action and to get chain index. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 45b6274 commit e457d86

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

include/net/tc_act/tc_gact.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ struct tcf_gact {
1515
};
1616
#define to_gact(a) ((struct tcf_gact *)a)
1717

18-
static inline bool __is_tcf_gact_act(const struct tc_action *a, int act)
18+
static inline bool __is_tcf_gact_act(const struct tc_action *a, int act,
19+
bool is_ext)
1920
{
2021
#ifdef CONFIG_NET_CLS_ACT
2122
struct tcf_gact *gact;
@@ -24,7 +25,8 @@ static inline bool __is_tcf_gact_act(const struct tc_action *a, int act)
2425
return false;
2526

2627
gact = to_gact(a);
27-
if (gact->tcf_action == act)
28+
if ((!is_ext && gact->tcf_action == act) ||
29+
(is_ext && TC_ACT_EXT_CMP(gact->tcf_action, act)))
2830
return true;
2931

3032
#endif
@@ -33,12 +35,22 @@ static inline bool __is_tcf_gact_act(const struct tc_action *a, int act)
3335

3436
static inline bool is_tcf_gact_shot(const struct tc_action *a)
3537
{
36-
return __is_tcf_gact_act(a, TC_ACT_SHOT);
38+
return __is_tcf_gact_act(a, TC_ACT_SHOT, false);
3739
}
3840

3941
static inline bool is_tcf_gact_trap(const struct tc_action *a)
4042
{
41-
return __is_tcf_gact_act(a, TC_ACT_TRAP);
43+
return __is_tcf_gact_act(a, TC_ACT_TRAP, false);
44+
}
45+
46+
static inline bool is_tcf_gact_goto_chain(const struct tc_action *a)
47+
{
48+
return __is_tcf_gact_act(a, TC_ACT_GOTO_CHAIN, true);
49+
}
50+
51+
static inline u32 tcf_gact_goto_chain_index(const struct tc_action *a)
52+
{
53+
return a->goto_chain->index;
4254
}
4355

4456
#endif /* __NET_TC_GACT_H */

0 commit comments

Comments
 (0)