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 8E43E5A0272 for ; Tue, 6 Feb 2024 01:50:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1707180641; bh=W2pc60L1ee6s8WIpiVUhPPSlvJzux87OAbE0MkdIZ3k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o6TSl6RI+5Do7epXERM1b9xujgdMLZ4MHbqszumhNsl5XcbOxA3Hji3ZI0fNQIQ6Z de3Hy789qRfsxlNA/EVscr31G+KM0yf9H0q+7UWI2TWXr4bCsyV/4r758ugGaJoA16 /ryY9pTd/Gy/izEBViPnXHad94+/4wTIyOIC5N6mCpAYkcErRVTz3HW1718oqAsMlT KH/f6FOM1Kb/vvI8VOnZLptVxaBrr6yPSBMupWxG833ELFzAwUxemcNqgfKlCrZJGW CFSGvf+w/vqwOhzt/3z80+YzNc5PQcONDYJdFCTtmIa4NuZ4OpeA2ZmptOw0/7dx3D EqNrJzV6HK/yw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TTPmx0Hjjz4wp3; Tue, 6 Feb 2024 11:50:41 +1100 (AEDT) Date: Tue, 6 Feb 2024 11:47:32 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH 09/24] tcp: extract buffer management from tcp_conn_tap_mss() Message-ID: References: <20240202141151.3762941-1-lvivier@redhat.com> <20240202141151.3762941-10-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NblWIvbovvq8JJ7V" Content-Disposition: inline In-Reply-To: <20240202141151.3762941-10-lvivier@redhat.com> Message-ID-Hash: ZMQLJM5ZZLDHVWXPCI7BZFEERC4SH6DJ X-Message-ID-Hash: ZMQLJM5ZZLDHVWXPCI7BZFEERC4SH6DJ 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: --NblWIvbovvq8JJ7V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 02, 2024 at 03:11:36PM +0100, Laurent Vivier wrote: Even more than the previous patch, this doesn't really seem like "buffer management" to me. I'd say rather that this is extracting maximum mss calculation into a helper. > Signed-off-by: Laurent Vivier > --- > tcp.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) >=20 > diff --git a/tcp.c b/tcp.c > index 20ad8a4e5271..cdbceed65033 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -1813,6 +1813,14 @@ int tcp_conn_new_sock(const struct ctx *c, sa_fami= ly_t af) > return s; > } > =20 Function comment. > +static uint16_t tcp_buf_conn_tap_mss(const struct tcp_tap_conn *conn) > +{ > + if (CONN_V4(conn)) > + return MSS4; > + > + return MSS6; > +} > + > /** > * tcp_conn_tap_mss() - Get MSS value advertised by tap/guest > * @conn: Connection pointer > @@ -1832,10 +1840,7 @@ static uint16_t tcp_conn_tap_mss(const struct tcp_= tap_conn *conn, > else > mss =3D ret; > =20 > - if (CONN_V4(conn)) > - mss =3D MIN(MSS4, mss); > - else > - mss =3D MIN(MSS6, mss); > + mss =3D MIN(tcp_buf_conn_tap_mss(conn), mss); > =20 > return MIN(mss, USHRT_MAX); > } --=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 --NblWIvbovvq8JJ7V Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXBgaMACgkQzQJF27ox 2Gdq5xAAkB82HtJJdjsIgcDtsSgdttGYdhCxuOvVKp0JqKPN5lVbmSIfz9xHIj9i iv4wzhO215ngRpB8cxU1ZQoJHkhpFgBgZepcNlF0LOLVoJ10UrhZemfnShnwqdCO v0TFKu91aT+zOTKLBLydwkrHDp9mEY3cM0LCRPG5MIFIU8eTk3z81OgQRENbF6OU 09RA2xP8mZeNDIbuMr3DN7PysbmUZ37BpiyOC8yhBc5Zd7nFMHsA8+3v0mDLuiyt dEI13101qq7RMtQ7nJFhIdmWYJxB8XiDJabrBcZCQ6Rlf5wrYPD721Fz5TYkDq5V BBDdQ7HOOC+SxLDkvJI2dXU1lhx62YT3oC3H/5S4W1Kv7Gp8Grzi8KAdtb9B31zR 5IuBtPFWbZWzHGdW/OcUOnIM6UrYhyeNp5OpiIPeMXgV5gQBpARs2b3bbQBHSpaq yxZ+KbDvsrBp1IqadRY0T/BlvR+G/qAOwCgapIHyuCqdNXtVk4mFHBvOcpwtbrEI oTZXGp5MEmPD5gT6hmAb1AiwkurnjKUkeJjc1Dd0uEK0LVVrVqWu8Svy1mB/crso 02pGLm1gR4pnpwnJRtgKM2Hw2/OXOhifst1oxRFlLYYVij5DNv8E+Y14ZHqlBlxX 8/hH/a1sghcUKkRnKZ+vF8GeoVFbcizxMZea/N5cMNhrqArFIbQ= =RHDx -----END PGP SIGNATURE----- --NblWIvbovvq8JJ7V--