From dffc0e109ed4780c6d79c52fb5be8cda2d63fc6b Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 9 Nov 2021 10:44:46 +0100 Subject: cache: do not populate cache if it is going to be flushed Skip set element netlink dump if set is flushed, this speeds up set flush + add element operation in a batch file for an existing set. Signed-off-by: Pablo Neira Ayuso --- include/cache.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/cache.h b/include/cache.h index 7d61701a..cdf1f4fb 100644 --- a/include/cache.h +++ b/include/cache.h @@ -38,11 +38,24 @@ enum cache_level_flags { NFT_CACHE_FLUSHED = (1 << 31), }; +struct nft_filter_obj { + struct list_head list; + uint32_t family; + const char *table; + const char *set; +}; + +#define NFT_CACHE_HSIZE 8192 + struct nft_cache_filter { struct { const char *table; const char *set; } list; + + struct { + struct list_head head; + } obj[NFT_CACHE_HSIZE]; }; struct nft_cache; @@ -66,7 +79,8 @@ static inline uint32_t djb_hash(const char *key) return hash; } -#define NFT_CACHE_HSIZE 8192 +struct nft_cache_filter *nft_cache_filter_init(void); +void nft_cache_filter_fini(struct nft_cache_filter *filter); struct table; struct chain; -- cgit v1.2.3