Virtualization Archive mirror
 help / color / mirror / Atom feed
From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
To: virtualization@lists.linux.dev
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: [PATCH vhost 0/5] virtio_net: introduce api to enable/disable premapped mode for sq
Date: Wed,  8 May 2024 10:23:26 +0800	[thread overview]
Message-ID: <20240508022331.63751-1-xuanzhuo@linux.alibaba.com> (raw)

As discussed:

http://lore.kernel.org/all/CACGkMEvq0No8QGC46U4mGsMtuD44fD_cfLcPaVmJ3rHYqRZxYg@mail.gmail.com

If virtio is in pre-mapped mode, the driver should manage the DMA info itself.

However, due to the indirect feature, the virtio-net driver may need to maintain
an excessive amount of DMA info. Therefore, we only enable pre-mapped mode for
the send queue (SQ) when af-xdp is bound to it. We have set a limit on the
amount of DMA info we manage. If the kernel stack or xdp tx/redirect attempts to
use more descriptors than this limit, virtnet_add_outbuf() will return an
-ENOMEM error. However, AF-XDP can continue working.

The last patch aims to demonstrate the logic of enabling pre-mapped mode when
af-xdp is bound to the SQ, and we can discuss it further.

Although the APIs are not used, this patch might belong in the final patch set
(virtio-net supports AF_XDP). But I hope the first four patches can be merged
first to reduce the number of patches in the final set.

Thanks.

Xuan Zhuo (5):
  virtio_ring: introduce vring_need_unmap_buffer
  virtio_ring: introduce dma map api for page
  virtio_ring: introduce virtqueue_dma_map_sg_attrs
  virtio_ring: virtqueue_set_dma_premapped() support to disable
  virtio_net: sq support premapped mode

 drivers/net/virtio_net.c     | 212 ++++++++++++++++++++++++++++++++++-
 drivers/virtio/virtio_ring.c | 118 ++++++++++++++++---
 include/linux/virtio.h       |  12 +-
 3 files changed, 319 insertions(+), 23 deletions(-)

--
2.32.0.3.g01195cf9f


             reply	other threads:[~2024-05-08  2:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08  2:23 Xuan Zhuo [this message]
2024-05-08  2:23 ` [PATCH vhost 1/5] virtio_ring: introduce vring_need_unmap_buffer Xuan Zhuo
2024-05-08  2:23 ` [PATCH vhost 2/5] virtio_ring: introduce dma map api for page Xuan Zhuo
2024-05-08  2:23 ` [PATCH vhost 3/5] virtio_ring: introduce virtqueue_dma_map_sg_attrs Xuan Zhuo
2024-05-08  2:23 ` [PATCH vhost 4/5] virtio_ring: virtqueue_set_dma_premapped() support to disable Xuan Zhuo
2024-05-08  2:23 ` [PATCH vhost 5/5] virtio_net: sq support premapped mode Xuan Zhuo

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=20240508022331.63751-1-xuanzhuo@linux.alibaba.com \
    --to=xuanzhuo@linux.alibaba.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=jasowang@redhat.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=virtualization@lists.linux.dev \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).