From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netdev@vger.kernel.org
Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net,
thomas.lendacky@amd.com, f.fainelli@gmail.com,
ariel.elior@cavium.com, michael.chan@broadcom.com,
santosh@chelsio.com, madalin.bucur@nxp.com,
yisen.zhuang@huawei.com, salil.mehta@huawei.com,
jeffrey.t.kirsher@intel.com, tariqt@mellanox.com,
saeedm@mellanox.com, jiri@mellanox.com, idosch@mellanox.com,
jakub.kicinski@netronome.com, peppe.cavallaro@st.com,
grygorii.strashko@ti.com, andrew@lunn.ch,
vivien.didelot@savoirfairelinux.com, alexandre.torgue@st.com,
joabreu@synopsys.com, linux-net-drivers@solarflare.com,
ganeshgr@chelsio.com, ogerlitz@mellanox.com,
Manish.Chopra@cavium.com, marcelo.leitner@gmail.com,
mkubecek@suse.cz, venkatkumar.duvvuru@broadcom.com,
cphealy@gmail.com
Subject: [PATCH net-next 05/12] net: sched: add release callback to struct tcf_block_cb
Date: Thu, 20 Jun 2019 21:49:10 +0200 [thread overview]
Message-ID: <20190620194917.2298-6-pablo@netfilter.org> (raw)
In-Reply-To: <20190620194917.2298-1-pablo@netfilter.org>
Call it on tcf_block_cb object to release the driver private block area.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/net/pkt_cls.h | 6 ++++--
net/sched/cls_api.c | 10 ++++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 4fbed2ccfa6b..db4d32266a03 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -73,7 +73,8 @@ static inline struct Qdisc *tcf_block_q(struct tcf_block *block)
}
struct tcf_block_cb *tcf_block_cb_alloc(tc_setup_cb_t *cb,
- void *cb_ident, void *cb_priv);
+ void *cb_ident, void *cb_priv,
+ void (*release)(void *cb_priv));
void tcf_block_cb_free(struct tcf_block_cb *block_cb);
struct tc_block_offload;
@@ -161,7 +162,8 @@ void tc_setup_cb_block_unregister(struct tcf_block *block, tc_setup_cb_t *cb,
}
static inline struct tcf_block_cb *
-tcf_block_cb_alloc(tc_setup_cb_t *cb, void *cb_ident, void *cb_priv)
+tcf_block_cb_alloc(tc_setup_cb_t *cb, void *cb_ident, void *cb_priv,
+ void (*release)(void *cb_priv))
{
return NULL;
}
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 78050d16ff74..707c2ae0a15f 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -713,6 +713,7 @@ struct tcf_block_cb {
struct list_head global_list;
struct list_head list;
tc_setup_cb_t *cb;
+ void (*release)(void *cb_priv);
void *cb_ident;
void *cb_priv;
unsigned int refcnt;
@@ -750,7 +751,8 @@ unsigned int tcf_block_cb_decref(struct tcf_block_cb *block_cb)
EXPORT_SYMBOL(tcf_block_cb_decref);
struct tcf_block_cb *tcf_block_cb_alloc(tc_setup_cb_t *cb,
- void *cb_ident, void *cb_priv)
+ void *cb_ident, void *cb_priv,
+ void (*release)(void *cb_priv))
{
struct tcf_block_cb *block_cb;
@@ -760,6 +762,7 @@ struct tcf_block_cb *tcf_block_cb_alloc(tc_setup_cb_t *cb,
block_cb->cb = cb;
block_cb->cb_ident = cb_ident;
+ block_cb->release = release;
block_cb->cb_priv = cb_priv;
return block_cb;
@@ -768,6 +771,9 @@ EXPORT_SYMBOL(tcf_block_cb_alloc);
void tcf_block_cb_free(struct tcf_block_cb *block_cb)
{
+ if (block_cb->release)
+ block_cb->release(block_cb->cb_priv);
+
kfree(block_cb);
}
EXPORT_SYMBOL(tcf_block_cb_free);
@@ -801,7 +807,7 @@ struct tcf_block_cb *__tcf_block_cb_register(struct tcf_block *block,
if (err)
return ERR_PTR(err);
- block_cb = tcf_block_cb_alloc(cb, cb_ident, cb_priv);
+ block_cb = tcf_block_cb_alloc(cb, cb_ident, cb_priv, NULL);
if (!block_cb)
return ERR_PTR(-ENOMEM);
--
2.11.0
next prev parent reply other threads:[~2019-06-20 19:49 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 19:49 [PATCH net-next 00/12] netfilter: add hardware offload infrastructure Pablo Neira Ayuso
2019-06-20 19:49 ` [PATCH net-next 01/12] net: sched: move tcf_block_cb before indr_block Pablo Neira Ayuso
2019-06-20 19:49 ` [PATCH net-next 02/12] net: sched: add tcf_block_cb_alloc() Pablo Neira Ayuso
2019-07-02 19:14 ` Marcelo Ricardo Leitner
2019-06-20 19:49 ` [PATCH net-next 03/12] net: sched: add tcf_block_cb_free() Pablo Neira Ayuso
2019-06-20 19:49 ` [PATCH net-next 04/12] net: sched: add tcf_block_setup() Pablo Neira Ayuso
2019-06-21 17:16 ` Jiri Pirko
2019-06-25 8:31 ` Pablo Neira Ayuso
2019-06-26 12:12 ` Jiri Pirko
2019-06-26 13:16 ` Pablo Neira Ayuso
2019-07-03 10:43 ` Jiri Pirko
2019-06-20 19:49 ` Pablo Neira Ayuso [this message]
2019-06-20 19:49 ` [PATCH net-next 06/12] net: sched: add tcf_setup_block_offload() Pablo Neira Ayuso
2019-06-20 19:49 ` [PATCH net-next 07/12] net: use tcf_block_setup() infrastructure Pablo Neira Ayuso
2019-07-02 19:16 ` Marcelo Ricardo Leitner
2019-06-20 19:49 ` [PATCH net-next 08/12] net: cls_api: do not expose tcf_block to drivers Pablo Neira Ayuso
2019-06-21 16:17 ` Jiri Pirko
2019-06-20 19:49 ` [PATCH net-next 09/12] net: sched: remove tcf_block_cb_{register,unregister}() Pablo Neira Ayuso
2019-06-20 19:49 ` [PATCH net-next 10/12] net: flow_offload: add flow_block_cb API Pablo Neira Ayuso
2019-06-21 15:19 ` Jiri Pirko
2019-06-20 19:49 ` [PATCH net-next 11/12] net: flow_offload: don't allow block sharing until drivers support this Pablo Neira Ayuso
2019-06-25 8:16 ` Jiri Pirko
2019-06-25 8:22 ` Pablo Neira Ayuso
2019-06-20 19:49 ` [PATCH net-next 12/12] netfilter: nf_tables: add hardware offload support Pablo Neira Ayuso
2019-06-21 15:16 ` [PATCH net-next 00/12] netfilter: add hardware offload infrastructure Jiri Pirko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190620194917.2298-6-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=Manish.Chopra@cavium.com \
--cc=alexandre.torgue@st.com \
--cc=andrew@lunn.ch \
--cc=ariel.elior@cavium.com \
--cc=cphealy@gmail.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=ganeshgr@chelsio.com \
--cc=grygorii.strashko@ti.com \
--cc=idosch@mellanox.com \
--cc=jakub.kicinski@netronome.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jiri@mellanox.com \
--cc=joabreu@synopsys.com \
--cc=linux-net-drivers@solarflare.com \
--cc=madalin.bucur@nxp.com \
--cc=marcelo.leitner@gmail.com \
--cc=michael.chan@broadcom.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=peppe.cavallaro@st.com \
--cc=saeedm@mellanox.com \
--cc=salil.mehta@huawei.com \
--cc=santosh@chelsio.com \
--cc=tariqt@mellanox.com \
--cc=thomas.lendacky@amd.com \
--cc=venkatkumar.duvvuru@broadcom.com \
--cc=vivien.didelot@savoirfairelinux.com \
--cc=yisen.zhuang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.