[Devel] [PATCH RHEL9 COMMIT] net: dev: add skb drop reasons to __dev_xmit_skb()

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jan 16 20:56:46 MSK 2023


The commit is pushed to "branch-rh9-5.14.0-162.6.1.vz9.18.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-162.6.1.vz9.18.2
------>
commit 9ae16620ac233c22eac4115657ac045395a7cf0f
Author: Menglong Dong <imagedong at tencent.com>
Date:   Tue Jan 3 17:39:19 2023 +0200

    net: dev: add skb drop reasons to __dev_xmit_skb()
    
    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 at tencent.com>
    Signed-off-by: David S. Miller <davem at davemloft.net>
    Acked-by: Nikolay Borisov <nborisov at suse.com>
    Signed-off-by: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
    
    ======
    Patchset description:
    ms/net: Annotate skb free sites with reason
    
    This series backports most of the patches that add a reason to skb free sites.
    
    https://jira.sw.ru/browse/PSBM-143302
    
    Feature: net: improve verbosity of dropped packets reporting
---
 include/linux/skbuff.h     | 4 ++++
 include/trace/events/skb.h | 1 +
 net/core/dev.c             | 5 +++--
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 064201f7ac40..289f66cf58f9 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -393,6 +393,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,
 };
 
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index 8141102d3735..ca65f2080724 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -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
diff --git a/net/core/dev.c b/net/core/dev.c
index 265bae952468..9d7bc5812fae 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3757,7 +3757,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;
 	}
 
@@ -3808,7 +3809,7 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
 	}
 	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;


More information about the Devel mailing list