Commit c3c831b0 authored by Paul Blakey's avatar Paul Blakey Committed by Pablo Neira Ayuso

netfilter: flowtable: Use nf_flow_offload_tuple for stats as well

This patch doesn't change any functionality.
Signed-off-by: default avatarPaul Blakey <paulb@mellanox.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 5d0ab06b
...@@ -574,6 +574,7 @@ static int nf_flow_offload_tuple(struct nf_flowtable *flowtable, ...@@ -574,6 +574,7 @@ static int nf_flow_offload_tuple(struct nf_flowtable *flowtable,
struct nf_flow_rule *flow_rule, struct nf_flow_rule *flow_rule,
enum flow_offload_tuple_dir dir, enum flow_offload_tuple_dir dir,
int priority, int cmd, int priority, int cmd,
struct flow_stats *stats,
struct list_head *block_cb_list) struct list_head *block_cb_list)
{ {
struct flow_cls_offload cls_flow = {}; struct flow_cls_offload cls_flow = {};
...@@ -598,6 +599,9 @@ static int nf_flow_offload_tuple(struct nf_flowtable *flowtable, ...@@ -598,6 +599,9 @@ static int nf_flow_offload_tuple(struct nf_flowtable *flowtable,
} }
mutex_unlock(&flowtable->flow_block_lock); mutex_unlock(&flowtable->flow_block_lock);
if (cmd == FLOW_CLS_STATS)
memcpy(stats, &cls_flow.stats, sizeof(*stats));
return i; return i;
} }
...@@ -607,7 +611,7 @@ static int flow_offload_tuple_add(struct flow_offload_work *offload, ...@@ -607,7 +611,7 @@ static int flow_offload_tuple_add(struct flow_offload_work *offload,
{ {
return nf_flow_offload_tuple(offload->flowtable, offload->flow, return nf_flow_offload_tuple(offload->flowtable, offload->flow,
flow_rule, dir, offload->priority, flow_rule, dir, offload->priority,
FLOW_CLS_REPLACE, FLOW_CLS_REPLACE, NULL,
&offload->flowtable->flow_block.cb_list); &offload->flowtable->flow_block.cb_list);
} }
...@@ -615,7 +619,7 @@ static void flow_offload_tuple_del(struct flow_offload_work *offload, ...@@ -615,7 +619,7 @@ static void flow_offload_tuple_del(struct flow_offload_work *offload,
enum flow_offload_tuple_dir dir) enum flow_offload_tuple_dir dir)
{ {
nf_flow_offload_tuple(offload->flowtable, offload->flow, NULL, dir, nf_flow_offload_tuple(offload->flowtable, offload->flow, NULL, dir,
offload->priority, FLOW_CLS_DESTROY, offload->priority, FLOW_CLS_DESTROY, NULL,
&offload->flowtable->flow_block.cb_list); &offload->flowtable->flow_block.cb_list);
} }
...@@ -661,21 +665,9 @@ static void flow_offload_tuple_stats(struct flow_offload_work *offload, ...@@ -661,21 +665,9 @@ static void flow_offload_tuple_stats(struct flow_offload_work *offload,
enum flow_offload_tuple_dir dir, enum flow_offload_tuple_dir dir,
struct flow_stats *stats) struct flow_stats *stats)
{ {
struct nf_flowtable *flowtable = offload->flowtable; nf_flow_offload_tuple(offload->flowtable, offload->flow, NULL, dir,
struct flow_cls_offload cls_flow = {}; offload->priority, FLOW_CLS_STATS, stats,
struct flow_block_cb *block_cb; &offload->flowtable->flow_block.cb_list);
struct netlink_ext_ack extack;
__be16 proto = ETH_P_ALL;
nf_flow_offload_init(&cls_flow, proto, offload->priority,
FLOW_CLS_STATS,
&offload->flow->tuplehash[dir].tuple, &extack);
mutex_lock(&flowtable->flow_block_lock);
list_for_each_entry(block_cb, &flowtable->flow_block.cb_list, list)
block_cb->cb(TC_SETUP_CLSFLOWER, &cls_flow, block_cb->cb_priv);
mutex_unlock(&flowtable->flow_block_lock);
memcpy(stats, &cls_flow.stats, sizeof(*stats));
} }
static void flow_offload_work_stats(struct flow_offload_work *offload) static void flow_offload_work_stats(struct flow_offload_work *offload)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment