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=202412 header.b=KKx/d6+h; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 9938D5A061F for ; Tue, 28 Jan 2025 02:52:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202412; t=1738029115; bh=itoZcYDdV6p/hPDeDzwOSdkHJVBi8CHAfHff9SyZZtw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KKx/d6+h8UiKaHfFkUMWoqS/aBVVvjzsAR833pB9uZeJEqH3OgYGs7CdMKxAi9a+s zBQ5pd3q+Abh3NhWhSf/TyFvWAD5LQs0rNCvlNzir+r7Csrod3eDw6XdPoRSE21HUV KKHnBFkdFNHPIuUNyR/01MOdVi+KsjGrB4ES3Y7q87suBIcsFf+xUAvGKl+NFr9Aon TfRw/263mrvW/AThDEoeOvelorRJimdzUylWR19csuh4m4I581HyWhws+fdAE2bofa cl2rL5idpzNoDoghdtgEaM2rP7q6k5uQMbtl3wzujSeXVgV5QGjVsNUpJdVRkrMCtP gZGzME5r/Sfig== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4YhpDq6s7Hz4wvd; Tue, 28 Jan 2025 12:51:55 +1100 (AEDT) Date: Tue, 28 Jan 2025 11:50:57 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 2/7] flow, flow_table: Pad flow table entries to 128 bytes, hash entries to 32 bits Message-ID: References: <20250127231532.672363-1-sbrivio@redhat.com> <20250127231532.672363-3-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="34EVK83enwO2ILqc" Content-Disposition: inline In-Reply-To: <20250127231532.672363-3-sbrivio@redhat.com> Message-ID-Hash: SDHVQAWEM3MDZBP37JGLW7YDLUDCSD4C X-Message-ID-Hash: SDHVQAWEM3MDZBP37JGLW7YDLUDCSD4C 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, Laurent Vivier 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: --34EVK83enwO2ILqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 28, 2025 at 12:15:27AM +0100, Stefano Brivio wrote: > ...to keep migration sane. Right now, the biggest struct in union flow > is struct tcp_splice_conn with 120 bytes on x86_64, which should also > have the biggest storage and alignment requirements of any > architecture we might run on. Necessary for the current "copy the entire table as a blob" approach. As I've noted, I think that will be fragile, but we can revisit this change when/if we figure out a different way to handle the table as a whole. >=20 > Signed-off-by: Stefano Brivio > --- > flow.h | 18 ++++++++++++------ > flow_table.h | 13 ++++++++++--- > 2 files changed, 22 insertions(+), 9 deletions(-) >=20 > diff --git a/flow.h b/flow.h > index 24ba3ef..8eb5964 100644 > --- a/flow.h > +++ b/flow.h > @@ -202,15 +202,21 @@ struct flow_common { > =20 > /** > * struct flow_sidx - ID for one side of a specific flow > - * @sidei: Index of side referenced (0 or 1) > - * @flowi: Index of flow referenced > + * @sidei: Index of side referenced (0 or 1) > + * @flowi: Index of flow referenced > + * @flow_sidx_storage: Pad to 32 bits > */ > typedef struct flow_sidx { > - unsigned sidei :1; > - unsigned flowi :FLOW_INDEX_BITS; > + union { > + struct { > + unsigned sidei :1; > + unsigned flowi :FLOW_INDEX_BITS; > + }; > + uint32_t flow_sidx_storage; > + }; > } flow_sidx_t; > -static_assert(sizeof(flow_sidx_t) <=3D sizeof(uint32_t), > - "flow_sidx_t must fit within 32 bits"); > +static_assert(sizeof(flow_sidx_t) =3D=3D sizeof(uint32_t), > + "flow_sidx_t must be 32-bit wide"); > =20 > #define FLOW_SIDX_NONE ((flow_sidx_t){ .flowi =3D FLOW_MAX }) > =20 > diff --git a/flow_table.h b/flow_table.h > index f15db53..007f4dd 100644 > --- a/flow_table.h > +++ b/flow_table.h > @@ -26,9 +26,13 @@ struct flow_free_cluster { > =20 > /** > * union flow - Descriptor for a logical packet flow (e.g. connection) > - * @f: Fields common between all variants > - * @tcp: Fields for non-spliced TCP connections > - * @tcp_splice: Fields for spliced TCP connections > + * @f: Fields common between all variants > + * @free: Entry in a cluster of free entries > + * @tcp: Fields for non-spliced TCP connections > + * @tcp_splice: Fields for spliced TCP connections > + * @ping: Tracking for ping flows > + * @udp: Tracking for UDP flows > + * @flow_storage: Pad flow entries to 128 bytes to ease state migration > */ > union flow { > struct flow_common f; > @@ -37,8 +41,11 @@ union flow { > struct tcp_splice_conn tcp_splice; > struct icmp_ping_flow ping; > struct udp_flow udp; > + char flow_storage[128]; > }; > =20 > +static_assert(sizeof(union flow) =3D=3D 128, "union flow should be 128-b= yte wide"); > + > /* Global Flow Table */ > extern unsigned flow_first_free; > extern union flow flowtab[]; --=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 --34EVK83enwO2ILqc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmeYKfAACgkQzQJF27ox 2GcTaxAAo8yzblSHyFrMvpWMOLskuHH+3IcfaDZV2udfswko2Fyq75MMuwEliJ2a z6PqzElL7uWABbK8mJUVoLXKXdCWhEQLnEiBcveWSlG3U83N2c9FVBD8YRVwK+AM oVSXb7zAQ+JXX3I2ZFSXRSiVody+6O8reluo2FEI+t8Ngxsj73ypz4MSvCJA6NYN kzrq7oD7HZ1V5ebfv80SGsWMuQ3+BCDRA3KxD8SEW/W0Ah+9IbDTqcHc7Bt4+1dE d9AsAI6k5w/+fs1bGSQ28hqjHzJa1h7xMXgLirmoj/HfM25uz5hCYf0L5OlwodIS RhZD9yssMQfdlFEkFYsLDtyEnpFV63y4jnamXMr/ybol7ilnG8EYoykk7kMrJymZ 7S0mBuvLcd7q3/ddAKlmOb8TxO1u1t+FwIdTX54VcVOcep0iWyY7ltPaNdFyTg9F Nh3TYDfAotISivGVuRcMR0mOUOr7pOduX1o04sRMHAefkUiYyiusEjxTN4m7VgmM FtKAvmvxgP//4gMLUwYxmmGykWX+S+3OpG5eXJWgZcvdAP1GMqHVYZIvHh0UNqPQ JIsVm4JRChxeySHwMXhZ5Xf07EeXGSXHxFx87KAp7CTrjigXwfJeMK1Xv0ZFcIek w04CwCIRdsqAEpcl2glzgOSazcLb5ucV8h6N+xqeP5zbVzSnfy4= =95Hc -----END PGP SIGNATURE----- --34EVK83enwO2ILqc--