linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: menglong8.dong@gmail.com
To: dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com
Cc: rostedt@goodmis.org, mingo@redhat.com, xeb@mail.ru,
	davem@davemloft.net, yoshfuji@linux-ipv6.org,
	imagedong@tencent.com, edumazet@google.com, kafai@fb.com,
	talalahmad@google.com, keescook@chromium.org, alobakin@pm.me,
	flyingpeng@tencent.com, mengensun@tencent.com,
	dongli.zhang@oracle.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, benbjiang@tencent.com
Subject: [PATCH RESEND net-next v5 2/4] net: skb: rename SKB_DROP_REASON_PTYPE_ABSENT
Date: Thu,  7 Apr 2022 14:20:50 +0800	[thread overview]
Message-ID: <20220407062052.15907-3-imagedong@tencent.com> (raw)
In-Reply-To: <20220407062052.15907-1-imagedong@tencent.com>

From: Menglong Dong <imagedong@tencent.com>

As David Ahern suggested, the reasons for skb drops should be more
general and not be code based.

Therefore, rename SKB_DROP_REASON_PTYPE_ABSENT to
SKB_DROP_REASON_UNHANDLED_PROTO, which is used for the cases of no
L3 protocol handler, no L4 protocol handler, version extensions, etc.

From previous discussion, now we have the aim to make these reasons
more abstract and users based, avoiding code based.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
 include/linux/skbuff.h     | 8 +++-----
 include/trace/events/skb.h | 2 +-
 net/core/dev.c             | 8 +++-----
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 26538ceb4b01..10ba07892c46 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -408,11 +408,9 @@ enum skb_drop_reason {
 					 */
 	SKB_DROP_REASON_XDP,		/* dropped by XDP in input path */
 	SKB_DROP_REASON_TC_INGRESS,	/* dropped in TC ingress HOOK */
-	SKB_DROP_REASON_PTYPE_ABSENT,	/* not packet_type found to handle
-					 * the skb. For an etner packet,
-					 * this means that L3 protocol is
-					 * not supported
-					 */
+	SKB_DROP_REASON_UNHANDLED_PROTO,	/* protocol not implemented
+						 * or not supported
+						 */
 	SKB_DROP_REASON_SKB_CSUM,	/* sk_buff checksum computation
 					 * error
 					 */
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index e1670e1e4934..85abd7cbd221 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -50,7 +50,7 @@
 	EM(SKB_DROP_REASON_CPU_BACKLOG, CPU_BACKLOG)		\
 	EM(SKB_DROP_REASON_XDP, XDP)				\
 	EM(SKB_DROP_REASON_TC_INGRESS, TC_INGRESS)		\
-	EM(SKB_DROP_REASON_PTYPE_ABSENT, PTYPE_ABSENT)		\
+	EM(SKB_DROP_REASON_UNHANDLED_PROTO, UNHANDLED_PROTO)	\
 	EM(SKB_DROP_REASON_SKB_CSUM, SKB_CSUM)			\
 	EM(SKB_DROP_REASON_SKB_GSO_SEG, SKB_GSO_SEG)		\
 	EM(SKB_DROP_REASON_SKB_UCOPY_FAULT, SKB_UCOPY_FAULT)	\
diff --git a/net/core/dev.c b/net/core/dev.c
index 75bab5b0dbae..d73b35e6aae4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5359,13 +5359,11 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc,
 		*ppt_prev = pt_prev;
 	} else {
 drop:
-		if (!deliver_exact) {
+		if (!deliver_exact)
 			dev_core_stats_rx_dropped_inc(skb->dev);
-			kfree_skb_reason(skb, SKB_DROP_REASON_PTYPE_ABSENT);
-		} else {
+		else
 			dev_core_stats_rx_nohandler_inc(skb->dev);
-			kfree_skb(skb);
-		}
+		kfree_skb_reason(skb, SKB_DROP_REASON_UNHANDLED_PROTO);
 		/* Jamal, now you will not able to escape explaining
 		 * me how you were going to use this. :-)
 		 */
-- 
2.35.1


  parent reply	other threads:[~2022-04-07  6:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07  6:20 [PATCH RESEND net-next v5 0/4] net: icmp: add skb drop reasons to icmp menglong8.dong
2022-04-07  6:20 ` [PATCH RESEND net-next v5 1/4] net: sock: introduce sock_queue_rcv_skb_reason() menglong8.dong
2022-04-09  3:49   ` David Ahern
2022-04-07  6:20 ` menglong8.dong [this message]
2022-04-09  3:50   ` [PATCH RESEND net-next v5 2/4] net: skb: rename SKB_DROP_REASON_PTYPE_ABSENT David Ahern
2022-04-07  6:20 ` [PATCH RESEND net-next v5 3/4] net: icmp: introduce __ping_queue_rcv_skb() to report drop reasons menglong8.dong
2022-04-09  4:05   ` David Ahern
2022-04-07  6:20 ` [PATCH RESEND net-next v5 4/4] net: icmp: add skb drop reasons to icmp protocol menglong8.dong
2022-04-09  4:17   ` David Ahern
2022-04-11  9:50 ` [PATCH RESEND net-next v5 0/4] net: icmp: add skb drop reasons to icmp patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220407062052.15907-3-imagedong@tencent.com \
    --to=menglong8.dong@gmail.com \
    --cc=alobakin@pm.me \
    --cc=benbjiang@tencent.com \
    --cc=davem@davemloft.net \
    --cc=dongli.zhang@oracle.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=flyingpeng@tencent.com \
    --cc=imagedong@tencent.com \
    --cc=kafai@fb.com \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mengensun@tencent.com \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=talalahmad@google.com \
    --cc=xeb@mail.ru \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).