can: network namespace support for CAN gateway
Subsystems (3)
Oliver Hartkopp
maintainerPATCH 1/2 can: network namespace support for CAN gateway
This patch enables the CAN gateway to be used in different namespaces.
--- include/net/netns/can.h | 3 ++ net/can/gw.c | 73 +++++++++++++++++++++++++++++++------------------ 2 files changed, 49 insertions(+), 27 deletions(-)
include/net/netns/can.h +3 -0
@@ -32,6 +32,9 @@ struct netns_can {struct timer_list can_stattimer;/* timer for statistics update */ struct s_stats *can_stats;/* packet statistics */ struct s_pstats *can_pstats;/* receive list statistics */ + +/* CAN GW per-net gateway jobs */ + struct hlist_head cgw_list; };#endif /* __NETNS_CAN_H__ */
net/can/gw.c +46 -27
211 lines not on this page · raw message
Signature · 1 line
2.11.0
Oliver Hartkopp
maintainerPATCH 2/2 can: remove obsolete pernet_operations definitions
--- net/can/af_can.c | 4 ---- net/can/bcm.c | 4 ---- net/can/gw.c | 3 --- 3 files changed, 11 deletions(-)
net/can/af_can.c +0 -4
@@ -75,8 +75,6 @@ static int stats_timer __read_mostly = 1;module_param (stats_timer, int,S_IRUGO );MODULE_PARM_DESC (stats_timer,"enable timer for statistics (default:on)" ); -static int can_net_id; -static struct kmem_cache *rcv_cache__read_mostly ;/* table of registered CAN protocols */
@@ -953,8 +951,6 @@ static struct notifier_block can_netdev_notifier __read_mostly = {static struct pernet_operations can_pernet_ops__read_mostly = { .init = can_pernet_init, .exit = can_pernet_exit, - .id = &can_net_id, - .size =0 , };static __init int can_init (void )
net/can/bcm.c +0 -4
@@ -84,8 +84,6 @@ MODULE_LICENSE("Dual BSD/GPL");MODULE_AUTHOR ("Oliver Hartkopp <[email protected]>" );MODULE_ALIAS ("can-proto-2" ); -static int canbcm_net_id; -/* * easy access to the first 64 bit of can(fd)_frame payload. cp->data is * 64 bit aligned so the offset has to be multiples of 8 which is ensured
@@ -1714,8 +1712,6 @@ static void canbcm_pernet_exit(struct net *net)static struct pernet_operations canbcm_pernet_ops__read_mostly = { .init = canbcm_pernet_init, .exit = canbcm_pernet_exit, - .id = &canbcm_net_id, - .size =0 , };static int __init bcm_module_init (void )
net/can/gw.c +0 -3
@@ -79,7 +79,6 @@ MODULE_PARM_DESC(max_hops, __stringify(CGW_MAX_HOPS) " hops, " "default: " __stringify(CGW_DEFAULT_HOPS) ")"); -static int cangw_net_id;static struct notifier_block notifier;static struct kmem_cache *cgw_cache__read_mostly ;
@@ -1009,8 +1008,6 @@ static void __net_exit cangw_pernet_exit(struct net *net)static struct pernet_operations cangw_pernet_ops = { .init = cangw_pernet_init, .exit = cangw_pernet_exit, - .id = &cangw_net_id, - .size =0 , };static __init int cgw_module_init (void )
Signature · 1 line
2.11.0
Oliver Hartkopp
maintainerPATCH 2/2 can: remove obsolete pernet_operations definitions
Hi Mario,
I forgot to put you on CC.
Please review this patch. AFAIK when ".size = 0" there's no extra memory allocated by the system. And therefore ".id" is obsolete.
Looking at other code in the kernel you have to provide both values (!= zero/NULL) to let this assignment take any effect.
As we have all our 'per-net' stuff integrated in net->can structure there is no need to provide ".id" and ".size", right?
Regards,
Oliver
-------- Forwarded Message --------
Subject: [PATCH 2/2] can: remove obsolete pernet_operations definitions
Date: Mon, 24 Apr 2017 15:09:00 +0200
From: Oliver Hartkopp <[email protected]>
To: [email protected]
CC: Oliver Hartkopp <[email protected]>
--- net/can/af_can.c | 4 ---- net/can/bcm.c | 4 ---- net/can/gw.c | 3 --- 3 files changed, 11 deletions(-)
net/can/af_can.c +0 -3
@@ -75,8 +75,6 @@ static int stats_timer __read_mostly = 1;module_param (stats_timer, int,S_IRUGO );MODULE_PARM_DESC (stats_timer,"enable timer for statistics (default:on)" ); -static int can_net_id; -static struct kmem_cache *rcv_cache__read_mostly ;/* table of registered CAN protocols */
@@ -953,8 +951,6 @@ static struct notifier_block can_netdev_notifier __read_mostly = {static struct pernet_operations can_pernet_ops__read_mostly = { .init = can_pernet_init, .exit = can_pernet_exit, - .id = &can_net_id, - .size =0 , };static __init int can_init (void )
net/can/bcm.c +0 -3
@@ -84,8 +84,6 @@ MODULE_LICENSE("Dual BSD/GPL");MODULE_AUTHOR ("Oliver Hartkopp <[email protected]>" );MODULE_ALIAS ("can-proto-2" ); -static int canbcm_net_id; -/* * easy access to the first 64 bit of can(fd)_frame payload. cp->data is * 64 bit aligned so the offset has to be multiples of 8 which is ensured
@@ -1714,8 +1712,6 @@ static void canbcm_pernet_exit(struct net *net)static struct pernet_operations canbcm_pernet_ops__read_mostly = { .init = canbcm_pernet_init, .exit = canbcm_pernet_exit, - .id = &canbcm_net_id, - .size =0 , };static int __init bcm_module_init (void )
net/can/gw.c +0 -0
@@ -79,7 +79,6 @@ MODULE_PARM_DESC(max_hops, __stringify(CGW_MAX_HOPS) " hops, " "default: " __stringify(CGW_DEFAULT_HOPS) ")"); -static int cangw_net_id;static struct notifier_block notifier;static struct kmem_cache *cgw_cache__read_mostly ; @@ -1009,8 +1008,6 @@ static void __net_exit cangw_pernet_exit(struct
net *net)
static struct pernet_operations cangw_pernet_ops = {
.init = cangw_pernet_init,
.exit = cangw_pernet_exit,
- .id = &cangw_net_id,
- .size = 0,
};
static __init int cgw_module_init(void)
Signature · 1 line
2.11.0