[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1582458307-17067-3-git-send-email-paulb@mellanox.com>
Date: Sun, 23 Feb 2020 13:45:03 +0200
From: Paul Blakey <paulb@...lanox.com>
To: Paul Blakey <paulb@...lanox.com>,
Saeed Mahameed <saeedm@...lanox.com>,
Oz Shlomo <ozsh@...lanox.com>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
Vlad Buslov <vladbu@...lanox.com>,
David Miller <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Jiri Pirko <jiri@...lanox.com>, Roi Dayan <roid@...lanox.com>
Cc: Pablo Neira Ayuso <pablo@...filter.org>
Subject: [PATCH net-next 2/6] netfilter: flowtable: nf_flow_table_iterate() returns the number of entries
From: Pablo Neira Ayuso <pablo@...filter.org>
Update this iterator to return the number of entries in this flowtable.
Signed-off-by: Pablo Neira Ayuso <pablo@...filter.org>
Signed-off-by: Paul Blakey <paulb@...lanox.com>
---
net/netfilter/nf_flow_table_core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index face98b..83bc456 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -319,7 +319,7 @@ struct flow_offload_tuple_rhash *
struct flow_offload_tuple_rhash *tuplehash;
struct rhashtable_iter hti;
struct flow_offload *flow;
- int err = 0;
+ int err = 0, cnt = 0;
rhashtable_walk_enter(&flow_table->rhashtable, &hti);
rhashtable_walk_start(&hti);
@@ -338,11 +338,12 @@ struct flow_offload_tuple_rhash *
flow = container_of(tuplehash, struct flow_offload, tuplehash[0]);
iter(flow_table, flow, data);
+ cnt++;
}
rhashtable_walk_stop(&hti);
rhashtable_walk_exit(&hti);
- return err;
+ return err < 0 ? err : cnt;
}
static void nf_flow_offload_gc_step(struct nf_flowtable *flow_table,
--
1.8.3.1
Powered by blists - more mailing lists