From: Jiri Pirko Date: Wed, 9 Aug 2017 12:30:31 +0000 (+0200) Subject: net: sched: Add helpers to identify classids X-Git-Tag: v4.14-rc1~130^2~292^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=861932ecc36063196c80ca3e240502b0f6d0e977;p=platform%2Fkernel%2Flinux-rpi3.git net: sched: Add helpers to identify classids Offloading drivers need to understand what qdisc class a filter is added to. Currently they only need to identify ingress, clsact->ingress and clsact->egress. So provide these helpers. Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller --- diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 2579c20..259bc19 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -5,6 +5,7 @@ #include #include #include +#include #define DEFAULT_TX_QUEUE_LEN 1000 @@ -132,4 +133,17 @@ static inline unsigned int psched_mtu(const struct net_device *dev) return dev->mtu + dev->hard_header_len; } +static inline bool is_classid_clsact_ingress(u32 classid) +{ + /* This also returns true for ingress qdisc */ + return TC_H_MAJ(classid) == TC_H_MAJ(TC_H_CLSACT) && + TC_H_MIN(classid) != TC_H_MIN(TC_H_MIN_EGRESS); +} + +static inline bool is_classid_clsact_egress(u32 classid) +{ + return TC_H_MAJ(classid) == TC_H_MAJ(TC_H_CLSACT) && + TC_H_MIN(classid) == TC_H_MIN(TC_H_MIN_EGRESS); +} + #endif