diff mbox

[4/5] netfilter: nft_hash: restore struct nft_hash

Message ID 1426951158-18168-5-git-send-email-kaber@trash.net
State Superseded
Delegated to: Pablo Neira
Headers show

Commit Message

Patrick McHardy March 21, 2015, 3:19 p.m. UTC
Following patches will add new private members, restore struct nft_hash
as preparation.

Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 net/netfilter/nft_hash.c | 44 ++++++++++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 20 deletions(-)

Comments

Pablo Neira Ayuso March 25, 2015, 11:19 a.m. UTC | #1
On Sat, Mar 21, 2015 at 03:19:17PM +0000, Patrick McHardy wrote:
> Following patches will add new private members, restore struct nft_hash
> as preparation.

[2/2] netfilter: nft_hash: convert to use rhashtable callbacks
[1/2] rhashtable: provide len to obj_hashfn
[5/5] netfilter: nft_hash: indent rhashtable parameters
[4/5] netfilter: nft_hash: restore struct nft_hash

These patches don't apply anymore because of yesterday changes from
Thomas Graf:

http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/log/?qt=author&q=Thomas+Graf

:-(
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Patrick McHardy March 25, 2015, 11:22 a.m. UTC | #2
On 25.03, Pablo Neira Ayuso wrote:
> On Sat, Mar 21, 2015 at 03:19:17PM +0000, Patrick McHardy wrote:
> > Following patches will add new private members, restore struct nft_hash
> > as preparation.
> 
> [2/2] netfilter: nft_hash: convert to use rhashtable callbacks
> [1/2] rhashtable: provide len to obj_hashfn
> [5/5] netfilter: nft_hash: indent rhashtable parameters
> [4/5] netfilter: nft_hash: restore struct nft_hash
> 
> These patches don't apply anymore because of yesterday changes from
> Thomas Graf:
> 
> http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/log/?qt=author&q=Thomas+Graf
> 
> :-(

Crap, they already sunk down in my tree :/

If you push out what you currently have, I'll rebase everything.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pablo Neira Ayuso March 25, 2015, 11:28 a.m. UTC | #3
On Wed, Mar 25, 2015 at 11:22:13AM +0000, Patrick McHardy wrote:
> On 25.03, Pablo Neira Ayuso wrote:
> > On Sat, Mar 21, 2015 at 03:19:17PM +0000, Patrick McHardy wrote:
> > > Following patches will add new private members, restore struct nft_hash
> > > as preparation.
> > 
> > [2/2] netfilter: nft_hash: convert to use rhashtable callbacks
> > [1/2] rhashtable: provide len to obj_hashfn
> > [5/5] netfilter: nft_hash: indent rhashtable parameters
> > [4/5] netfilter: nft_hash: restore struct nft_hash
> > 
> > These patches don't apply anymore because of yesterday changes from
> > Thomas Graf:
> > 
> > http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/log/?qt=author&q=Thomas+Graf
> > 
> > :-(
> 
> Crap, they already sunk down in my tree :/
> 
> If you push out what you currently have, I'll rebase everything.

Just pushed out.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Patrick McHardy March 25, 2015, 11:30 a.m. UTC | #4
On 25.03, Pablo Neira Ayuso wrote:
> On Wed, Mar 25, 2015 at 11:22:13AM +0000, Patrick McHardy wrote:
> > On 25.03, Pablo Neira Ayuso wrote:
> > > On Sat, Mar 21, 2015 at 03:19:17PM +0000, Patrick McHardy wrote:
> > > > Following patches will add new private members, restore struct nft_hash
> > > > as preparation.
> > > 
> > > [2/2] netfilter: nft_hash: convert to use rhashtable callbacks
> > > [1/2] rhashtable: provide len to obj_hashfn
> > > [5/5] netfilter: nft_hash: indent rhashtable parameters
> > > [4/5] netfilter: nft_hash: restore struct nft_hash
> > > 
> > > These patches don't apply anymore because of yesterday changes from
> > > Thomas Graf:
> > > 
> > > http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/log/?qt=author&q=Thomas+Graf
> > > 
> > > :-(
> > 
> > Crap, they already sunk down in my tree :/
> > 
> > If you push out what you currently have, I'll rebase everything.
> 
> Just pushed out.

I'm getting really annoyed that people keep sending patches touching
this stuff without CCing either netfilter-devel or me personally.

This is just causing unnecessary work. The code in nft_hash is going
to get replaced anyways, so now I can rebase 30 patches for no gain
at all.

If you touch netfilter, CC the relevant lists and people please.
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thomas Graf March 25, 2015, 11:50 a.m. UTC | #5
On 03/25/15 at 11:30am, Patrick McHardy wrote:
> I'm getting really annoyed that people keep sending patches touching
> this stuff without CCing either netfilter-devel or me personally.
> 
> This is just causing unnecessary work. The code in nft_hash is going
> to get replaced anyways, so now I can rebase 30 patches for no gain
> at all.
> 
> If you touch netfilter, CC the relevant lists and people please.
> Thanks!

Sorry about that Patrick. Not copying you on the nft_hash change
was a mistake. I apologize. I was only aware of your following
patchset which seemed compatible with my changes.

"[PATCH 0/2] netfilter: preparatory patches for set extensions"

If your larger patchset resolves the RCU lockdep splash in nft_hash
then we can also just revert 6b6f302ce ("rhashtable: Add
rhashtable_free_and_destroy()") or I can rebase it on top of your
series.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Patrick McHardy March 25, 2015, 11:57 a.m. UTC | #6
On 25.03, Thomas Graf wrote:
> On 03/25/15 at 11:30am, Patrick McHardy wrote:
> > I'm getting really annoyed that people keep sending patches touching
> > this stuff without CCing either netfilter-devel or me personally.
> > 
> > This is just causing unnecessary work. The code in nft_hash is going
> > to get replaced anyways, so now I can rebase 30 patches for no gain
> > at all.
> > 
> > If you touch netfilter, CC the relevant lists and people please.
> > Thanks!
> 
> Sorry about that Patrick. Not copying you on the nft_hash change
> was a mistake. I apologize. I was only aware of your following
> patchset which seemed compatible with my changes.

Its usually not a big deal if you forget, but it has happened
too many times recently with rhashtable, so I was getting a little
upset. Anyways, apology accepted :)

> "[PATCH 0/2] netfilter: preparatory patches for set extensions"
> 
> If your larger patchset resolves the RCU lockdep splash in nft_hash
> then we can also just revert 6b6f302ce ("rhashtable: Add
> rhashtable_free_and_destroy()") or I can rebase it on top of your
> series.

I'd like to prevent further delays, so I've already started merging
everything on top of that change. Thanks anyway.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c
index 4585c57..80a6a6d 100644
--- a/net/netfilter/nft_hash.c
+++ b/net/netfilter/nft_hash.c
@@ -23,6 +23,10 @@ 
 /* We target a hash table size of 4, element hint is 75% of final size */
 #define NFT_HASH_ELEMENT_HINT 3
 
+struct nft_hash {
+	struct rhashtable		ht;
+};
+
 struct nft_hash_elem {
 	struct rhash_head		node;
 	struct nft_data			key;
@@ -35,10 +39,10 @@  static bool nft_hash_lookup(const struct nft_set *set,
 			    const struct nft_data *key,
 			    struct nft_data *data)
 {
-	struct rhashtable *priv = nft_set_priv(set);
+	struct nft_hash *priv = nft_set_priv(set);
 	const struct nft_hash_elem *he;
 
-	he = rhashtable_lookup_fast(priv, key, nft_hash_params);
+	he = rhashtable_lookup_fast(&priv->ht, key, nft_hash_params);
 	if (he && set->flags & NFT_SET_MAP)
 		nft_data_copy(data, he->data);
 
@@ -48,7 +52,7 @@  static bool nft_hash_lookup(const struct nft_set *set,
 static int nft_hash_insert(const struct nft_set *set,
 			   const struct nft_set_elem *elem)
 {
-	struct rhashtable *priv = nft_set_priv(set);
+	struct nft_hash *priv = nft_set_priv(set);
 	struct nft_hash_elem *he;
 	unsigned int size;
 	int err;
@@ -68,7 +72,7 @@  static int nft_hash_insert(const struct nft_set *set,
 	if (set->flags & NFT_SET_MAP)
 		nft_data_copy(he->data, &elem->data);
 
-	err = rhashtable_insert_fast(priv, &he->node, nft_hash_params);
+	err = rhashtable_insert_fast(&priv->ht, &he->node, nft_hash_params);
 	if (err)
 		kfree(he);
 
@@ -87,19 +91,19 @@  static void nft_hash_elem_destroy(const struct nft_set *set,
 static void nft_hash_remove(const struct nft_set *set,
 			    const struct nft_set_elem *elem)
 {
-	struct rhashtable *priv = nft_set_priv(set);
+	struct nft_hash *priv = nft_set_priv(set);
 
-	rhashtable_remove_fast(priv, elem->cookie, nft_hash_params);
+	rhashtable_remove_fast(&priv->ht, elem->cookie, nft_hash_params);
 	synchronize_rcu();
 	kfree(elem->cookie);
 }
 
 static int nft_hash_get(const struct nft_set *set, struct nft_set_elem *elem)
 {
-	struct rhashtable *priv = nft_set_priv(set);
+	struct nft_hash *priv = nft_set_priv(set);
 	struct nft_hash_elem *he;
 
-	he = rhashtable_lookup_fast(priv, &elem->key, nft_hash_params);
+	he = rhashtable_lookup_fast(&priv->ht, &elem->key, nft_hash_params);
 	if (!he)
 		return -ENOENT;
 
@@ -114,13 +118,13 @@  static int nft_hash_get(const struct nft_set *set, struct nft_set_elem *elem)
 static void nft_hash_walk(const struct nft_ctx *ctx, const struct nft_set *set,
 			  struct nft_set_iter *iter)
 {
-	struct rhashtable *priv = nft_set_priv(set);
+	struct nft_hash *priv = nft_set_priv(set);
 	const struct nft_hash_elem *he;
 	struct rhashtable_iter hti;
 	struct nft_set_elem elem;
 	int err;
 
-	err = rhashtable_walk_init(priv, &hti);
+	err = rhashtable_walk_init(&priv->ht, &hti);
 	iter->err = err;
 	if (err)
 		return;
@@ -163,7 +167,7 @@  out:
 
 static unsigned int nft_hash_privsize(const struct nlattr * const nla[])
 {
-	return sizeof(struct rhashtable);
+	return sizeof(struct nft_hash);
 }
 
 static const struct rhashtable_params nft_hash_params = {
@@ -176,35 +180,35 @@  static int nft_hash_init(const struct nft_set *set,
 			 const struct nft_set_desc *desc,
 			 const struct nlattr * const tb[])
 {
-	struct rhashtable *priv = nft_set_priv(set);
+	struct nft_hash *priv = nft_set_priv(set);
 	struct rhashtable_params params = nft_hash_params;
 
 	params.nelem_hint = desc->size ?: NFT_HASH_ELEMENT_HINT;
 	params.key_len = set->klen;
 
-	return rhashtable_init(priv, &params);
+	return rhashtable_init(&priv->ht, &params);
 }
 
 static void nft_hash_destroy(const struct nft_set *set)
 {
-	struct rhashtable *priv = nft_set_priv(set);
+	struct nft_hash *priv = nft_set_priv(set);
 	const struct bucket_table *tbl;
 	struct nft_hash_elem *he;
 	struct rhash_head *pos, *next;
 	unsigned int i;
 
 	/* Stop an eventual async resizing */
-	priv->being_destroyed = true;
-	mutex_lock(&priv->mutex);
+	priv->ht.being_destroyed = true;
+	mutex_lock(&priv->ht.mutex);
 
-	tbl = rht_dereference(priv->tbl, priv);
+	tbl = rht_dereference(priv->ht.tbl, &priv->ht);
 	for (i = 0; i < tbl->size; i++) {
 		rht_for_each_entry_safe(he, pos, next, tbl, i, node)
 			nft_hash_elem_destroy(set, he);
 	}
-	mutex_unlock(&priv->mutex);
+	mutex_unlock(&priv->ht.mutex);
 
-	rhashtable_destroy(priv);
+	rhashtable_destroy(&priv->ht);
 }
 
 static bool nft_hash_estimate(const struct nft_set_desc *desc, u32 features,
@@ -217,7 +221,7 @@  static bool nft_hash_estimate(const struct nft_set_desc *desc, u32 features,
 		esize += FIELD_SIZEOF(struct nft_hash_elem, data[0]);
 
 	if (desc->size) {
-		est->size = sizeof(struct rhashtable) +
+		est->size = sizeof(struct nft_hash) +
 			    roundup_pow_of_two(desc->size * 4 / 3) *
 			    sizeof(struct nft_hash_elem *) +
 			    desc->size * esize;