[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87sek32zl3.fsf@nvidia.com>
Date: Fri, 13 Jun 2025 21:40:38 +0200
From: Petr Machata <petrm@...dia.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: Petr Machata <petrm@...dia.com>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, "David
Ahern" <dsahern@...il.com>, <netdev@...r.kernel.org>, Simon Horman
<horms@...nel.org>, Nikolay Aleksandrov <razor@...ckwall.org>, Ido Schimmel
<idosch@...dia.com>, <mlxsw@...dia.com>
Subject: Re: [PATCH net-next v2 08/14] net: ipv6: ip6mr: Extract a helper
out of ip6mr_forward2()
Jakub Kicinski <kuba@...nel.org> writes:
> On Thu, 12 Jun 2025 22:10:42 +0200 Petr Machata wrote:
>> -static int ip6mr_forward2(struct net *net, struct mr_table *mrt,
>> - struct sk_buff *skb, int vifi)
>> +static int ip6mr_prepare_xmit(struct net *net, struct mr_table *mrt,
>> + struct sk_buff *skb, int vifi)
>> {
>> struct vif_device *vif = &mrt->vif_table[vifi];
>> - struct net_device *indev = skb->dev;
>> struct net_device *vif_dev;
>> struct ipv6hdr *ipv6h;
>> struct dst_entry *dst;
>> @@ -2098,6 +2097,20 @@ static int ip6mr_forward2(struct net *net, struct mr_table *mrt,
>>
>> ipv6h = ipv6_hdr(skb);
>> ipv6h->hop_limit--;
>> + return 0;
>> +
>> +out_free:
>> + kfree_skb(skb);
>> + return -1;
>> +}
>
> ipmr_prepare_xmit() does not free the skb on error, and ip6mr_prepare_xmit()
> does. The v6 version does lead to slightly cleaner code, but I wonder
> if its worth the asymmetry ?
Hmm, yeah, I think I had them symmetrical originally, but the
ipmr_forward_offloaded() call didn't make sense in ipmr_prepare_xmit(),
and pulled the cleanup up as it went out to the caller.
I'll do the same in IPv6, it makes sense to keep them similar.
Powered by blists - more mailing lists