mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Anton Danilov <littlesmilingcloud@gmail.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	David Ahern <dsahern@kernel.org>, Simon Horman <horms@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 00/10] tunnels: add core and gre drop reasons
Date: Wed, 23 Sep 2026 17:19:23 +0300	[thread overview]
Message-ID: <20260923141923.GA2841095@shredder> (raw)
In-Reply-To: <20260922221507.3268127-1-littlesmilingcloud@gmail.com>

On Wed, Sep 23, 2026 at 01:14:57AM +0300, Anton Danilov wrote:
> Only vxlan reports drop reasons among the tunnel drivers today. The ones
> converted here free what they drop with kfree_skb(), which drop_monitor
> and the skb:kfree_skb tracepoint do report, but as NOT_SPECIFIED, with
> the call site as the only hint at which check failed. That hint does not
> go far: all the failures of ip_tunnel_rcv() end at one call site, and so
> do nearly all of those of each transmit function. The call site is not a
> stable interface either: its offset moves with the compiler, inlining
> and the configuration, so a filter on it has to follow every rebuild.
> The reason stays the same across kernels, whether NET_DM_ATTR_REASON
> reports it or a BPF program matches it by name. The device counters
> group the failures coarsely too: rx_errors and tx_errors each lump
> together unrelated conditions.
> 
> This series covers the generic paths shared by ipip, sit, gre and their
> IPv6 counterparts, plus the GRE specific code, in both directions.
> A later series will do the same for geneve, bareudp, fou and the
> remaining IP in IP drivers.

Please only annotate drivers that you are familiar with, using and can
test. Otherwise it's a burden on the reviewer and potentially useless
code churn that will make it harder to backport future fixes.

> 
> Patches 1-2 convert the generic receive paths, ip_tunnel_rcv() and
> __ip6_tnl_rcv(). Two reasons are added:
> 
>   TNL_OPT_MISMATCH  the options a packet carries do not match the
>                     tunnel configuration
>   TNL_OLD_SEQ       the sequence number is older than the one the
>                     tunnel expects, like TCP_OLD_SEQUENCE for TCP
> 
> The second one has a failure mode worth naming: when a peer reboots, its
> outgoing sequence number restarts at zero, and the receiver drops
> everything until the peer's numbers get past the last one the receiver
> accepted. By the counters alone that looks like a misconfiguration: a
> packet without the sequence number option bumps the same rx_fifo_errors.
> 
> Patches 3-6 convert the GRE specific receive path. gre_parse_header()
> returns -EINVAL for every failure, and the only detail its callers could
> get was a csum_err flag that none of them read: both ip_gre and ip6_gre
> declared it, passed it in and ignored it. gre_parse_header() now returns
> a drop reason instead, and its callers take the header length from
> tpi->hdr_len. The receive helpers below gre_rcv() return the drop reason
> instead of a PACKET_* code, and the PACKET_* codes go away. Three
> reasons are added: GRE_INVALID_HDR and GRE_TUNNEL_NOT_FOUND, mirroring
> vxlan's VXLAN_INVALID_HDR and VXLAN_VNI_NOT_FOUND, and GRE_CSUM, like
> TCP_CSUM and UDP_CSUM.

GRE_CSUM looks fine as I'm not aware of other tunnels that have a
dedicated checksum, but GRE_INVALID_HDR and GRE_TUNNEL_NOT_FOUND should
be renamed to something more generic (e.g., TUNNEL_INVALID_HDR and
TUNNEL_NOT_FOUND) so that they could be reused across drivers and
replace the existing VXLAN ones. Note that you don't need the drop
reason to encode the tunnel name in order to know which tunnel driver
dropped the packet.

> 
> Patch 4 adds __iptunnel_pull_header_reason(), because
> __iptunnel_pull_header() reports a packet too short to pull as -ENOMEM,
> the same as an allocation failure, and ip6_gre calls it for every GRE
> packet, before the tunnel lookup.

The series is inconsistent about this and returns different reasons
(HDR_TRUNC / PKT_TOO_SMALL) for the same condition. I suggest that you
convert pskb_may_pull() to pskb_may_pull_reason() and return its reason
instead of HDR_TRUNC.

      parent reply	other threads:[~2026-09-23 14:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 22:14 Anton Danilov
2026-09-22 22:14 ` [PATCH net-next v4 01/10] ip_tunnel: add drop reasons to the generic RX path Anton Danilov
2026-09-22 22:14 ` [PATCH net-next v4 02/10] ip6_tunnel: " Anton Danilov
2026-09-22 22:15 ` [PATCH net-next v4 03/10] gre: make gre_parse_header() report a drop reason Anton Danilov
2026-09-23 14:59   ` Ido Schimmel
2026-09-22 22:15 ` [PATCH net-next v4 04/10] ip_tunnel: add __iptunnel_pull_header_reason() Anton Danilov
2026-09-23 15:41   ` Ido Schimmel
2026-09-22 22:15 ` [PATCH net-next v4 05/10] ip_gre: add drop reasons to the RX path Anton Danilov
2026-09-22 22:15 ` [PATCH net-next v4 06/10] ip6_gre: " Anton Danilov
2026-09-22 22:15 ` [PATCH net-next v4 07/10] ip_tunnel: add drop reasons to the transmit path Anton Danilov
2026-09-23 15:53   ` Ido Schimmel
2026-09-22 22:15 ` [PATCH net-next v4 08/10] ip_gre: " Anton Danilov
2026-09-22 22:15 ` [PATCH net-next v4 09/10] ip6_gre: make prepare_ip6gre_xmit_other() void Anton Danilov
2026-09-22 22:15 ` [PATCH net-next v4 10/10] ip6_tunnel: add drop reasons to the transmit path Anton Danilov
2026-09-23 14:19 ` Ido Schimmel [this message]

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=20260923141923.GA2841095@shredder \
    --to=idosch@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=littlesmilingcloud@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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

all inboxes | Powered by JetHome®