From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 250155A0275 for ; Fri, 8 Mar 2024 13:42:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1709901753; bh=TKHzk4dEI6+eI+xCxMJu4HEIQE3+SZj9iUajocoVuqQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=g1Wnxaek2RDhnWMgE0216z7IMtpv88EHHd8T9dJYXGtJl0F7yDcLbiW5aI7gmVyRk EoH7tmgMtWQ7CQpBNub/akXP3Al9GQhznDm1dm6P1Af3OPVRmfXnO0vCKGbOgHr9Lw WBXhSAZq14Am6FTfwDkZics1VhJ56ost3XJm7sUe6Nd81ah2FTiEV/scy+ffpmOukK /Cn223/292xIQup6NmkMqf6hcM+zB3HEY3RgQj0PrCkw8uEKrOibKeW+Bdh7aEMJMU QlzO7a7AOwGQf0sydBXjlvS/GQzp37pzfbmdQtPOY+kHIMmq1Kdo9yC1Vyba8vW1W8 GEVsFBk5hL4tQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Trm616V2fz4wcl; Fri, 8 Mar 2024 23:42:33 +1100 (AEDT) Date: Fri, 8 Mar 2024 23:42:28 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH 0/4] Some improvements to the tap send path Message-ID: References: <20240308065325.2181322-1-david@gibson.dropbear.id.au> <348a52c9-7c07-4150-b594-4743c7775be6@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GdQ0BYV6/VrcL/xI" Content-Disposition: inline In-Reply-To: <348a52c9-7c07-4150-b594-4743c7775be6@redhat.com> Message-ID-Hash: TWKTYIP322NNIKXNLLPB7OBRLYUBVB62 X-Message-ID-Hash: TWKTYIP322NNIKXNLLPB7OBRLYUBVB62 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: Stefano Brivio , 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: --GdQ0BYV6/VrcL/xI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 08, 2024 at 09:18:48AM +0100, Laurent Vivier wrote: > On 3/8/24 07:53, David Gibson wrote: > > This series has a handful of small improvements to the tap send path. > > See individual commit messages for the details. > >=20 > > I expect this will conflict with Laurent's upcoming work. I hope the > > conflicts won't be too bad, and indeed will set us up for less > > duplication there in the end. >=20 > I'm working on patch that devides TCP buffers in several buffers pointed = out > by an IOV arrays and then provided to tap_send_frames(). I'm going to base > my patch on this series. >=20 > The idea is: >=20 > A frame is made with 4 iovecs: >=20 > #define TCP_IOV_VNET 0 > #define TCP_IOV_ETH 1 > #define TCP_IOV_IP 2 > #define TCP_IOV_PAYLOAD 3 > #define TCP_IOV_NUM 4 > typedef struct iovec tap_iovec_t[TCP_IOV_NUM]; General concept seems good. Unless you have a specific reason to do so, I'd suggest keeping VNET and ETH - i.e. L2 and everything below it - together. As well as just making one less buffer for each frame, I think that will make life easier if we want to add an L2 interface with non-Ethernet framing (e.g. "tun" instead of "tap"). >=20 > The payload can be TCP + data or TCP + flags: >=20 > struct tcp_l2_flags_t { > struct tcphdr th; > char opts[OPT_MSS_LEN + OPT_WS_LEN + 1]; > }; >=20 > struct tcp_l2_payload_t { > struct tcphdr th; /* 20 bytes */ > uint8_t data[MSS]; /* 65516 bytes */ > #ifdef __AVX2__ > } __attribute__ ((packed, aligned(32))); > #else > } __attribute__ ((packed, aligned(__alignof__(unsigned int)))); > #endif Not sure if we'd be better off with this approach, or having both IP and L4 headers together, and the L4 payload in another. The latter would mean duplicating the TCP or UDP headers between the IPv4 and IPv6 cases, but it allows the data buffers - which will be used directly on the socket side. --=20 David Gibson | 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 --GdQ0BYV6/VrcL/xI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXrB40ACgkQzQJF27ox 2GcghA/+N0k4rDktobnAr0fIStlqtSTK3BOx/kG+Fg7dO9H/yAffjOe5jL9wfJ8O FL/p7ZGRSieCDmtEdVk1G+l0pBMPO43ER/U1evgAOwUHey5ffs2Kv4bxwPiMg7Kf aEqI8OJpbTcCRxkhz0v6yVMonBPMcUiycFEM6N7SUZIPOK3ElgWrcVIevIYG4eQm UpR3QTM3T+Od2o/1r4019yetWZ+B3t2S4nn4SJe7WBk/cg4rGMbb+rsLdipmqS7n SpvOEFOkNG35O0Lt1L2QpmeoFYYsdeO2E+ExODIgdzJvmVf1VtSFUcOrtrsnpE6Q zTwybXSIDGg0X+tww7z3T61b6xJVIMa//o+18D3p2OhxWkE6H2ot7oAX391BHE/Q sjhnjFh11UUfcK93F5wmUeU5nnem6S2pbnVetw3LXjXThV7hPTaGQlfSTQj4qvJa doRWiBbW+UAP0jTdQz/Yl9O+zcbSQuLASaF3dxa4PJrmdROUEkOa76K1vkQWaVAB QtBFMwiyCKwjxDCmSdGKjQZbA26aAAkNeVxvNYjgOuCNsarNcdOYZ2czJXJaIKsk Hbj+kQmvYmux/l7SyLI0PIIiT+4hrF6DyhkZwJpYhQLsbplqS8ynS4fCy5LvI2v3 1nsol05BHvIF8dK/hR07nFOC/yW6mNdIs4Juh/aKUKgvC0sgK7k= =jPLq -----END PGP SIGNATURE----- --GdQ0BYV6/VrcL/xI--