From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft 1/4] cache: rename chain_htable to cache_chain_ht
Date: Thu, 1 Apr 2021 22:29:25 +0200 [thread overview]
Message-ID: <20210401202928.5222-1-pablo@netfilter.org> (raw)
Rename the hashtable chain that is used for fast cache lookups.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/rule.h | 4 ++--
src/cache.c | 6 +++---
src/rule.c | 6 +++---
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/rule.h b/include/rule.h
index 4ef24eb4ec63..f8e615121113 100644
--- a/include/rule.h
+++ b/include/rule.h
@@ -155,7 +155,7 @@ struct table {
struct handle handle;
struct location location;
struct scope scope;
- struct list_head *chain_htable;
+ struct list_head *cache_chain_ht;
struct list_head chains;
struct list_head sets;
struct list_head objs;
@@ -230,7 +230,7 @@ struct hook_spec {
*/
struct chain {
struct list_head list;
- struct list_head hlist;
+ struct list_head cache_hlist;
struct handle handle;
struct location location;
unsigned int refcnt;
diff --git a/src/cache.c b/src/cache.c
index 63971e865622..400128906b03 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -195,7 +195,7 @@ static int chain_cache_cb(struct nftnl_chain *nlc, void *arg)
if (chain->flags & CHAIN_F_BINDING) {
list_add_tail(&chain->list, &ctx->table->chain_bindings);
} else {
- list_add_tail(&chain->hlist, &ctx->table->chain_htable[hash]);
+ list_add_tail(&chain->cache_hlist, &ctx->table->cache_chain_ht[hash]);
list_add_tail(&chain->list, &ctx->table->chains);
}
@@ -239,7 +239,7 @@ void chain_cache_add(struct chain *chain, struct table *table)
uint32_t hash;
hash = djb_hash(chain->handle.chain.name) % NFT_CACHE_HSIZE;
- list_add_tail(&chain->hlist, &table->chain_htable[hash]);
+ list_add_tail(&chain->cache_hlist, &table->cache_chain_ht[hash]);
list_add_tail(&chain->list, &table->chains);
}
@@ -250,7 +250,7 @@ struct chain *chain_cache_find(const struct table *table,
uint32_t hash;
hash = djb_hash(handle->chain.name) % NFT_CACHE_HSIZE;
- list_for_each_entry(chain, &table->chain_htable[hash], hlist) {
+ list_for_each_entry(chain, &table->cache_chain_ht[hash], cache_hlist) {
if (!strcmp(chain->handle.chain.name, handle->chain.name))
return chain;
}
diff --git a/src/rule.c b/src/rule.c
index 969318008933..79706ab7b60a 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -1140,10 +1140,10 @@ struct table *table_alloc(void)
init_list_head(&table->scope.symbols);
table->refcnt = 1;
- table->chain_htable =
+ table->cache_chain_ht =
xmalloc(sizeof(struct list_head) * NFT_CACHE_HSIZE);
for (i = 0; i < NFT_CACHE_HSIZE; i++)
- init_list_head(&table->chain_htable[i]);
+ init_list_head(&table->cache_chain_ht[i]);
return table;
}
@@ -1171,7 +1171,7 @@ void table_free(struct table *table)
obj_free(obj);
handle_free(&table->handle);
scope_release(&table->scope);
- xfree(table->chain_htable);
+ xfree(table->cache_chain_ht);
xfree(table);
}
--
2.20.1
next reply other threads:[~2021-04-01 20:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 20:29 Pablo Neira Ayuso [this message]
2021-04-01 20:29 ` [PATCH nft 2/4,v2] src: split chain list in table Pablo Neira Ayuso
2021-04-01 20:29 ` [PATCH nft 3/4] evaluate: use chain hashtable for lookups Pablo Neira Ayuso
2021-04-01 20:29 ` [PATCH nft 4/4] cache: statify chain_cache_dump() 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=20210401202928.5222-1-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).