netfilter: nf_tables: shrink memory consumption of set elements
[linux-2.6-microblaze.git] / net / netfilter / nft_set_pipapo.c
index 0969d2c..f540c2b 100644 (file)
@@ -1548,11 +1548,7 @@ static void nft_pipapo_gc_deactivate(struct net *net, struct nft_set *set,
                                     struct nft_pipapo_elem *e)
 
 {
-       struct nft_set_elem elem = {
-               .priv   = &e->priv,
-       };
-
-       nft_setelem_data_deactivate(net, set, &elem);
+       nft_setelem_data_deactivate(net, set, &e->priv);
 }
 
 /**
@@ -1739,7 +1735,7 @@ static void nft_pipapo_abort(const struct nft_set *set)
  * nft_pipapo_activate() - Mark element reference as active given key, commit
  * @net:       Network namespace
  * @set:       nftables API set representation
- * @elem:      nftables API element representation containing key data
+ * @elem_priv: nftables API element representation containing key data
  *
  * On insertion, elements are added to a copy of the matching data currently
  * in use for lookups, and not directly inserted into current lookup data. Both
@@ -1748,9 +1744,9 @@ static void nft_pipapo_abort(const struct nft_set *set)
  */
 static void nft_pipapo_activate(const struct net *net,
                                const struct nft_set *set,
-                               const struct nft_set_elem *elem)
+                               struct nft_elem_priv *elem_priv)
 {
-       struct nft_pipapo_elem *e = nft_elem_priv_cast(elem->priv);
+       struct nft_pipapo_elem *e = nft_elem_priv_cast(elem_priv);
 
        nft_set_elem_change_active(net, set, &e->ext);
 }
@@ -1803,7 +1799,7 @@ nft_pipapo_deactivate(const struct net *net, const struct nft_set *set,
  * nft_pipapo_flush() - Call pipapo_deactivate() to make element inactive
  * @net:       Network namespace
  * @set:       nftables API set representation
- * @elem:      nftables API element representation containing key data
+ * @elem_priv: nftables API element representation containing key data
  *
  * This is functionally the same as nft_pipapo_deactivate(), with a slightly
  * different interface, and it's also called once for each element in a set
@@ -1945,7 +1941,7 @@ static bool pipapo_match_field(struct nft_pipapo_field *f,
  * nft_pipapo_remove() - Remove element given key, commit
  * @net:       Network namespace
  * @set:       nftables API set representation
- * @elem:      nftables API element representation containing key data
+ * @elem_priv: nftables API element representation containing key data
  *
  * Similarly to nft_pipapo_activate(), this is used as commit operation by the
  * API, but it's called once per element in the pending transaction, so we can't
@@ -1953,7 +1949,7 @@ static bool pipapo_match_field(struct nft_pipapo_field *f,
  * the matched element here, if any, and commit the updated matching data.
  */
 static void nft_pipapo_remove(const struct net *net, const struct nft_set *set,
-                             const struct nft_set_elem *elem)
+                             struct nft_elem_priv *elem_priv)
 {
        struct nft_pipapo *priv = nft_set_priv(set);
        struct nft_pipapo_match *m = priv->clone;
@@ -1961,7 +1957,7 @@ static void nft_pipapo_remove(const struct net *net, const struct nft_set *set,
        struct nft_pipapo_elem *e;
        const u8 *data;
 
-       e = nft_elem_priv_cast(elem->priv);
+       e = nft_elem_priv_cast(elem_priv);
        data = (const u8 *)nft_set_ext_key(&e->ext);
 
        while ((rules_f0 = pipapo_rules_same_key(m->f, first_rule))) {
@@ -2038,7 +2034,6 @@ static void nft_pipapo_walk(const struct nft_ctx *ctx, struct nft_set *set,
 
        for (r = 0; r < f->rules; r++) {
                struct nft_pipapo_elem *e;
-               struct nft_set_elem elem;
 
                if (r < f->rules - 1 && f->mt[r + 1].e == f->mt[r].e)
                        continue;
@@ -2048,9 +2043,7 @@ static void nft_pipapo_walk(const struct nft_ctx *ctx, struct nft_set *set,
 
                e = f->mt[r].e;
 
-               elem.priv = &e->priv;
-
-               iter->err = iter->fn(ctx, set, iter, &elem);
+               iter->err = iter->fn(ctx, set, iter, &e->priv);
                if (iter->err < 0)
                        goto out;