net: dev: use kfree_skb_reason() for sch_handle_ingress()
authorMenglong Dong <imagedong@tencent.com>
Fri, 4 Mar 2022 06:00:45 +0000 (14:00 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Mar 2022 12:17:11 +0000 (12:17 +0000)
Replace kfree_skb() used in sch_handle_ingress() with
kfree_skb_reason(). Following drop reasons are introduced:

SKB_DROP_REASON_TC_INGRESS

Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h
include/trace/events/skb.h
net/core/dev.c

index 7a38d0f90cef52fb27b799454298b1cb60475a4e..6b14b2d297d27928a69b6964b703b134ef31ff63 100644 (file)
@@ -406,6 +406,7 @@ enum skb_drop_reason {
                                         * net.rst) or RPS flow limit
                                         */
        SKB_DROP_REASON_XDP,            /* dropped by XDP in input path */
+       SKB_DROP_REASON_TC_INGRESS,     /* dropped in TC ingress HOOK */
        SKB_DROP_REASON_MAX,
 };
 
index 8c4c343c830f0315e96a459f278253e913d46389..514dd2de8776666fe6420feedc0367f21c87d5b5 100644 (file)
@@ -49,6 +49,7 @@
        EM(SKB_DROP_REASON_QDISC_DROP, QDISC_DROP)              \
        EM(SKB_DROP_REASON_CPU_BACKLOG, CPU_BACKLOG)            \
        EM(SKB_DROP_REASON_XDP, XDP)                            \
+       EM(SKB_DROP_REASON_TC_INGRESS, TC_INGRESS)              \
        EMe(SKB_DROP_REASON_MAX, MAX)
 
 #undef EM
index f449834a63df05d9d9c305529568c9af308f097e..ba7580ccee947a28592e70efe453c27e0a7af443 100644 (file)
@@ -5041,7 +5041,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
                break;
        case TC_ACT_SHOT:
                mini_qdisc_qstats_cpu_drop(miniq);
-               kfree_skb(skb);
+               kfree_skb_reason(skb, SKB_DROP_REASON_TC_INGRESS);
                return NULL;
        case TC_ACT_STOLEN:
        case TC_ACT_QUEUED: