From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id B0E395A02EB for ; Wed, 1 May 2024 04:54:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1714532080; bh=ir1He65gl/2iY8T+RFevgppVMg715fP+lFdQSXwjH4A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZBKQC6tzqyaXun0t6m17VaMaEmv3vMCGBph+eO/JMy1ii87ezTWrCFk3Pmt4B/f3V hSISy5TT3fmfYit64SY8GDxLQe9I27srpfloK71iFkW0V1p3WoAqg1cw0+tELyP6Uu rAo1Wi+AleBXPmDag3MSgVrJBPkqeFMOjF16UZcDPom393JcqjW0GtSG37OazUDUqq lTufwAhWWxQeH8p0QUWsMfJ5RWQu0HqHWO8nVGoPLmJDmL6kELJ+AZpfLaxpEmhA6Y 3dvrx/MLrvXdbbA8RBP4q48kjBjhP63L2f26ngYOkO9oxPuEKQp+h2+pdR4d+JVokt BdPYniLMdsuXA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4VThVm4n57z4x0w; Wed, 1 May 2024 12:54:40 +1000 (AEST) Date: Wed, 1 May 2024 12:35:15 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 2/7] udp: Split tap-bound UDP packets into multiple buffers using io vector Message-ID: References: <20240430100541.381350-1-david@gibson.dropbear.id.au> <20240430100541.381350-3-david@gibson.dropbear.id.au> <20240430221534.70dc88ef@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="raW6qEQWPGyz15H5" Content-Disposition: inline In-Reply-To: <20240430221534.70dc88ef@elisabeth> Message-ID-Hash: YZN5RMDSZXG6CADTQBW6DCYBSLQOPLDO X-Message-ID-Hash: YZN5RMDSZXG6CADTQBW6DCYBSLQOPLDO 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: --raW6qEQWPGyz15H5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 30, 2024 at 10:15:34PM +0200, Stefano Brivio wrote: > On Tue, 30 Apr 2024 20:05:36 +1000 > David Gibson wrote: >=20 > > When sending to the tap device, currently we assemble the headers and > > payload into a single contiguous buffer. Those are described by a sing= le > > struct iovec, then a batch of frames is sent to the device with > > tap_send_frames(). > >=20 > > In order to better integrate the IPv4 and IPv6 paths, we want the IP > > header in a different buffer that might not be contiguous with the > > payload. To prepare for that, split the UDP packet into an iovec of > > buffers. We use the same split that Laurent recently introduced for > > TCP for convenience. > >=20 > > This removes the last use of tap_hdr_len_(), tap_frame_base() and > > tap_frame_len(), so remove those too. > >=20 > > Signed-off-by: David Gibson > > --- > > tap.h | 38 ------------------------------ > > udp.c | 74 +++++++++++++++++++++++++++++++++++++++-------------------- > > 2 files changed, 49 insertions(+), 63 deletions(-) > >=20 > > diff --git a/tap.h b/tap.h > > index 75aa3f03..754703d2 100644 > > --- a/tap.h > > +++ b/tap.h > > @@ -43,44 +43,6 @@ static inline void tap_hdr_update(struct tap_hdr *th= dr, size_t l2len) > > thdr->vnet_len =3D htonl(l2len); > > } > > =20 > > -static inline size_t tap_hdr_len_(const struct ctx *c) > > -{ > > - if (c->mode =3D=3D MODE_PASST) > > - return sizeof(struct tap_hdr); > > - else > > - return 0; > > -} > > - > > -/** > > - * tap_frame_base() - Find start of tap frame > > - * @c: Execution context > > - * @taph: Pointer to tap specific header buffer > > - * > > - * Returns: pointer to the start of tap frame - suitable for an > > - * iov_base to be passed to tap_send_frames()) > > - */ > > -static inline void *tap_frame_base(const struct ctx *c, struct tap_hdr= *taph) > > -{ > > - return (char *)(taph + 1) - tap_hdr_len_(c); > > -} > > - > > -/** > > - * tap_frame_len() - Finalize tap frame and return total length > > - * @c: Execution context > > - * @taph: Tap header to finalize > > - * @plen: L2 packet length (includes L2, excludes tap specific headers) > > - * > > - * Returns: length of the tap frame including tap specific headers - s= uitable > > - * for an iov_len to be passed to tap_send_frames() > > - */ > > -static inline size_t tap_frame_len(const struct ctx *c, struct tap_hdr= *taph, > > - size_t plen) > > -{ > > - if (c->mode =3D=3D MODE_PASST) > > - taph->vnet_len =3D htonl(plen); > > - return plen + tap_hdr_len_(c); > > -} > > - > > struct in_addr tap_ip4_daddr(const struct ctx *c); > > void tap_udp4_send(const struct ctx *c, struct in_addr src, in_port_t = sport, > > struct in_addr dst, in_port_t dport, > > diff --git a/udp.c b/udp.c > > index 545212c5..4650b366 100644 > > --- a/udp.c > > +++ b/udp.c > > @@ -222,12 +222,28 @@ struct udp6_l2_buf_t { > > #endif > > udp6_l2_buf[UDP_MAX_FRAMES]; > > =20 > > +/** > > + * enum udp_iov_idx - Indices for the buffers making up a single UDP f= rame > > + * @UDP_IOV_TAP TAP specific header >=20 > Nits: s/TAP/tap/ and >=20 > > + * @UDP_IOV_ETH ethernet header >=20 > s/ethernet/Ethernet. Amended, thanks. --=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 --raW6qEQWPGyz15H5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmYxqlQACgkQzQJF27ox 2Gevhg//XREEFXaOeIYXkcr33v1DtKO/1GpDCNxivA0rJqMIMXBPJCreBAlIC6oV YtgeEsNovYXRuCUrb3A/yDYXRHGTrBCYGkdixIMNmFUUV20css2qAoCXs1cw8cX5 mIIq8YsohE91XMFgEYKU8vt3Mc3xM2cigRldKAzg+xgbHpvBipkbqfTQzU5gyXAM T+6a/QubuFTCdcttyYu5TjgVFRLV5HoR+BrtD7wGzRz5gIK6OupvPE/9uB2NIPZe MEsvr9rPug58Q6w+PJUQojpT7s4zxHQ52P3xmt5v/ZvtwZ8rDl932AzngElnXiuy p1qYq3VEhAyU0L4RwecuQKbXsDR5tm7PKa+9gv8qg0I7jQUr/ADf6sW56JqvKZwD MELCLEGSZdVS5AnaiSc5vZQXfGc51xt3R8O+7d+oozC6KcxGSTEx5miUuFa7mT9H z73ZOTfRsIWhdowJbCjNu0s3mBLTZHsUxqoxuZIBLrWmNViHXrF+6nXxISRu+kle wyWN9i1JpsD9BM9QMl/1U5370eVzeSWNSuadlDr4NuKL5owe1W2Itjz8Yfpu4pLz 6bBjQVm2iI6/xPtWGYRg9vqsnhfiPMwXkpftM0AeF3yVgwSEiwKHepZsAI2mHTWZ cLg4+2Aml/mcmgBXLJFdvdxqsMvmed7lWObPEQrQvSmafoWrY6I= =QI+1 -----END PGP SIGNATURE----- --raW6qEQWPGyz15H5--