From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v5 4/4] vhost-user: add vhost-user
Date: Mon, 23 Sep 2024 13:59:51 +1000 [thread overview]
Message-ID: <ZvDnt3e1u_9KKnfl@zatzit.fritz.box> (raw)
In-Reply-To: <e19499b7-a9ab-4e47-a5dc-cd0f26b0afae@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2219 bytes --]
On Tue, Sep 17, 2024 at 12:03:13PM +0200, Laurent Vivier wrote:
> On 16/09/2024 09:00, David Gibson wrote:
> > > --- a/tap.c
> > > +++ b/tap.c
> > > @@ -58,6 +58,7 @@
> > > #include "packet.h"
> > > #include "tap.h"
> > > #include "log.h"
> > > +#include "vhost_user.h"
> > > /* IPv4 (plus ARP) and IPv6 message batches from tap/guest to IP handlers */
> > > static PACKET_POOL_NOINIT(pool_tap4, TAP_MSGS, pkt_buf);
> > > @@ -78,16 +79,22 @@ void tap_send_single(const struct ctx *c, const void *data, size_t l2len)
> > > struct iovec iov[2];
> > > size_t iovcnt = 0;
> > > - if (c->mode == MODE_PASST) {
> > > + switch (c->mode) {
> > > + case MODE_PASST:
> > > iov[iovcnt] = IOV_OF_LVALUE(vnet_len);
> > > iovcnt++;
> > > - }
> > > -
> > > - iov[iovcnt].iov_base = (void *)data;
> > > - iov[iovcnt].iov_len = l2len;
> > > - iovcnt++;
> > > + /* fall through */
> > > + case MODE_PASTA:
> > > + iov[iovcnt].iov_base = (void *)data;
> > > + iov[iovcnt].iov_len = l2len;
> > > + iovcnt++;
> > > - tap_send_frames(c, iov, iovcnt, 1);
> > > + tap_send_frames(c, iov, iovcnt, 1);
> > > + break;
> > > + case MODE_VU:
> > > + vu_send(c->vdev, data, l2len);
> > I'm a bit uneasy re-introducing a parallel send function for the slow
> > path, rather than using a common tap_send_frames() interface. Any
> > chance you can unify those sensibly? Bearing in mind that this_is_
> > the slow path, so if you have to copy a bunch of stuff, that's ok.
>
> I tried but it's over complicated to take in input an iovec array and to use
> another iovec array (provided by the guest) to send data. It's easier to
> have a buffer and to copy it to the iovec array buffers of the guest.
> Moreover we don't need to have a tap_send_frames_vu() (see vu_handle_tx()),
> so we will introduce it to always send an iovec array with only one entry.
Oh, ok. IIUC you're saying that both this path and the "main" path go
through vu_send(), in which case this is fine.
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-09-23 4:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 16:20 [PATCH v5 0/4] Add vhost-user support to passt. (part 3) Laurent Vivier
2024-09-13 16:20 ` [PATCH v5 1/4] packet: replace struct desc by struct iovec Laurent Vivier
2024-09-13 16:20 ` [PATCH v5 2/4] vhost-user: introduce virtio API Laurent Vivier
2024-09-13 16:20 ` [PATCH v5 3/4] vhost-user: introduce vhost-user API Laurent Vivier
2024-09-13 16:20 ` [PATCH v5 4/4] vhost-user: add vhost-user Laurent Vivier
2024-09-16 7:00 ` David Gibson
2024-09-17 10:03 ` Laurent Vivier
2024-09-23 3:59 ` David Gibson [this message]
2024-09-19 13:51 ` Stefano Brivio
2024-09-23 4:11 ` David Gibson
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=ZvDnt3e1u_9KKnfl@zatzit.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=passt-dev@passt.top \
/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.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
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 IMAP folder(s).