From: Paolo Abeni <pabeni@redhat.com>
To: Liang Chen <liangchen.linux@gmail.com>,
Jesper Dangaard Brouer <hawk@kernel.org>
Cc: mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
hengqi@linux.alibaba.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, netdev@vger.kernel.org,
virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, john.fastabend@gmail.com,
daniel@iogearbox.net, ast@kernel.org
Subject: Re: [PATCH net-next v5] virtio_net: Support RX hash XDP hint
Date: Tue, 06 Feb 2024 11:43:58 +0100 [thread overview]
Message-ID: <5297dad6499f6d00f7229e8cf2c08e0eacb67e0c.camel@redhat.com> (raw)
In-Reply-To: <CAKhg4tJFpG5nUNdeEbXFLonKkFUP0QCh8A9CpwU5OvtnBuz4Sw@mail.gmail.com>
On Sat, 2024-02-03 at 10:56 +0800, Liang Chen wrote:
> On Sat, Feb 3, 2024 at 12:20 AM Jesper Dangaard Brouer <hawk@kernel.org> wrote:
> > On 02/02/2024 13.11, Liang Chen wrote:
[...]
> > > @@ -1033,6 +1039,16 @@ static void put_xdp_frags(struct xdp_buff *xdp)
> > > }
> > > }
> > >
> > > +static void virtnet_xdp_save_rx_hash(struct virtnet_xdp_buff *virtnet_xdp,
> > > + struct net_device *dev,
> > > + struct virtio_net_hdr_v1_hash *hdr_hash)
> > > +{
> > > + if (dev->features & NETIF_F_RXHASH) {
> > > + virtnet_xdp->hash_value = hdr_hash->hash_value;
> > > + virtnet_xdp->hash_report = hdr_hash->hash_report;
> > > + }
> > > +}
> > > +
> >
> > Would it be possible to store a pointer to hdr_hash in virtnet_xdp_buff,
> > with the purpose of delaying extracting this, until and only if XDP
> > bpf_prog calls the kfunc?
> >
>
> That seems to be the way v1 works,
> https://lore.kernel.org/all/20240122102256.261374-1-liangchen.linux@gmail.com/
> . But it was pointed out that the inline header may be overwritten by
> the xdp prog, so the hash is copied out to maintain its integrity.
Why? isn't XDP supposed to get write access only to the pkt
contents/buffer?
if the XDP program can really change the virtio_net_hdr, that looks
potentially dangerous/bug prone regardless of this patch.
Thanks,
Paolo
next prev parent reply other threads:[~2024-02-06 10:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 12:11 [PATCH net-next v5] virtio_net: Support RX hash XDP hint Liang Chen
2024-02-02 16:19 ` Jesper Dangaard Brouer
2024-02-03 2:56 ` Liang Chen
2024-02-06 10:43 ` Paolo Abeni [this message]
2024-02-07 2:54 ` Liang Chen
2024-02-07 14:27 ` Paolo Abeni
2024-02-09 10:39 ` Liang Chen
2024-02-09 12:57 ` Paolo Abeni
2024-02-22 20:09 ` Michael S. Tsirkin
2024-02-23 1:37 ` Xuan Zhuo
2024-02-26 4:59 ` Jason Wang
2024-02-26 20:42 ` John Fastabend
2024-02-29 8:37 ` Liang Chen
2024-04-01 3:38 ` Liang Chen
2024-04-08 6:41 ` Jason Wang
2024-04-11 6:09 ` Liang Chen
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=5297dad6499f6d00f7229e8cf2c08e0eacb67e0c.camel@redhat.com \
--to=pabeni@redhat.com \
--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=hengqi@linux.alibaba.com \
--cc=jasowang@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=liangchen.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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).