From: menglong8.dong@gmail.com
To: dsahern@kernel.org
Cc: rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net,
yoshfuji@linux-ipv6.org, kuba@kernel.org, pabeni@redhat.com,
benbjiang@tencent.com, flyingpeng@tencent.com,
imagedong@tencent.com, edumazet@google.com, kafai@fb.com,
talalahmad@google.com, keescook@chromium.org,
mengensun@tencent.com, dongli.zhang@oracle.com,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH net-next 0/9] net: ip: add skb drop reasons to ip ingress
Date: Wed, 13 Apr 2022 16:15:51 +0800 [thread overview]
Message-ID: <20220413081600.187339-1-imagedong@tencent.com> (raw)
From: Menglong Dong <imagedong@tencent.com>
In the series "net: use kfree_skb_reason() for ip/udp packet receive",
skb drop reasons are added to the basic ingress path of IPv4. And in
the series "net: use kfree_skb_reason() for ip/neighbour", the egress
paths of IPv4 and IPv6 are handled. Related links:
https://lore.kernel.org/netdev/20220205074739.543606-1-imagedong@tencent.com/
https://lore.kernel.org/netdev/20220226041831.2058437-1-imagedong@tencent.com/
Seems we still have a lot work to do with IP layer, including IPv6 basic
ingress path, IPv4/IPv6 forwarding, IPv6 exthdrs, fragment and defrag,
etc.
In this series, skb drop reasons are added to the basic ingress path of
IPv6 protocol and IPv4/IPv6 packet forwarding. Following functions, which
are used for IPv6 packet receiving are handled:
ip6_pkt_drop()
ip6_rcv_core()
ip6_protocol_deliver_rcu()
And following functions that used for IPv6 TLV parse are handled:
ip6_parse_tlv()
ipv6_hop_ra()
ipv6_hop_ioam()
ipv6_hop_jumbo()
ipv6_hop_calipso()
ipv6_dest_hao()
Besides, ip_forward() and ip6_forward(), which are used for IPv4/IPv6
forwarding, are also handled. And following new drop reasons are added:
/* host unreachable, corresponding to IPSTATS_MIB_INADDRERRORS */
SKB_DROP_REASON_IP_INADDRERRORS
/* network unreachable, corresponding to IPSTATS_MIB_INADDRERRORS */
SKB_DROP_REASON_IP_INNOROUTES
/* packet size is too big, corresponding to
* IPSTATS_MIB_INTOOBIGERRORS
*/
SKB_DROP_REASON_PKT_TOO_BIG
In order to simply the definition and assignment for
'enum skb_drop_reason', some helper functions are introduced in the 1th
patch. I'm not such if this is necessary, but it makes the code simpler.
For example, we can replace the code:
if (reason == SKB_DROP_REASON_NOT_SPECIFIED)
reason = SKB_DROP_REASON_IP_INHDR;
with:
SKB_DR_OR(reason, IP_INHDR);
In the 6th patch, the statistics for skb in ipv6_hop_jum() is removed,
as I think it is redundant. There are two call chains for
ipv6_hop_jumbo(). The first one is:
ipv6_destopt_rcv() -> ip6_parse_tlv() -> ipv6_hop_jumbo()
On this call chain, the drop statistics will be done in
ipv6_destopt_rcv() with 'IPSTATS_MIB_INHDRERRORS' if ipv6_hop_jumbo()
returns false.
The second call chain is:
ip6_rcv_core() -> ipv6_parse_hopopts() -> ip6_parse_tlv()
And the drop statistics will also be done in ip6_rcv_core() with
'IPSTATS_MIB_INHDRERRORS' if ipv6_hop_jumbo() returns false.
Therefore, the statistics in ipv6_hop_jumbo() is redundant, which
means the drop is counted twice. The statistics in ipv6_hop_jumbo()
is almost the same as the outside, except the
'IPSTATS_MIB_INTRUNCATEDPKTS', which seems that we have to ignore it.
======================================================================
Here is a basic test for IPv6 forwarding packet drop that monitored by
'dropwatch' tool:
drop at: ip6_forward+0x81a/0xb70 (0xffffffff86c73f8a)
origin: software
input port ifindex: 7
timestamp: Wed Apr 13 11:51:06 2022 130010176 nsec
protocol: 0x86dd
length: 94
original length: 94
drop reason: IP_INADDRERRORS
The origin cause of this case is that IPv6 doesn't allow to forward the
packet with LOCAL-LINK saddr, and results the 'IP_INADDRERRORS' drop
reason.
Menglong Dong (9):
skb: add some helpers for skb drop reasons
net: ipv4: add skb drop reasons to ip_error()
net: ipv6: add skb drop reasons to ip6_pkt_drop()
net: ip: add skb drop reasons to ip forwarding
net: icmp: introduce function icmpv6_param_prob_reason()
net: ipv6: remove redundant statistics in ipv6_hop_jumbo()
net: ipv6: add skb drop reasons to TLV parse
net: ipv6: add skb drop reasons to ip6_rcv_core()
net: ipv6: add skb drop reasons to ip6_protocol_deliver_rcu()
include/linux/icmpv6.h | 11 +++++++++--
include/linux/skbuff.h | 21 ++++++++++++++++++++
include/trace/events/skb.h | 3 +++
net/ipv4/ip_forward.c | 13 ++++++++++---
net/ipv4/route.c | 6 +++++-
net/ipv6/exthdrs.c | 39 +++++++++++++++++++++----------------
net/ipv6/icmp.c | 7 ++++---
net/ipv6/ip6_input.c | 40 ++++++++++++++++++++++++++------------
net/ipv6/ip6_output.c | 9 ++++++---
net/ipv6/route.c | 6 +++++-
10 files changed, 113 insertions(+), 42 deletions(-)
--
2.35.1
next reply other threads:[~2022-04-13 8:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-13 8:15 menglong8.dong [this message]
2022-04-13 8:15 ` [PATCH net-next 1/9] skb: add some helpers for skb drop reasons menglong8.dong
2022-04-13 8:15 ` [PATCH net-next 2/9] net: ipv4: add skb drop reasons to ip_error() menglong8.dong
2022-04-13 8:15 ` [PATCH net-next 3/9] net: ipv6: add skb drop reasons to ip6_pkt_drop() menglong8.dong
2022-04-13 8:15 ` [PATCH net-next 4/9] net: ip: add skb drop reasons to ip forwarding menglong8.dong
2022-04-13 8:15 ` [PATCH net-next 5/9] net: icmp: introduce function icmpv6_param_prob_reason() menglong8.dong
2022-04-13 8:15 ` [PATCH net-next 6/9] net: ipv6: remove redundant statistics in ipv6_hop_jumbo() menglong8.dong
2022-04-13 8:15 ` [PATCH net-next 7/9] net: ipv6: add skb drop reasons to TLV parse menglong8.dong
2022-04-13 8:15 ` [PATCH net-next 8/9] net: ipv6: add skb drop reasons to ip6_rcv_core() menglong8.dong
2022-04-13 20:40 ` Eric Dumazet
2022-04-14 1:20 ` Menglong Dong
2022-04-13 8:16 ` [PATCH net-next 9/9] net: ipv6: add skb drop reasons to ip6_protocol_deliver_rcu() menglong8.dong
2022-04-13 13:30 ` [PATCH net-next 0/9] net: ip: add skb drop reasons to ip ingress 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=20220413081600.187339-1-imagedong@tencent.com \
--to=menglong8.dong@gmail.com \
--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=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).