net: dev: add skb drop reasons to __dev_xmit_skb()
authorMenglong Dong <imagedong@tencent.com>
Fri, 4 Mar 2022 06:00:42 +0000 (14:00 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Mar 2022 12:17:11 +0000 (12:17 +0000)
Add reasons for skb drops to __dev_xmit_skb() by replacing
kfree_skb_list() with kfree_skb_list_reason(). The drop reason of
SKB_DROP_REASON_QDISC_DROP is introduced for qdisc enqueue fails.

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 1f2de153755cd9d0b66931d333d997a226a9537d..769d54ba2f3b4fabf50984a8933c7c7c2ce886d0 100644 (file)
@@ -395,6 +395,10 @@ enum skb_drop_reason {
                                                 */
        SKB_DROP_REASON_NEIGH_DEAD,     /* neigh entry is dead */
        SKB_DROP_REASON_TC_EGRESS,      /* dropped in TC egress HOOK */
+       SKB_DROP_REASON_QDISC_DROP,     /* dropped by qdisc when packet
+                                        * outputting (failed to enqueue to
+                                        * current qdisc)
+                                        */
        SKB_DROP_REASON_MAX,
 };
 
index 53755e8191a19e8f18ec195026bdf4166dc66779..dbf3e2e3c1b44d016b42d6e8e248058b9b074404 100644 (file)
@@ -46,6 +46,7 @@
        EM(SKB_DROP_REASON_NEIGH_QUEUEFULL, NEIGH_QUEUEFULL)    \
        EM(SKB_DROP_REASON_NEIGH_DEAD, NEIGH_DEAD)              \
        EM(SKB_DROP_REASON_TC_EGRESS, TC_EGRESS)                \
+       EM(SKB_DROP_REASON_QDISC_DROP, QDISC_DROP)              \
        EMe(SKB_DROP_REASON_MAX, MAX)
 
 #undef EM
index ef0b1992cf1365dfb55d2f1abd2f85a119f99caf..e2c107643ee5545c67ed6c14eedecd01864f87e1 100644 (file)
@@ -3759,7 +3759,8 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
 
 no_lock_out:
                if (unlikely(to_free))
-                       kfree_skb_list(to_free);
+                       kfree_skb_list_reason(to_free,
+                                             SKB_DROP_REASON_QDISC_DROP);
                return rc;
        }
 
@@ -3814,7 +3815,7 @@ no_lock_out:
        }
        spin_unlock(root_lock);
        if (unlikely(to_free))
-               kfree_skb_list(to_free);
+               kfree_skb_list_reason(to_free, SKB_DROP_REASON_QDISC_DROP);
        if (unlikely(contended))
                spin_unlock(&q->busylock);
        return rc;