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 94DDD5A027A for ; Thu, 30 Nov 2023 01:55:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1701305703; bh=yaBbXvOUNyry6ju59slT6l84C70IqYOiUhNj18bhRtA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cWTL7TEEw0KtQEYPDh3crMR+faGnmx4ZDSegtjniZDVMmG9kQ1JXmm4yXF2iF8FYl FToi0/RrKG5TO8ktt6X7KNj0SLx4jWxH6apxlsY1L0FEntjgYJ0wB3GxtUpyWPwRx2 neXfI1FGCpTexqO/wlzUYvh16xxBUZXiVF+T8CBU= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Sgd5M3mqGz4xWJ; Thu, 30 Nov 2023 11:55:03 +1100 (AEDT) Date: Thu, 30 Nov 2023 11:37:40 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v2 07/11] flow: Introduce 'sidx' type to represent one side of one flow Message-ID: References: <20231126233348.1599864-1-david@gibson.dropbear.id.au> <20231126233348.1599864-8-david@gibson.dropbear.id.au> <20231129153232.6abfe53c@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="RDIhpd3d0uWXhiaH" Content-Disposition: inline In-Reply-To: <20231129153232.6abfe53c@elisabeth> Message-ID-Hash: KQJUMHQHPVDJCBYTQ6RBP67WYEFZJJ23 X-Message-ID-Hash: KQJUMHQHPVDJCBYTQ6RBP67WYEFZJJ23 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: --RDIhpd3d0uWXhiaH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 29, 2023 at 03:32:32PM +0100, Stefano Brivio wrote: > On Mon, 27 Nov 2023 10:33:44 +1100 > David Gibson wrote: >=20 > > In a number of places, we use indices into the flow table to identify a > > specific flow. We also have cases where we need to identify a particul= ar > > side of a particular flow, and we expect those to become more common as > > we generalise the flow table to cover more things. > >=20 > > To assist with that, introduces flow_sidx_t, an index type which identi= fies > > a specific side of a specific flow in the table. > >=20 > > Signed-off-by: David Gibson > > --- > > flow.h | 13 +++++++++++++ > > flow_table.h | 36 ++++++++++++++++++++++++++++++++++++ > > 2 files changed, 49 insertions(+) > >=20 > > diff --git a/flow.h b/flow.h > > index b6da516..3c90bbd 100644 > > --- a/flow.h > > +++ b/flow.h > > @@ -39,6 +39,19 @@ struct flow_common { > > #define FLOW_TABLE_PRESSURE 30 /* % of FLOW_MAX */ > > #define FLOW_FILE_PRESSURE 30 /* % of c->nofile */ > > =20 > > +/** > > + * struct flow_sidx - ID for one side of a specific flow > > + * @side: Side referenced (0 or 1) > > + * @flow: Index of flow referenced > > + */ > > +typedef struct flow_sidx { >=20 > Implying my usual argument :) ...is there any advantage over using this > simply as a struct? So, usually I too would prefer to use a struct as a struct, without a typedef. The reason I'm doing differently here, is that I want to emphasise that for many purposes this can be treated like an index, in particular that it's small and trivially copyable. In particular it should be passed by value, passing by reference would be silly. That's kind of the opposite of what one tends to be conveying by reminding users that they're working with a struct. >=20 > > + int side :1; > > + unsigned flow :FLOW_INDEX_BITS; > > +} flow_sidx_t; >=20 --=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 --RDIhpd3d0uWXhiaH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmVn2VMACgkQzQJF27ox 2GclfQ/+JIv6rUIWiugYvSVick4hZ0M9bAsDpCp80w6l4GF5XXKQ1CepP286bQVV wqFcoqskSJHYVg0R2x/nUKgBoh+IxPpmylvc88KPF+cuYuXP4VA94uetA0+ulfT3 ph7BtUatDcLJbHlsFZJew3hQGhuGqOxp+TbMicmSoTL02eE/5duW3FGfLq0LgveB 4JL8lSRKy82bVtwqIbhGrtfpi1wZo4ArwTLkuZ0TnDOhRCeP8ppftSleQLssfJZO Vjgz5uDSw+aQilcsE0mlTQw8ATrEohKZO4AYTxjtbWQNaMyChGAoZVrOSgXKJQ5h T4brhLmK+LKJ2dJL0m8lGFLozGPs5SlSCUzpbTCS2I3s7g8Uu9i06AOpFc3uNb1+ 9RuNvNTrOk2cCydpJt9PO2NaRCbAeca6wkaRlxHSLc3xEYjbsKYJqoK6E8OQAZbP R4YtZ7P5sAanZn8S/IPiJ71fi/pEBrdl8S6G3qwWHiN4yWk69rKPb18PzBnKoThW o99uz2S+kqHsL5fzTMprMjP3lnUWlEf6/JGKK3QCPfYMCqrX+KNJrBhJSUNhC33x ZoHbVY/T5YbXqi7wHWldUnsb8tkVk747Gl1ohsXsMrs98NkCZquccDXxlpXhfM97 BDlrn98BZ+IfxI5ArQhQ9tkJVL4bHlHNA2uIswzXk/hO/+Yf8gU= =6Tpn -----END PGP SIGNATURE----- --RDIhpd3d0uWXhiaH--