From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202408 header.b=o5s/jHSg; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 8C76D5A004E for ; Mon, 23 Sep 2024 06:11:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202408; t=1727064705; bh=EkhIkm3nFOkfLerzH7p8ZcEntbnfkmDKmo7r9e+Mm5c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o5s/jHSgpS6Q3/Ia0BrKAgrv5I2vMUFmRJrfF/rMBc+251YL7jeDsfFm8H4xOIbOI uhgSnwVQowzLAPJFIkjszDiwuWLxgcjgKMe1bk7YUGAg+pyXQN6c8rO0JJFNylM4zD C5QPyQWauXGenyuIrUcynCPhTy3y6IpENARQGjMvccPLTqjxMe1mP9TsuNgoSbcsL8 KGsEOIJhVWevdl/qYdvn7s0F40dLvLhYApo2vbsHaGn8VU6qxE2N5C0WmUkAf373Kd tcaY1JPARX3xmR+sMmNaijnQUDLhHnnj6gJ4N1E5UUBLjXKqwpjCMKqwQhmOjjGkKy AinZm4rtTpRlA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4XBqLn0ksqz4x3p; Mon, 23 Sep 2024 14:11:45 +1000 (AEST) Date: Mon, 23 Sep 2024 13:59:51 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v5 4/4] vhost-user: add vhost-user Message-ID: References: <20240913162036.3635783-1-lvivier@redhat.com> <20240913162036.3635783-5-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pCTu6OtSWcNDp1ao" Content-Disposition: inline In-Reply-To: Message-ID-Hash: H6LS6NMG2TKMSXCUFBNO2VH24EC55YTY X-Message-ID-Hash: H6LS6NMG2TKMSXCUFBNO2VH24EC55YTY X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --pCTu6OtSWcNDp1ao Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 ha= ndlers */ > > > static PACKET_POOL_NOINIT(pool_tap4, TAP_MSGS, pkt_buf); > > > @@ -78,16 +79,22 @@ void tap_send_single(const struct ctx *c, const v= oid *data, size_t l2len) > > > struct iovec iov[2]; > > > size_t iovcnt =3D 0; > > > - if (c->mode =3D=3D MODE_PASST) { > > > + switch (c->mode) { > > > + case MODE_PASST: > > > iov[iovcnt] =3D IOV_OF_LVALUE(vnet_len); > > > iovcnt++; > > > - } > > > - > > > - iov[iovcnt].iov_base =3D (void *)data; > > > - iov[iovcnt].iov_len =3D l2len; > > > - iovcnt++; > > > + /* fall through */ > > > + case MODE_PASTA: > > > + iov[iovcnt].iov_base =3D (void *)data; > > > + iov[iovcnt].iov_len =3D 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. >=20 > 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. --=20 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 --pCTu6OtSWcNDp1ao Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmbw57cACgkQzQJF27ox 2Gc3Uw/9FHJxZ//JuOKQryZBYkHKPPpNNoi93XBYc6L8feMvT8gw0jt+57N9EdkY vlBmZykxDF1vy4megfvHEGJIc15dL8v+YnJ8bb6JOTS0pqITL/Voq/aDs1823Qv6 DHq8AOreGBNOc6nrqE1jI3aXdYQm5y3U5KXOcv1mMlZP1BcUWdMGLC31e82r3hex LmFIuIl5RjyXMGpr4/T1U9hADtuoT+ZmNDBD0usy3ywGaELOYJpgQsT8Ho9dvsuB APV/ixQFyGZqFJgLl00sBksLUf9ynpTOtXSufNOSYLdfNqb2D7ynwkL+ZLmMlRAM R5q1l/uxtywGOOKQ6vY6e+kSnq9YBQ5WZyQAJ5rNzOpCEBUtBmacW+ag1RnrBL0A Bfs8U2QwgLrt7Frh9NjmG2M0IKM47gvUtezQMVg+c34g+cPm5+PLiJR3MMn4kRFe nD+kNfyf2cAxVIzZJGyPNM7qU5d5DEgJs62mg1QQrpl8FbfnXu3GQx9I2Ao9KMTe 3yjexMGTdwG1+bOAS6bVLhQjsxaEIHiZixXAcugyU1W/7B+0EcpQjd+g2I84a3dd 1OGOVVXqpuT88Yo3LolPm4up4nPLLN1XH+cw/tgqAG9eJ8Ixpq7c9mHDU4O+rPeo xdxA4N59Ht5bZ/vHf9uXMZbKmUa9SYzD/TDBONXwc4iVK+nmsis= =0LNG -----END PGP SIGNATURE----- --pCTu6OtSWcNDp1ao--