[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190708160614.2226-7-pablo@netfilter.org>
Date: Mon, 8 Jul 2019 18:06:08 +0200
From: Pablo Neira Ayuso <pablo@...filter.org>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, thomas.lendacky@....com, f.fainelli@...il.com,
ariel.elior@...ium.com, michael.chan@...adcom.com,
madalin.bucur@....com, yisen.zhuang@...wei.com,
salil.mehta@...wei.com, jeffrey.t.kirsher@...el.com,
tariqt@...lanox.com, saeedm@...lanox.com, jiri@...lanox.com,
idosch@...lanox.com, jakub.kicinski@...ronome.com,
peppe.cavallaro@...com, grygorii.strashko@...com, andrew@...n.ch,
vivien.didelot@...il.com, alexandre.torgue@...com,
joabreu@...opsys.com, linux-net-drivers@...arflare.com,
ogerlitz@...lanox.com, Manish.Chopra@...ium.com,
marcelo.leitner@...il.com, mkubecek@...e.cz,
venkatkumar.duvvuru@...adcom.com, maxime.chevallier@...tlin.com,
cphealy@...il.com, netfilter-devel@...r.kernel.org
Subject: [PATCH net-next,v3 06/11] net: flow_offload: add flow_block_cb_{priv,incref,decref}()
This patch completes the flow block API to introduce:
* flow_block_cb_priv() to accept callback private data.
* flow_block_cb_incref() to bump reference counter on this flow block.
* flow_block_cb_decref() to decrement the reference counter.
These function are taken from the existing tcf_block_cb_priv(),
tcf_block_cb_incref() and tcf_block_cb_decref().
Signed-off-by: Pablo Neira Ayuso <pablo@...filter.org>
---
v3: missing in previous batch.
include/net/flow_offload.h | 4 ++++
net/core/flow_offload.c | 18 ++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index 06acde2960fa..342e6aef7e3a 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -277,6 +277,10 @@ struct flow_block_cb *flow_block_cb_lookup(struct net *net,
struct list_head *driver_flow_block_list,
tc_setup_cb_t *cb, void *cb_ident);
+void *flow_block_cb_priv(struct flow_block_cb *block_cb);
+void flow_block_cb_incref(struct flow_block_cb *block_cb);
+unsigned int flow_block_cb_decref(struct flow_block_cb *block_cb);
+
static inline void flow_block_cb_add(struct flow_block_cb *block_cb,
struct flow_block_offload *offload)
{
diff --git a/net/core/flow_offload.c b/net/core/flow_offload.c
index 85fd5f4a1e0f..916ff32e53e7 100644
--- a/net/core/flow_offload.c
+++ b/net/core/flow_offload.c
@@ -212,6 +212,24 @@ struct flow_block_cb *flow_block_cb_lookup(struct net *net,
}
EXPORT_SYMBOL(flow_block_cb_lookup);
+void *flow_block_cb_priv(struct flow_block_cb *block_cb)
+{
+ return block_cb->cb_priv;
+}
+EXPORT_SYMBOL(flow_block_cb_priv);
+
+void flow_block_cb_incref(struct flow_block_cb *block_cb)
+{
+ block_cb->refcnt++;
+}
+EXPORT_SYMBOL(flow_block_cb_incref);
+
+unsigned int flow_block_cb_decref(struct flow_block_cb *block_cb)
+{
+ return --block_cb->refcnt;
+}
+EXPORT_SYMBOL(flow_block_cb_decref);
+
int flow_block_cb_setup_simple(struct flow_block_offload *f,
struct list_head *driver_block_list,
tc_setup_cb_t *cb, void *cb_ident, void *cb_priv,
--
2.11.0
Powered by blists - more mailing lists