netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	 Marcus Wichelmann <marcus.wichelmann@hetzner-cloud.de>,
	 Stanislav Fomichev <stfomichev@gmail.com>
Cc: netdev@vger.kernel.org,  linux-kernel@vger.kernel.org,
	 bpf@vger.kernel.org,  willemdebruijn.kernel@gmail.com,
	 jasowang@redhat.com,  andrew+netdev@lunn.ch,
	 davem@davemloft.net,  edumazet@google.com,  kuba@kernel.org,
	 pabeni@redhat.com,  ast@kernel.org,  daniel@iogearbox.net,
	 hawk@kernel.org,  john.fastabend@gmail.com
Subject: Re: [PATCH 1/1] net: tun: add XDP metadata support
Date: Sun, 02 Feb 2025 20:39:45 -0500	[thread overview]
Message-ID: <67a01e615bdb1_3c12af2942f@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <67a01caec79d1_3bbd8e29416@willemb.c.googlers.com.notmuch>

> > >> +		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.

      reply	other threads:[~2025-02-03  1:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30 17:16 [PATCH 0/1] XDP metadata support for tun driver Marcus Wichelmann
2025-01-30 17:16 ` [PATCH 1/1] net: tun: add XDP metadata support Marcus Wichelmann
2025-01-30 23:16   ` Stanislav Fomichev
2025-01-31 14:25     ` Marcus Wichelmann
2025-02-01  3:39       ` Stanislav Fomichev
2025-02-03  1:32       ` Willem de Bruijn
2025-02-03  1:39         ` Willem de Bruijn [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=67a01e615bdb1_3c12af2942f@willemb.c.googlers.com.notmuch \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=jasowang@redhat.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcus.wichelmann@hetzner-cloud.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stfomichev@gmail.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;
as well as URLs for NNTP newsgroup(s).