* [PATCH net 0/2] remove dependency between mlx5, act_ct, nf_flow_table
@ 2020-06-14 11:12 Roi Dayan
2020-06-14 11:12 ` [PATCH net 1/2] net/sched: act_ct: Make tcf_ct_flow_table_restore_skb inline Roi Dayan
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Roi Dayan @ 2020-06-14 11:12 UTC (permalink / raw
To: netdev
Cc: pablo, davem, Jiri Pirko, Paul Blakey, Oz Shlomo,
Marcelo Ricardo Leitner, Roi Dayan, Alaa Hleihel
Hi,
Some exported functions from act_ct and nf_flow_table being used in mlx5_core.
This leads that mlx5 module always require act_ct and nf_flow_table modules.
Those small exported functions can be moved to the header files to
avoid this module dependency.
Thanks,
Roi
Alaa Hleihel (2):
net/sched: act_ct: Make tcf_ct_flow_table_restore_skb inline
netfilter: flowtable: Make nf_flow_table_offload_add/del_cb inline
include/net/netfilter/nf_flow_table.h | 49 ++++++++++++++++++++++++++++++++---
include/net/tc_act/tc_ct.h | 11 +++++++-
net/netfilter/nf_flow_table_core.c | 45 --------------------------------
net/sched/act_ct.c | 11 --------
4 files changed, 55 insertions(+), 61 deletions(-)
--
2.8.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net 1/2] net/sched: act_ct: Make tcf_ct_flow_table_restore_skb inline
2020-06-14 11:12 [PATCH net 0/2] remove dependency between mlx5, act_ct, nf_flow_table Roi Dayan
@ 2020-06-14 11:12 ` Roi Dayan
2020-06-15 14:06 ` Marcelo Ricardo Leitner
2020-06-14 11:12 ` [PATCH net 2/2] netfilter: flowtable: Make nf_flow_table_offload_add/del_cb inline Roi Dayan
2020-06-16 1:07 ` [PATCH net 0/2] remove dependency between mlx5, act_ct, nf_flow_table David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Roi Dayan @ 2020-06-14 11:12 UTC (permalink / raw
To: netdev
Cc: pablo, davem, Jiri Pirko, Paul Blakey, Oz Shlomo,
Marcelo Ricardo Leitner, Roi Dayan, Alaa Hleihel
From: Alaa Hleihel <alaa@mellanox.com>
Currently, tcf_ct_flow_table_restore_skb is exported by act_ct
module, therefore modules using it will have hard-dependency
on act_ct and will require loading it all the time.
This can lead to an unnecessary overhead on systems that do not
use hardware connection tracking action (ct_metadata action) in
the first place.
To relax the hard-dependency between the modules, we unexport this
function and make it a static inline one.
Fixes: 30b0cf90c6dd ("net/sched: act_ct: Support restoring conntrack info on skbs")
Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
---
include/net/tc_act/tc_ct.h | 11 ++++++++++-
net/sched/act_ct.c | 11 -----------
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/include/net/tc_act/tc_ct.h b/include/net/tc_act/tc_ct.h
index 79654bcb9a29..8250d6f0a462 100644
--- a/include/net/tc_act/tc_ct.h
+++ b/include/net/tc_act/tc_ct.h
@@ -66,7 +66,16 @@ static inline struct nf_flowtable *tcf_ct_ft(const struct tc_action *a)
#endif /* CONFIG_NF_CONNTRACK */
#if IS_ENABLED(CONFIG_NET_ACT_CT)
-void tcf_ct_flow_table_restore_skb(struct sk_buff *skb, unsigned long cookie);
+static inline void
+tcf_ct_flow_table_restore_skb(struct sk_buff *skb, unsigned long cookie)
+{
+ enum ip_conntrack_info ctinfo = cookie & NFCT_INFOMASK;
+ struct nf_conn *ct;
+
+ ct = (struct nf_conn *)(cookie & NFCT_PTRMASK);
+ nf_conntrack_get(&ct->ct_general);
+ nf_ct_set(skb, ct, ctinfo);
+}
#else
static inline void
tcf_ct_flow_table_restore_skb(struct sk_buff *skb, unsigned long cookie) { }
diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
index e29f0f45d688..e9f3576cbf71 100644
--- a/net/sched/act_ct.c
+++ b/net/sched/act_ct.c
@@ -1543,17 +1543,6 @@ static void __exit ct_cleanup_module(void)
destroy_workqueue(act_ct_wq);
}
-void tcf_ct_flow_table_restore_skb(struct sk_buff *skb, unsigned long cookie)
-{
- enum ip_conntrack_info ctinfo = cookie & NFCT_INFOMASK;
- struct nf_conn *ct;
-
- ct = (struct nf_conn *)(cookie & NFCT_PTRMASK);
- nf_conntrack_get(&ct->ct_general);
- nf_ct_set(skb, ct, ctinfo);
-}
-EXPORT_SYMBOL_GPL(tcf_ct_flow_table_restore_skb);
-
module_init(ct_init_module);
module_exit(ct_cleanup_module);
MODULE_AUTHOR("Paul Blakey <paulb@mellanox.com>");
--
2.8.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net 2/2] netfilter: flowtable: Make nf_flow_table_offload_add/del_cb inline
2020-06-14 11:12 [PATCH net 0/2] remove dependency between mlx5, act_ct, nf_flow_table Roi Dayan
2020-06-14 11:12 ` [PATCH net 1/2] net/sched: act_ct: Make tcf_ct_flow_table_restore_skb inline Roi Dayan
@ 2020-06-14 11:12 ` Roi Dayan
2020-06-15 14:24 ` Marcelo Ricardo Leitner
2020-06-16 1:07 ` [PATCH net 0/2] remove dependency between mlx5, act_ct, nf_flow_table David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Roi Dayan @ 2020-06-14 11:12 UTC (permalink / raw
To: netdev
Cc: pablo, davem, Jiri Pirko, Paul Blakey, Oz Shlomo,
Marcelo Ricardo Leitner, Roi Dayan, Alaa Hleihel
From: Alaa Hleihel <alaa@mellanox.com>
Currently, nf_flow_table_offload_add/del_cb are exported by nf_flow_table
module, therefore modules using them will have hard-dependency
on nf_flow_table and will require loading it all the time.
This can lead to an unnecessary overhead on systems that do not
use this API.
To relax the hard-dependency between the modules, we unexport these
functions and make them static inline.
Fixes: 978703f42549 ("netfilter: flowtable: Add API for registering to flow table events")
Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
---
include/net/netfilter/nf_flow_table.h | 49 ++++++++++++++++++++++++++++++++---
net/netfilter/nf_flow_table_core.c | 45 --------------------------------
2 files changed, 45 insertions(+), 49 deletions(-)
diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
index c54a7f707e50..8a8f0e64edc3 100644
--- a/include/net/netfilter/nf_flow_table.h
+++ b/include/net/netfilter/nf_flow_table.h
@@ -161,10 +161,51 @@ struct nf_flow_route {
struct flow_offload *flow_offload_alloc(struct nf_conn *ct);
void flow_offload_free(struct flow_offload *flow);
-int nf_flow_table_offload_add_cb(struct nf_flowtable *flow_table,
- flow_setup_cb_t *cb, void *cb_priv);
-void nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table,
- flow_setup_cb_t *cb, void *cb_priv);
+static inline int
+nf_flow_table_offload_add_cb(struct nf_flowtable *flow_table,
+ flow_setup_cb_t *cb, void *cb_priv)
+{
+ struct flow_block *block = &flow_table->flow_block;
+ struct flow_block_cb *block_cb;
+ int err = 0;
+
+ down_write(&flow_table->flow_block_lock);
+ block_cb = flow_block_cb_lookup(block, cb, cb_priv);
+ if (block_cb) {
+ err = -EEXIST;
+ goto unlock;
+ }
+
+ block_cb = flow_block_cb_alloc(cb, cb_priv, cb_priv, NULL);
+ if (IS_ERR(block_cb)) {
+ err = PTR_ERR(block_cb);
+ goto unlock;
+ }
+
+ list_add_tail(&block_cb->list, &block->cb_list);
+
+unlock:
+ up_write(&flow_table->flow_block_lock);
+ return err;
+}
+
+static inline void
+nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table,
+ flow_setup_cb_t *cb, void *cb_priv)
+{
+ struct flow_block *block = &flow_table->flow_block;
+ struct flow_block_cb *block_cb;
+
+ down_write(&flow_table->flow_block_lock);
+ block_cb = flow_block_cb_lookup(block, cb, cb_priv);
+ if (block_cb) {
+ list_del(&block_cb->list);
+ flow_block_cb_free(block_cb);
+ } else {
+ WARN_ON(true);
+ }
+ up_write(&flow_table->flow_block_lock);
+}
int flow_offload_route_init(struct flow_offload *flow,
const struct nf_flow_route *route);
diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index 42da6e337276..647680175213 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -387,51 +387,6 @@ static void nf_flow_offload_work_gc(struct work_struct *work)
queue_delayed_work(system_power_efficient_wq, &flow_table->gc_work, HZ);
}
-int nf_flow_table_offload_add_cb(struct nf_flowtable *flow_table,
- flow_setup_cb_t *cb, void *cb_priv)
-{
- struct flow_block *block = &flow_table->flow_block;
- struct flow_block_cb *block_cb;
- int err = 0;
-
- down_write(&flow_table->flow_block_lock);
- block_cb = flow_block_cb_lookup(block, cb, cb_priv);
- if (block_cb) {
- err = -EEXIST;
- goto unlock;
- }
-
- block_cb = flow_block_cb_alloc(cb, cb_priv, cb_priv, NULL);
- if (IS_ERR(block_cb)) {
- err = PTR_ERR(block_cb);
- goto unlock;
- }
-
- list_add_tail(&block_cb->list, &block->cb_list);
-
-unlock:
- up_write(&flow_table->flow_block_lock);
- return err;
-}
-EXPORT_SYMBOL_GPL(nf_flow_table_offload_add_cb);
-
-void nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table,
- flow_setup_cb_t *cb, void *cb_priv)
-{
- struct flow_block *block = &flow_table->flow_block;
- struct flow_block_cb *block_cb;
-
- down_write(&flow_table->flow_block_lock);
- block_cb = flow_block_cb_lookup(block, cb, cb_priv);
- if (block_cb) {
- list_del(&block_cb->list);
- flow_block_cb_free(block_cb);
- } else {
- WARN_ON(true);
- }
- up_write(&flow_table->flow_block_lock);
-}
-EXPORT_SYMBOL_GPL(nf_flow_table_offload_del_cb);
static int nf_flow_nat_port_tcp(struct sk_buff *skb, unsigned int thoff,
__be16 port, __be16 new_port)
--
2.8.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net 1/2] net/sched: act_ct: Make tcf_ct_flow_table_restore_skb inline
2020-06-14 11:12 ` [PATCH net 1/2] net/sched: act_ct: Make tcf_ct_flow_table_restore_skb inline Roi Dayan
@ 2020-06-15 14:06 ` Marcelo Ricardo Leitner
0 siblings, 0 replies; 6+ messages in thread
From: Marcelo Ricardo Leitner @ 2020-06-15 14:06 UTC (permalink / raw
To: Roi Dayan
Cc: netdev, pablo, davem, Jiri Pirko, Paul Blakey, Oz Shlomo,
Alaa Hleihel
On Sun, Jun 14, 2020 at 02:12:48PM +0300, Roi Dayan wrote:
> From: Alaa Hleihel <alaa@mellanox.com>
>
> Currently, tcf_ct_flow_table_restore_skb is exported by act_ct
> module, therefore modules using it will have hard-dependency
> on act_ct and will require loading it all the time.
>
> This can lead to an unnecessary overhead on systems that do not
> use hardware connection tracking action (ct_metadata action) in
> the first place.
>
> To relax the hard-dependency between the modules, we unexport this
> function and make it a static inline one.
>
> Fixes: 30b0cf90c6dd ("net/sched: act_ct: Support restoring conntrack info on skbs")
> Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
> Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> ---
> include/net/tc_act/tc_ct.h | 11 ++++++++++-
> net/sched/act_ct.c | 11 -----------
> 2 files changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/include/net/tc_act/tc_ct.h b/include/net/tc_act/tc_ct.h
> index 79654bcb9a29..8250d6f0a462 100644
> --- a/include/net/tc_act/tc_ct.h
> +++ b/include/net/tc_act/tc_ct.h
> @@ -66,7 +66,16 @@ static inline struct nf_flowtable *tcf_ct_ft(const struct tc_action *a)
> #endif /* CONFIG_NF_CONNTRACK */
>
> #if IS_ENABLED(CONFIG_NET_ACT_CT)
> -void tcf_ct_flow_table_restore_skb(struct sk_buff *skb, unsigned long cookie);
> +static inline void
> +tcf_ct_flow_table_restore_skb(struct sk_buff *skb, unsigned long cookie)
> +{
> + enum ip_conntrack_info ctinfo = cookie & NFCT_INFOMASK;
> + struct nf_conn *ct;
> +
> + ct = (struct nf_conn *)(cookie & NFCT_PTRMASK);
> + nf_conntrack_get(&ct->ct_general);
> + nf_ct_set(skb, ct, ctinfo);
> +}
> #else
> static inline void
> tcf_ct_flow_table_restore_skb(struct sk_buff *skb, unsigned long cookie) { }
> diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
> index e29f0f45d688..e9f3576cbf71 100644
> --- a/net/sched/act_ct.c
> +++ b/net/sched/act_ct.c
> @@ -1543,17 +1543,6 @@ static void __exit ct_cleanup_module(void)
> destroy_workqueue(act_ct_wq);
> }
>
> -void tcf_ct_flow_table_restore_skb(struct sk_buff *skb, unsigned long cookie)
> -{
> - enum ip_conntrack_info ctinfo = cookie & NFCT_INFOMASK;
> - struct nf_conn *ct;
> -
> - ct = (struct nf_conn *)(cookie & NFCT_PTRMASK);
> - nf_conntrack_get(&ct->ct_general);
> - nf_ct_set(skb, ct, ctinfo);
> -}
> -EXPORT_SYMBOL_GPL(tcf_ct_flow_table_restore_skb);
> -
> module_init(ct_init_module);
> module_exit(ct_cleanup_module);
> MODULE_AUTHOR("Paul Blakey <paulb@mellanox.com>");
> --
> 2.8.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net 2/2] netfilter: flowtable: Make nf_flow_table_offload_add/del_cb inline
2020-06-14 11:12 ` [PATCH net 2/2] netfilter: flowtable: Make nf_flow_table_offload_add/del_cb inline Roi Dayan
@ 2020-06-15 14:24 ` Marcelo Ricardo Leitner
0 siblings, 0 replies; 6+ messages in thread
From: Marcelo Ricardo Leitner @ 2020-06-15 14:24 UTC (permalink / raw
To: Roi Dayan
Cc: netdev, pablo, davem, Jiri Pirko, Paul Blakey, Oz Shlomo,
Alaa Hleihel
On Sun, Jun 14, 2020 at 02:12:49PM +0300, Roi Dayan wrote:
> From: Alaa Hleihel <alaa@mellanox.com>
>
> Currently, nf_flow_table_offload_add/del_cb are exported by nf_flow_table
> module, therefore modules using them will have hard-dependency
> on nf_flow_table and will require loading it all the time.
>
> This can lead to an unnecessary overhead on systems that do not
> use this API.
>
> To relax the hard-dependency between the modules, we unexport these
> functions and make them static inline.
>
> Fixes: 978703f42549 ("netfilter: flowtable: Add API for registering to flow table events")
> Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
> Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> ---
> include/net/netfilter/nf_flow_table.h | 49 ++++++++++++++++++++++++++++++++---
> net/netfilter/nf_flow_table_core.c | 45 --------------------------------
> 2 files changed, 45 insertions(+), 49 deletions(-)
>
> diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
> index c54a7f707e50..8a8f0e64edc3 100644
> --- a/include/net/netfilter/nf_flow_table.h
> +++ b/include/net/netfilter/nf_flow_table.h
> @@ -161,10 +161,51 @@ struct nf_flow_route {
> struct flow_offload *flow_offload_alloc(struct nf_conn *ct);
> void flow_offload_free(struct flow_offload *flow);
>
> -int nf_flow_table_offload_add_cb(struct nf_flowtable *flow_table,
> - flow_setup_cb_t *cb, void *cb_priv);
> -void nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table,
> - flow_setup_cb_t *cb, void *cb_priv);
> +static inline int
> +nf_flow_table_offload_add_cb(struct nf_flowtable *flow_table,
> + flow_setup_cb_t *cb, void *cb_priv)
> +{
> + struct flow_block *block = &flow_table->flow_block;
> + struct flow_block_cb *block_cb;
> + int err = 0;
> +
> + down_write(&flow_table->flow_block_lock);
> + block_cb = flow_block_cb_lookup(block, cb, cb_priv);
> + if (block_cb) {
> + err = -EEXIST;
> + goto unlock;
> + }
> +
> + block_cb = flow_block_cb_alloc(cb, cb_priv, cb_priv, NULL);
> + if (IS_ERR(block_cb)) {
> + err = PTR_ERR(block_cb);
> + goto unlock;
> + }
> +
> + list_add_tail(&block_cb->list, &block->cb_list);
> +
> +unlock:
> + up_write(&flow_table->flow_block_lock);
> + return err;
> +}
> +
> +static inline void
> +nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table,
> + flow_setup_cb_t *cb, void *cb_priv)
> +{
> + struct flow_block *block = &flow_table->flow_block;
> + struct flow_block_cb *block_cb;
> +
> + down_write(&flow_table->flow_block_lock);
> + block_cb = flow_block_cb_lookup(block, cb, cb_priv);
> + if (block_cb) {
> + list_del(&block_cb->list);
> + flow_block_cb_free(block_cb);
> + } else {
> + WARN_ON(true);
> + }
> + up_write(&flow_table->flow_block_lock);
> +}
>
> int flow_offload_route_init(struct flow_offload *flow,
> const struct nf_flow_route *route);
> diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
> index 42da6e337276..647680175213 100644
> --- a/net/netfilter/nf_flow_table_core.c
> +++ b/net/netfilter/nf_flow_table_core.c
> @@ -387,51 +387,6 @@ static void nf_flow_offload_work_gc(struct work_struct *work)
> queue_delayed_work(system_power_efficient_wq, &flow_table->gc_work, HZ);
> }
>
> -int nf_flow_table_offload_add_cb(struct nf_flowtable *flow_table,
> - flow_setup_cb_t *cb, void *cb_priv)
> -{
> - struct flow_block *block = &flow_table->flow_block;
> - struct flow_block_cb *block_cb;
> - int err = 0;
> -
> - down_write(&flow_table->flow_block_lock);
> - block_cb = flow_block_cb_lookup(block, cb, cb_priv);
> - if (block_cb) {
> - err = -EEXIST;
> - goto unlock;
> - }
> -
> - block_cb = flow_block_cb_alloc(cb, cb_priv, cb_priv, NULL);
> - if (IS_ERR(block_cb)) {
> - err = PTR_ERR(block_cb);
> - goto unlock;
> - }
> -
> - list_add_tail(&block_cb->list, &block->cb_list);
> -
> -unlock:
> - up_write(&flow_table->flow_block_lock);
> - return err;
> -}
> -EXPORT_SYMBOL_GPL(nf_flow_table_offload_add_cb);
> -
> -void nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table,
> - flow_setup_cb_t *cb, void *cb_priv)
> -{
> - struct flow_block *block = &flow_table->flow_block;
> - struct flow_block_cb *block_cb;
> -
> - down_write(&flow_table->flow_block_lock);
> - block_cb = flow_block_cb_lookup(block, cb, cb_priv);
> - if (block_cb) {
> - list_del(&block_cb->list);
> - flow_block_cb_free(block_cb);
> - } else {
> - WARN_ON(true);
> - }
> - up_write(&flow_table->flow_block_lock);
> -}
> -EXPORT_SYMBOL_GPL(nf_flow_table_offload_del_cb);
>
> static int nf_flow_nat_port_tcp(struct sk_buff *skb, unsigned int thoff,
> __be16 port, __be16 new_port)
> --
> 2.8.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net 0/2] remove dependency between mlx5, act_ct, nf_flow_table
2020-06-14 11:12 [PATCH net 0/2] remove dependency between mlx5, act_ct, nf_flow_table Roi Dayan
2020-06-14 11:12 ` [PATCH net 1/2] net/sched: act_ct: Make tcf_ct_flow_table_restore_skb inline Roi Dayan
2020-06-14 11:12 ` [PATCH net 2/2] netfilter: flowtable: Make nf_flow_table_offload_add/del_cb inline Roi Dayan
@ 2020-06-16 1:07 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-06-16 1:07 UTC (permalink / raw
To: roid; +Cc: netdev, pablo, jiri, paulb, ozsh, mleitner, alaa
From: Roi Dayan <roid@mellanox.com>
Date: Sun, 14 Jun 2020 14:12:47 +0300
> Some exported functions from act_ct and nf_flow_table being used in mlx5_core.
> This leads that mlx5 module always require act_ct and nf_flow_table modules.
> Those small exported functions can be moved to the header files to
> avoid this module dependency.
Series applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-06-16 1:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-14 11:12 [PATCH net 0/2] remove dependency between mlx5, act_ct, nf_flow_table Roi Dayan
2020-06-14 11:12 ` [PATCH net 1/2] net/sched: act_ct: Make tcf_ct_flow_table_restore_skb inline Roi Dayan
2020-06-15 14:06 ` Marcelo Ricardo Leitner
2020-06-14 11:12 ` [PATCH net 2/2] netfilter: flowtable: Make nf_flow_table_offload_add/del_cb inline Roi Dayan
2020-06-15 14:24 ` Marcelo Ricardo Leitner
2020-06-16 1:07 ` [PATCH net 0/2] remove dependency between mlx5, act_ct, nf_flow_table David Miller
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.