From a0c69a23c66ec6f527c439714eb2cc5857a71492 Mon Sep 17 00:00:00 2001 From: Himanshu Joshi Date: Tue, 3 Nov 2020 16:41:26 +0530 Subject: [PATCH] net: core: Flag to identify ingress shaping done for exceptioned packets. Signed-off-by: Himanshu Joshi Change-Id: Ib3cd341e5b2d4dcf552e02e38d3f34a4f00351cd --- include/linux/skbuff.h | 2 ++ include/net/sch_generic.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -646,6 +646,7 @@ typedef unsigned char *sk_buff_data_t; * @offload_fwd_mark: Packet was L2-forwarded in hardware * @offload_l3_fwd_mark: Packet was L3-forwarded in hardware * @tc_skip_classify: do not classify packet. set by IFB device + * @tc_skip_classify_nss: do not classify packet. set by NSS IFB device * @tc_at_ingress: used within tc_classify to distinguish in/egress * @redirected: packet was redirected by packet classifier * @from_ingress: packet was redirected from the ingress path @@ -850,6 +851,7 @@ struct sk_buff { #ifdef CONFIG_NET_CLS_ACT __u8 tc_skip_classify:1; __u8 tc_at_ingress:1; + __u8 tc_skip_classify_nss:1; #endif #ifdef CONFIG_NET_REDIRECT __u8 redirected:1; --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -750,6 +750,40 @@ static inline bool skb_skip_tc_classify( return false; } +/* + * Set skb classify bit field. + */ +static inline void skb_set_tc_classify_nss(struct sk_buff *skb) +{ +#ifdef CONFIG_NET_CLS_ACT + skb->tc_skip_classify_nss = 1; +#endif +} + +/* + * Clear skb classify bit field. + */ +static inline void skb_clear_tc_classify_nss(struct sk_buff *skb) +{ +#ifdef CONFIG_NET_CLS_ACT + skb->tc_skip_classify_nss = 0; +#endif +} + +/* + * Skip skb processing if sent from ifb dev. + */ +static inline bool skb_skip_tc_classify_nss(struct sk_buff *skb) +{ +#ifdef CONFIG_NET_CLS_ACT + if (skb->tc_skip_classify_nss) { + skb_clear_tc_classify_nss(skb); + return true; + } +#endif + return false; +} + /* Reset all TX qdiscs greater than index of a device. */ static inline void qdisc_reset_all_tx_gt(struct net_device *dev, unsigned int i) {