From a37212f2fd90739e17f3dbb96ea6284d7755bf5f Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 29 Nov 2021 15:28:33 +0100 Subject: cache: Filter tables on kernel side Instead of requesting a dump of all tables and filtering the data in user space, construct a non-dump request if filter contains a table so kernel returns only that single table. This should improve nft performance in rulesets with many tables present. Signed-off-by: Phil Sutter --- src/cache.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/cache.c') diff --git a/src/cache.c b/src/cache.c index 6d20716d..66da2b34 100644 --- a/src/cache.c +++ b/src/cache.c @@ -772,19 +772,12 @@ static int cache_init_tables(struct netlink_ctx *ctx, struct handle *h, struct table *table, *next; int ret; - ret = netlink_list_tables(ctx, h); + ret = netlink_list_tables(ctx, h, filter); if (ret < 0) return -1; list_for_each_entry_safe(table, next, &ctx->list, list) { list_del(&table->list); - - if (filter && filter->list.table && - (filter->list.family != table->handle.family || - strcmp(filter->list.table, table->handle.table.name))) { - table_free(table); - continue; - } table_cache_add(table, cache); } -- cgit v1.2.3