Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/sched: act_ct: Make tcf_ct_flow_table_restore_skb inline

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>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Alaa Hleihel and committed by
David S. Miller
762f926d c92cbaea

+10 -12
+10 -1
include/net/tc_act/tc_ct.h
··· 66 66 #endif /* CONFIG_NF_CONNTRACK */ 67 67 68 68 #if IS_ENABLED(CONFIG_NET_ACT_CT) 69 - void tcf_ct_flow_table_restore_skb(struct sk_buff *skb, unsigned long cookie); 69 + static inline void 70 + tcf_ct_flow_table_restore_skb(struct sk_buff *skb, unsigned long cookie) 71 + { 72 + enum ip_conntrack_info ctinfo = cookie & NFCT_INFOMASK; 73 + struct nf_conn *ct; 74 + 75 + ct = (struct nf_conn *)(cookie & NFCT_PTRMASK); 76 + nf_conntrack_get(&ct->ct_general); 77 + nf_ct_set(skb, ct, ctinfo); 78 + } 70 79 #else 71 80 static inline void 72 81 tcf_ct_flow_table_restore_skb(struct sk_buff *skb, unsigned long cookie) { }
-11
net/sched/act_ct.c
··· 1543 1543 destroy_workqueue(act_ct_wq); 1544 1544 } 1545 1545 1546 - void tcf_ct_flow_table_restore_skb(struct sk_buff *skb, unsigned long cookie) 1547 - { 1548 - enum ip_conntrack_info ctinfo = cookie & NFCT_INFOMASK; 1549 - struct nf_conn *ct; 1550 - 1551 - ct = (struct nf_conn *)(cookie & NFCT_PTRMASK); 1552 - nf_conntrack_get(&ct->ct_general); 1553 - nf_ct_set(skb, ct, ctinfo); 1554 - } 1555 - EXPORT_SYMBOL_GPL(tcf_ct_flow_table_restore_skb); 1556 - 1557 1546 module_init(ct_init_module); 1558 1547 module_exit(ct_cleanup_module); 1559 1548 MODULE_AUTHOR("Paul Blakey <paulb@mellanox.com>");