From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id EC4D95A0274; Tue, 04 Feb 2025 01:47:45 +0100 (CET) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH v4 1/8] flow_table: Use size in extern declaration for flowtab, export hash table Date: Tue, 4 Feb 2025 01:47:38 +0100 Message-ID: <20250204004745.97854-2-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250204004745.97854-1-sbrivio@redhat.com> References: <20250204004745.97854-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 6L57JT7CHMWK36B4KTZBF4V7OZ7WD4XV X-Message-ID-Hash: 6L57JT7CHMWK36B4KTZBF4V7OZ7WD4XV X-MailFrom: sbrivio@passt.top 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: David Gibson 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: This can all be thrown away once we stop copying the flow table. Signed-off-by: Stefano Brivio --- flow.c | 6 +----- flow_table.h | 5 ++++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/flow.c b/flow.c index a6fe6d1..3b8dd0e 100644 --- a/flow.c +++ b/flow.c @@ -109,12 +109,8 @@ unsigned flow_first_free; union flow flowtab[FLOW_MAX]; static const union flow *flow_new_entry; /* = NULL */ -/* Hash table to index it */ -#define FLOW_HASH_LOAD 70 /* % */ -#define FLOW_HASH_SIZE ((2 * FLOW_MAX * 100 / FLOW_HASH_LOAD)) - /* Table for lookup from flowside information */ -static flow_sidx_t flow_hashtab[FLOW_HASH_SIZE]; +flow_sidx_t flow_hashtab[FLOW_HASH_SIZE]; static_assert(ARRAY_SIZE(flow_hashtab) >= 2 * FLOW_MAX, "Safe linear probing requires hash table with more entries than the number of sides in the flow table"); diff --git a/flow_table.h b/flow_table.h index eeb6f41..be4f841 100644 --- a/flow_table.h +++ b/flow_table.h @@ -41,7 +41,10 @@ union flow { /* Global Flow Table */ extern unsigned flow_first_free; -extern union flow flowtab[]; +extern union flow flowtab[FLOW_MAX]; +#define FLOW_HASH_LOAD 70 /* % */ +#define FLOW_HASH_SIZE ((2 * FLOW_MAX * 100 / FLOW_HASH_LOAD)) +extern flow_sidx_t flow_hashtab[FLOW_HASH_SIZE]; /** * flow_foreach_sidei() - 'for' type macro to step through each side of flow -- 2.43.0