[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220617100514.7230-5-imagedong@tencent.com>
Date: Fri, 17 Jun 2022 18:05:10 +0800
From: menglong8.dong@...il.com
To: edumazet@...gle.com
Cc: rostedt@...dmis.org, mingo@...hat.com, davem@...emloft.net,
yoshfuji@...ux-ipv6.org, dsahern@...nel.org, kuba@...nel.org,
pabeni@...hat.com, imagedong@...cent.com, kafai@...com,
talalahmad@...gle.com, keescook@...omium.org,
dongli.zhang@...cle.com, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, Jiang Biao <benbjiang@...cent.com>,
Hao Peng <flyingpeng@...cent.com>
Subject: [PATCH net-next v4 4/8] net: inet: add skb drop reason to inet_csk_destroy_sock()
From: Menglong Dong <imagedong@...cent.com>
skb dropping in inet_csk_destroy_sock() seems to be a common case. Add
the new drop reason 'SKB_DROP_REASON_SOCKET_DESTROIED' and apply it to
inet_csk_destroy_sock() to stop confusing users with 'NOT_SPECIFIED'.
Reviewed-by: Jiang Biao <benbjiang@...cent.com>
Reviewed-by: Hao Peng <flyingpeng@...cent.com>
Signed-off-by: Menglong Dong <imagedong@...cent.com>
---
include/net/dropreason.h | 5 +++++
net/ipv4/inet_connection_sock.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/net/dropreason.h b/include/net/dropreason.h
index fae9b40e54fa..3c6f1e299c35 100644
--- a/include/net/dropreason.h
+++ b/include/net/dropreason.h
@@ -231,6 +231,11 @@ enum skb_drop_reason {
* MTU)
*/
SKB_DROP_REASON_PKT_TOO_BIG,
+ /**
+ * @SKB_DROP_REASON_SOCKET_DESTROYED: socket is destroyed and the
+ * skb in its receive or send queue are all dropped
+ */
+ SKB_DROP_REASON_SOCKET_DESTROYED,
/**
* @SKB_DROP_REASON_MAX: the maximum of drop reason, which shouldn't be
* used as a real 'reason'
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index c0b7e6c21360..1812060f24cb 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -1129,7 +1129,7 @@ void inet_csk_destroy_sock(struct sock *sk)
sk->sk_prot->destroy(sk);
- sk_stream_kill_queues(sk);
+ sk_stream_kill_queues_reason(sk, SKB_DROP_REASON_SOCKET_DESTROYED);
xfrm_sk_free_policy(sk);
--
2.36.1
Powered by blists - more mailing lists