From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft,v2 2/7] cache: accumulate flags in batch
Date: Mon, 26 Aug 2024 10:54:50 +0200 [thread overview]
Message-ID: <20240826085455.163392-3-pablo@netfilter.org> (raw)
In-Reply-To: <20240826085455.163392-1-pablo@netfilter.org>
Recent updates are relaxing cache requirements:
babc6ee8773c ("cache: populate chains on demand from error path")
Flags describe cache requirements for a given batch, accumulate flags
that are inferred from commands in this batch.
Fixes: 7df42800cf89 ("src: single cache_update() call to build cache before evaluation")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
v2: new in this series
src/cache.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/cache.c b/src/cache.c
index 5442da35a129..082fd30b462d 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -409,13 +409,14 @@ int nft_cache_evaluate(struct nft_ctx *nft, struct list_head *cmds,
struct list_head *msgs, struct nft_cache_filter *filter,
unsigned int *pflags)
{
- unsigned int flags = NFT_CACHE_EMPTY;
+ unsigned int flags, batch_flags = NFT_CACHE_EMPTY;
struct cmd *cmd;
list_for_each_entry(cmd, cmds, list) {
if (nft_handle_validate(cmd, msgs) < 0)
return -1;
+ flags = NFT_CACHE_EMPTY;
reset_filter(filter);
switch (cmd->op) {
@@ -439,13 +440,13 @@ int nft_cache_evaluate(struct nft_ctx *nft, struct list_head *cmds,
flags = evaluate_cache_get(cmd, flags);
break;
case CMD_RESET:
- flags |= evaluate_cache_reset(cmd, flags, filter);
+ flags = evaluate_cache_reset(cmd, flags, filter);
break;
case CMD_LIST:
- flags |= evaluate_cache_list(nft, cmd, flags, filter);
+ flags = evaluate_cache_list(nft, cmd, flags, filter);
break;
case CMD_MONITOR:
- flags |= NFT_CACHE_FULL;
+ flags = NFT_CACHE_FULL;
break;
case CMD_FLUSH:
flags = evaluate_cache_flush(cmd, flags, filter);
@@ -460,8 +461,9 @@ int nft_cache_evaluate(struct nft_ctx *nft, struct list_head *cmds,
default:
break;
}
+ batch_flags |= flags;
}
- *pflags = flags;
+ *pflags = batch_flags;
return 0;
}
--
2.30.2
next prev parent reply other threads:[~2024-08-26 8:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-26 8:54 [PATCH nft,v2 0/7] cache updates Pablo Neira Ayuso
2024-08-26 8:54 ` [PATCH nft,v2 1/7] cache: reset filter for each command Pablo Neira Ayuso
2024-08-26 8:54 ` Pablo Neira Ayuso [this message]
2024-08-26 8:54 ` [PATCH nft,v2 3/7] cache: add filtering support for objects Pablo Neira Ayuso
2024-08-26 8:54 ` [PATCH nft,v2 4/7] cache: only dump rules for the given table Pablo Neira Ayuso
2024-08-26 8:54 ` [PATCH nft,v2 5/7] cache: consolidate reset command Pablo Neira Ayuso
2024-09-25 22:47 ` Phil Sutter
2024-09-26 14:34 ` Pablo Neira Ayuso
2024-09-26 14:40 ` Phil Sutter
2024-08-26 8:54 ` [PATCH nft,v2 6/7] tests: shell: cover anonymous set with " Pablo Neira Ayuso
2024-08-26 8:54 ` [PATCH nft,v2 7/7] tests: shell: cover reset command with counter and quota Pablo Neira Ayuso
2024-08-26 15:29 ` [PATCH nft,v2 0/7] cache updates Eric Garver
2024-08-28 14:35 ` Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240826085455.163392-3-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).