[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <67a01e615bdb1_3c12af2942f@willemb.c.googlers.com.notmuch>
Date: Sun, 02 Feb 2025 20:39:45 -0500
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>,
Marcus Wichelmann <marcus.wichelmann@...zner-cloud.de>,
Stanislav Fomichev <stfomichev@...il.com>
Cc: netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
bpf@...r.kernel.org,
willemdebruijn.kernel@...il.com,
jasowang@...hat.com,
andrew+netdev@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
ast@...nel.org,
daniel@...earbox.net,
hawk@...nel.org,
john.fastabend@...il.com
Subject: Re: [PATCH 1/1] net: tun: add XDP metadata support
> > >> + metasize = metasize > 0 ? metasize : 0;
> > >
> > > Why is this part needed?
> >
> > When an xdp_buff was initialized withouth metadata support (meta_valid
> > argument of xdp_prepare_buff is false), then data_meta == data + 1.
> > So this check makes sure that metadata was supported for the given xdp_buff
> > and metasize is not -1 (data - data_meta).
> >
> > But you have a good point here: Because we have control over the
> > initialization of xdp_buff in the tun_build_skb function (first code path),
> > we know, that metadata is always supported for that buffer and metasize
> > is never < 0. So this check is redundant and I'll remove it.
> >
> > But in the tun_xdp_one function (second code path), I'd prefer to keep that
> > check, as the xdp_buff is externally passed to tun_sendmsg and the tun driver
> > should probably not make assumptions about the metadata support of buffers
> > created by other drivers (e.g. vhost_net).
> >
> > Thank you for taking a look, I hope things are more clear now.
>
> Please use min()
>
Err.. max.
Powered by blists - more mailing lists