mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
net: tc_act: add skbedit_ptype helper functions
The tc_act header file contains an inline function that checks if an action is changing the skb mark of a packet and a further function to extract the mark. Add similar functions to check for and get skbedit actions that modify the packet type of the skb. Signed-off-by: John Hurley <john.hurley@netronome.com> Reviewed-by: Simon Horman <simon.horman@netronome.com> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
55a47dc269
commit
77feb4eed7
1 changed files with 27 additions and 0 deletions
|
@ -54,4 +54,31 @@ static inline u32 tcf_skbedit_mark(const struct tc_action *a)
|
||||||
return mark;
|
return mark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return true iff action is ptype */
|
||||||
|
static inline bool is_tcf_skbedit_ptype(const struct tc_action *a)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_CLS_ACT
|
||||||
|
u32 flags;
|
||||||
|
|
||||||
|
if (a->ops && a->ops->id == TCA_ID_SKBEDIT) {
|
||||||
|
rcu_read_lock();
|
||||||
|
flags = rcu_dereference(to_skbedit(a)->params)->flags;
|
||||||
|
rcu_read_unlock();
|
||||||
|
return flags == SKBEDIT_F_PTYPE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u32 tcf_skbedit_ptype(const struct tc_action *a)
|
||||||
|
{
|
||||||
|
u16 ptype;
|
||||||
|
|
||||||
|
rcu_read_lock();
|
||||||
|
ptype = rcu_dereference(to_skbedit(a)->params)->ptype;
|
||||||
|
rcu_read_unlock();
|
||||||
|
|
||||||
|
return ptype;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __NET_TC_SKBEDIT_H */
|
#endif /* __NET_TC_SKBEDIT_H */
|
||||||
|
|
Loading…
Reference in a new issue