netdev.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 net-next v3 0/3] net: icmp: add skb drop reasons to icmp
Date: Wed, 16 Mar 2022 14:31:45 +0800	[thread overview]
Message-ID: <20220316063148.700769-1-imagedong@tencent.com> (raw)

From: Menglong Dong <imagedong@tencent.com>

In the commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()"),
we added the support of reporting the reasons of skb drops to kfree_skb
tracepoint. And in this series patches, reasons for skb drops are added
to ICMP protocol.

In order to report the reasons of skb drops in 'sock_queue_rcv_skb()',
the function 'sock_queue_rcv_skb_reason()' is introduced in the 1th
patch, which is used in the 2th patch.

In the 2th patch, we introduce the new function __ping_queue_rcv_skb()
to report drop reasons by its return value.

In the 3th patch, we make ICMP message handler functions return drop
reasons, which means we change the return type of 'handler()' in
'struct icmp_control' from 'bool' to 'enum skb_drop_reason'. This
changed its original intention, as 'false' means failure, but
'SKB_NOT_DROPPED_YET', which is 0, means success now. Therefore, we
have to change all usages of these handler. Following "handler" functions
are involved:

icmp_unreach()
icmp_redirect()
icmp_echo()
icmp_timestamp()
icmp_discard()

And following drop reasons are added(what they mean can be see
in the document for them):

SKB_DROP_REASON_ICMP_CSUM
SKB_DROP_REASON_ICMP_TYPE
SKB_DROP_REASON_ICMP_BROADCAST

Changes since v2:
- fix aliegnment problem in the 2th patch

Changes since v1:
- introduce __ping_queue_rcv_skb() instead of change the return value
  of ping_queue_rcv_skb() in the 2th patch, as Paolo suggested

Menglong Dong (3):
  net: sock: introduce sock_queue_rcv_skb_reason()
  net: icmp: introduce __ping_queue_rcv_skb() to report drop reasons
  net: icmp: add reasons of the skb drops to icmp protocol

 include/linux/skbuff.h     |  5 +++
 include/net/ping.h         |  2 +-
 include/net/sock.h         |  9 ++++-
 include/trace/events/skb.h |  3 ++
 net/core/sock.c            | 30 ++++++++++++---
 net/ipv4/icmp.c            | 75 ++++++++++++++++++++++----------------
 net/ipv4/ping.c            | 32 ++++++++++------
 net/ipv6/icmp.c            | 24 +++++++-----
 8 files changed, 121 insertions(+), 59 deletions(-)

-- 
2.35.1


             reply	other threads:[~2022-03-16  6:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16  6:31 menglong8.dong [this message]
2022-03-16  6:31 ` [PATCH net-next v3 1/3] net: sock: introduce sock_queue_rcv_skb_reason() menglong8.dong
2022-03-16  6:31 ` [PATCH net-next v3 2/3] net: icmp: introduce __ping_queue_rcv_skb() to report drop reasons menglong8.dong
2022-03-17  3:56   ` David Ahern
2022-03-17  5:25     ` Menglong Dong
2022-03-17  8:33       ` Paolo Abeni
2022-03-17  8:36         ` Menglong Dong
2022-03-16  6:31 ` [PATCH net-next v3 3/3] net: icmp: add reasons of the skb drops to icmp protocol menglong8.dong
2022-03-17  3:18   ` Jakub Kicinski
2022-03-17  3:35     ` David Ahern
2022-03-17  4:05       ` Jakub Kicinski
2022-03-17  6:02         ` Menglong Dong
2022-03-17 14:48         ` David Ahern
2022-03-17 14:53           ` David Laight
2022-03-17 15:49             ` David Ahern
2022-03-18  1:37           ` Menglong Dong
2022-03-18  4:10             ` David Ahern
2022-03-18  7:26               ` Menglong Dong
2022-03-18 22:33                 ` David Ahern
2022-03-20 13:27                   ` Menglong Dong
2022-03-17  5:57     ` Menglong Dong

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=20220316063148.700769-1-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).