public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v5 4/4] vhost-user: add vhost-user
Date: Tue, 17 Sep 2024 12:03:13 +0200	[thread overview]
Message-ID: <e19499b7-a9ab-4e47-a5dc-cd0f26b0afae@redhat.com> (raw)
In-Reply-To: <ZufXcI-ud5nheZrO@zatzit.fritz.box>

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.

Thanks,
Laurent


  reply	other threads:[~2024-09-17 10:03 UTC|newest]

Thread overview: 8+ 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 [this message]
2024-09-19 13:51   ` Stefano Brivio

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=e19499b7-a9ab-4e47-a5dc-cd0f26b0afae@redhat.com \
    --to=lvivier@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --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).