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=mBgbvaAf; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 6226D5A0272 for ; Wed, 29 Jan 2025 05:01:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202412; t=1738123240; bh=OZBxEsGixe3QrsvVxdieNSxs6WOVubHp47X95c5L7Z0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mBgbvaAf3Su/ZZh0b1jHXB7jubHHqwqjiBYCCeFEZUll/gMLq0MC1o5JwYJ7pS/vL UsSVQU+lmeEQWCbMFV/1A0cWsw2bC89ftNjZvypztE4TGSRft6pYFl4b0rvjr1F8j3 n66L8uCPuU5Mx2xkEU6emqK9fKMhiAGt33u1CPzkXavMECxIT5Rzneh0JJ5p2lB7x5 bjywwKhJ9MpnVCHvH1L8/DqaW/JEZ1gouGP3LvkelYyuHcaOfH8aP/4LwcwQj23mBH 4bp16k/ZvTwXi7/4SybtacnQPO2LCpALpDJS37MGfAF60BfqDfbyoSV4IBoUk7Z4jo 3sBst2ZpXPOHw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4YjT2w4WqQz4wc4; Wed, 29 Jan 2025 15:00:40 +1100 (AEDT) Date: Wed, 29 Jan 2025 12:35:04 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v2 2/8] flow, flow_table: Pad flow table entries to 128 bytes, hash entries to 32 bits Message-ID: References: <20250128233940.1235855-1-sbrivio@redhat.com> <20250128233940.1235855-3-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="luoznZicGvQ/T6GC" Content-Disposition: inline In-Reply-To: <20250128233940.1235855-3-sbrivio@redhat.com> Message-ID-Hash: 4NXUHNZTMOFU54SATZFGU3WNAA6MELZO X-Message-ID-Hash: 4NXUHNZTMOFU54SATZFGU3WNAA6MELZO 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: --luoznZicGvQ/T6GC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 29, 2025 at 12:39:34AM +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. >=20 > Signed-off-by: Stefano Brivio Again, ugly, but necessary for the v1 approach. > --- > 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 --luoznZicGvQ/T6GC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmeZhccACgkQzQJF27ox 2GfriQ//Qqqy5nJtf/81t8JvCmR3JvYuBEVnoQ97NFtCG4XSSlY8M3ePPRaQObOG FZY971iINdCPfgt+Og2rlUIZ2D3sONOUBKWgDf5PC3SPaitWKYf6im3GGqel9rp0 aMcKzMvMVjh94KG0/uqlCMAqyeBnJxV0aNm2eKbTQRZNiNR5/jSY46al6USRyy7N 3WOMB9d2+p3TiDh3jpqtqWAE85go1JARZOwvj1gvj8MfS0hE64pYVFQf0wzlXwIu ruH73gxbJHBQVROu14NgK7BLO5QVuVZYg7FPqrLRvi9DcFwhS7f1dwmRNE05EzKb 2g3qDlRc3IaSn54HaHo1k9EgZ8nOw1ZOUWLHddkjc1omXAzL+oLJEfpiNKRgfP2D cMmpZsjkR/wqzyBMhgHjFkhpzkbAhlBdTp0kdqzqcEW9grddt4pfGFpSLAihNsB+ 342S2t9ruSc4HzmRgHYdkVc4cPIuE68SP2zfkUM0lhMP/DpKP/vQl9WtPia5rFXL sbkEvNqMrZ4cGjGHRkMv5w337lWPQd9QKiqpFUFTrH61H5QZ79ThZ+MWuqYJsRop +r69MwlGDc1u6YeqRATu2dT8+JSLaNSO97lgcA4Dh6HVWV3V5XZE3HZY8n0jP9FF DsmoG8y5d9ntpf0m5URgdKAwCEafXW12sY7xGM3tnaIFoDWvKqw= =cn/k -----END PGP SIGNATURE----- --luoznZicGvQ/T6GC--