lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1697786208.7535846-1-xuanzhuo@linux.alibaba.com>
Date: Fri, 20 Oct 2023 15:16:48 +0800
From: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
To: Jason Wang <jasowang@...hat.com>
Cc: netdev@...r.kernel.org,
 "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>,
 Paolo Abeni <pabeni@...hat.com>,
 "Michael S. Tsirkin" <mst@...hat.com>,
 Alexei Starovoitov <ast@...nel.org>,
 Daniel Borkmann <daniel@...earbox.net>,
 Jesper Dangaard Brouer <hawk@...nel.org>,
 John Fastabend <john.fastabend@...il.com>,
 virtualization@...ts.linux-foundation.org,
 bpf@...r.kernel.org
Subject: Re: [PATCH net-next v1 08/19] virtio_net: sq support premapped mode

On Fri, 20 Oct 2023 14:50:52 +0800, Jason Wang <jasowang@...hat.com> wrote:
> On Mon, Oct 16, 2023 at 8:01 PM Xuan Zhuo <xuanzhuo@...ux.alibaba.com> wrote:
> >
> > If the xsk is enabling, the xsk tx will share the send queue.
> > But the xsk requires that the send queue use the premapped mode.
> > So the send queue must support premapped mode.
> >
> > Signed-off-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
> > ---
> >  drivers/net/virtio/main.c       | 108 ++++++++++++++++++++++++++++----
> >  drivers/net/virtio/virtio_net.h |  54 +++++++++++++++-
> >  2 files changed, 149 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/net/virtio/main.c b/drivers/net/virtio/main.c
> > index 8da84ea9bcbe..02d27101fef1 100644
> > --- a/drivers/net/virtio/main.c
> > +++ b/drivers/net/virtio/main.c
> > @@ -514,20 +514,104 @@ static void *virtnet_rq_alloc(struct virtnet_rq *rq, u32 size, gfp_t gfp)
> >         return buf;
> >  }
> >
> > -static void virtnet_rq_set_premapped(struct virtnet_info *vi)
> > +static int virtnet_sq_set_premapped(struct virtnet_sq *sq)
> >  {
> > -       int i;
> > +       struct virtnet_sq_dma *d;
> > +       int err, size, i;
> >
> > -       /* disable for big mode */
> > -       if (!vi->mergeable_rx_bufs && vi->big_packets)
> > -               return;
>
> Not specific to this patch but any plan to fix the big mode?
>


For big, we should make it support XDP and do dma first.


>
> > +       size = virtqueue_get_vring_size(sq->vq);
> > +
> > +       size += MAX_SKB_FRAGS + 2;
> > +
> > +       sq->dmainfo.head = kcalloc(size, sizeof(*sq->dmainfo.head), GFP_KERNEL);
> > +       if (!sq->dmainfo.head)
> > +               return -ENOMEM;
> > +
> > +       err = virtqueue_set_dma_premapped(sq->vq);
> > +       if (err) {
> > +               kfree(sq->dmainfo.head);
> > +               return err;
> > +       }
> > +
> > +       sq->dmainfo.free = NULL;
> > +

[...]

> > +
> > +               d->addr = sg->dma_address;
> > +               d->len = sg->length;
> > +
> > +               d->next = head;
> > +               head = d;
>
> It's really a pity that we need to duplicate those DMA metata twice.
> Could we invent a new API to just fetch it from the virtio core?

Actually, I posted that patch.

Consider this is pushing to net-next. We can do that on top.


>
> > +       }
> > +
> > +       head->data = data;
> > +
> > +       return (void *)((unsigned long)head | ((unsigned long)data & VIRTIO_XMIT_DATA_MASK));
>
> If we packed everything into dmainfo, we can leave the type (XDP vs
> skb) there to avoid trick like packing it into the pointer here?

Yes. But if the virtio has not _ACCESS_PLATFORM, the driver will
has not the DMA meta data.

Thanks.


>
> Thanks
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ