[Devel] [PATCH RHEL9 COMMIT] net: tcp: introduce tcp_drop_reason()

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jan 16 20:56:42 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 d021a19be99eb7a74d882daf28971ed31b82acb6
Author: Menglong Dong <imagedong at tencent.com>
Date:   Tue Jan 3 17:39:05 2023 +0200

    net: tcp: introduce tcp_drop_reason()
    
    For TCP protocol, tcp_drop() is used to free the skb when it needs
    to be dropped. To make use of kfree_skb_reason() and pass the drop
    reason to it, introduce the function tcp_drop_reason(). Meanwhile,
    make tcp_drop() an inline call to tcp_drop_reason().
    
    Reviewed-by: Mengen Sun <mengensun at tencent.com>
    Reviewed-by: Hao Peng <flyingpeng at tencent.com>
    Signed-off-by: Menglong Dong <imagedong at tencent.com>
    Reviewed-by: Eric Dumazet <edumazet at google.com>
    Reviewed-by: David Ahern <dsahern at kernel.org>
    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
---
 net/ipv4/tcp_input.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 2972062753a3..09effcf4db7c 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4646,10 +4646,16 @@ static bool tcp_ooo_try_coalesce(struct sock *sk,
 	return res;
 }
 
-static void tcp_drop(struct sock *sk, struct sk_buff *skb)
+static void tcp_drop_reason(struct sock *sk, struct sk_buff *skb,
+			    enum skb_drop_reason reason)
 {
 	sk_drops_add(sk, skb);
-	__kfree_skb(skb);
+	kfree_skb_reason(skb, reason);
+}
+
+static void tcp_drop(struct sock *sk, struct sk_buff *skb)
+{
+	tcp_drop_reason(sk, skb, SKB_DROP_REASON_NOT_SPECIFIED);
 }
 
 /* This one checks to see if we can put data from the


More information about the Devel mailing list