[Devel] [PATCH RHEL9 COMMIT] net: skb: introduce the function kfree_skb_list_reason()

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 f0b48469eed0fac570e84d8582cd4fe7d2776a02
Author: Menglong Dong <imagedong at tencent.com>
Date:   Tue Jan 3 17:39:18 2023 +0200

    net: skb: introduce the function kfree_skb_list_reason()
    
    To report reasons of skb drops, introduce the function
    kfree_skb_list_reason() and make kfree_skb_list() an inline call to
    it. This function will be used in the next commit in
    __dev_xmit_skb().
    
    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 | 8 +++++++-
 net/core/skbuff.c      | 7 ++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index fbe1cadf1771..064201f7ac40 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1180,10 +1180,16 @@ static inline void kfree_skb(struct sk_buff *skb)
 }
 
 void skb_release_head_state(struct sk_buff *skb);
-void kfree_skb_list(struct sk_buff *segs);
+void kfree_skb_list_reason(struct sk_buff *segs,
+			   enum skb_drop_reason reason);
 void skb_dump(const char *level, const struct sk_buff *skb, bool full_pkt);
 void skb_tx_error(struct sk_buff *skb);
 
+static inline void kfree_skb_list(struct sk_buff *segs)
+{
+	kfree_skb_list_reason(segs, SKB_DROP_REASON_NOT_SPECIFIED);
+}
+
 #ifdef CONFIG_TRACEPOINTS
 void consume_skb(struct sk_buff *skb);
 #else
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 3d4887a8a68a..9d45ad819ea7 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -779,16 +779,17 @@ void kfree_skb_reason(struct sk_buff *skb, enum skb_drop_reason reason)
 }
 EXPORT_SYMBOL(kfree_skb_reason);
 
-void kfree_skb_list(struct sk_buff *segs)
+void kfree_skb_list_reason(struct sk_buff *segs,
+			   enum skb_drop_reason reason)
 {
 	while (segs) {
 		struct sk_buff *next = segs->next;
 
-		kfree_skb(segs);
+		kfree_skb_reason(segs, reason);
 		segs = next;
 	}
 }
-EXPORT_SYMBOL(kfree_skb_list);
+EXPORT_SYMBOL(kfree_skb_list_reason);
 
 /* Dump skb information and contents.
  *


More information about the Devel mailing list