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 04/10] ip_tunnel: add __iptunnel_pull_header_reason()
Date: Wed, 23 Sep 2026 18:41:14 +0300	[thread overview]
Message-ID: <20260923154114.GA2880695@shredder> (raw)
In-Reply-To: <20260922221507.3268127-5-littlesmilingcloud@gmail.com>

On Wed, Sep 23, 2026 at 01:15:01AM +0300, Anton Danilov wrote:
> diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
> index 7102aa11fae2..c68031d01c39 100644
> --- a/include/net/ip_tunnels.h
> +++ b/include/net/ip_tunnels.h
> @@ -614,8 +614,17 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
>  	return INET_ECN_encapsulate(tos, inner);
>  }
>  
> -int __iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
> -			   __be16 inner_proto, bool raw_proto, bool xnet);
> +enum skb_drop_reason
> +__iptunnel_pull_header_reason(struct sk_buff *skb, int hdr_len,
> +			      __be16 inner_proto, bool raw_proto, bool xnet);
> +
> +static inline int __iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
> +					 __be16 inner_proto, bool raw_proto,
> +					 bool xnet)
> +{
> +	return __iptunnel_pull_header_reason(skb, hdr_len, inner_proto,
> +					     raw_proto, xnet) ? -ENOMEM : 0;
> +}

Either append patches to this series or as a follow-up, after this
series the only caller of __iptunnel_pull_header() other than
iptunnel_pull_header() is the VXLAN driver and it should be converted to
report the actual drop reason instead of NOMEM:

diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index 347245cc1de4..5c429a70987e 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -1720,11 +1720,11 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 		raw_proto = true;
 	}
 
-	if (__iptunnel_pull_header(skb, VXLAN_HLEN, protocol, raw_proto,
-				   !net_eq(vxlan->net, dev_net(vxlan->dev)))) {
-		reason = SKB_DROP_REASON_NOMEM;
+	reason = __iptunnel_pull_header_reason(skb, VXLAN_HLEN, protocol,
+					       raw_proto,
+					       !net_eq(vxlan->net, dev_net(vxlan->dev)));
+	if (reason)
 		goto drop;
-	}
 
 	if (vxlan->cfg.flags & VXLAN_F_REMCSUM_RX) {
 		reason = vxlan_remcsum(skb, vxlan->cfg.flags);

Then remove __iptunnel_pull_header():

diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 27a9e097996b..a94dadfa81f2 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -614,18 +614,11 @@ enum skb_drop_reason
 __iptunnel_pull_header_reason(struct sk_buff *skb, int hdr_len,
 			      __be16 inner_proto, bool raw_proto, bool xnet);
 
-static inline int __iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
-					 __be16 inner_proto, bool raw_proto,
-					 bool xnet)
+static inline bool iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
+					__be16 inner_proto, bool xnet)
 {
-	return __iptunnel_pull_header_reason(skb, hdr_len, inner_proto,
-					     raw_proto, xnet) ? -ENOMEM : 0;
-}
-
-static inline int iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
-				       __be16 inner_proto, bool xnet)
-{
-	return __iptunnel_pull_header(skb, hdr_len, inner_proto, false, xnet);
+	return __iptunnel_pull_header_reason(skb, hdr_len, inner_proto, false,
+					     xnet) != SKB_NOT_DROPPED_YET;
 }
 
 void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,


  reply	other threads:[~2026-09-23 15:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 22:14 [PATCH net-next v4 00/10] tunnels: add core and gre drop reasons 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 [this message]
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 ` [PATCH net-next v4 00/10] tunnels: add core and gre drop reasons Ido Schimmel

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=20260923154114.GA2880695@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®