Re: [PATCH net-next v5 09/14] ip_tunnel: add drop reasons to the transmit path
flat view
From: Ido Schimmel <idosch@nvidia.com>
Date: 2026-10-04 16:15:59
Also in:
lkml
On Sun, Oct 04, 2026 at 07:08:20PM +0300, Ido Schimmel wrote:
On Wed, Sep 30, 2026 at 09:39:05PM +0300, Anton Danilov wrote:quoted
@@ -636,6 +641,12 @@ enum skb_drop_reason { SKB_DROP_REASON_TUNNEL_OLD_SEQ, /** @SKB_DROP_REASON_GRE_CSUM: GRE checksum error */ SKB_DROP_REASON_GRE_CSUM, + /** + * @SKB_DROP_REASON_TUNNEL_ENCAP: failed to build the encapsulation + * header of a tunnel, e.g. an unknown or unregistered encapsulation + * type. + */ + SKB_DROP_REASON_TUNNEL_ENCAP, /** * @SKB_DROP_REASON_MAX: the maximum of core drop reasons, which * shouldn't be used as a real 'reason' - only for tracing code gen[...]quoted
@@ -620,8 +623,10 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, if (!tunnel_hlen) tunnel_hlen = ip_encap_hlen(&tun_info->encap); - if (ip_tunnel_encap(skb, &tun_info->encap, &proto, &fl4) < 0) + if (ip_tunnel_encap(skb, &tun_info->encap, &proto, &fl4) < 0) { + reason = SKB_DROP_REASON_TUNNEL_ENCAP;This will also cover the -ENOMEM from the callbacks, where SKB_DROP_REASON_NOMEM is more appropriate. Better to change ip_tunnel_encap() to return the appropriate drop reason like you did with gre_parse_header().
And change ip6_tnl_encap() in a similar fashion.
quoted
goto tx_error; + } use_cache = ip_tunnel_dst_cache_usable(skb, tun_info); if (use_cache)