neighbour: always have struct net pointer in struct neigh_parms
Subsystems (2)
PATCH 1/1 neighbour: always have struct net pointer in struct neigh_parms
This fixes compile error when CONFIG_NET_NS is not set.
Introduced by:
commit 1d4c8c29841b9991cdf3c7cc4ba7f96a94f104ca
"neigh: restore old behaviour of default parms values"
--- include/net/neighbour.h | 2 -- 1 file changed, 2 deletions(-)
include/net/neighbour.h +0 -2
@@ -65,9 +65,7 @@ enum { };struct neigh_parms { -#ifdef CONFIG_NET_NS struct net *net; -#endif struct net_device *dev;struct neigh_parms *next;int (*neigh_setup)(struct neighbour *);
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Jiri Pirko <[email protected]>
Date: Tue, 10 Dec 2013 08:44:57 +0100
Quoted 7 lines
This fixes compile error when
CONFIG_NET_NSis not set.Introduced by:
commit1d4c8c29841b9991cdf3c7cc4ba7f96a94f104ca
"neigh: restore old behaviour of default parms values"Signed-off-by Jiri Pirko <[email protected]>
Jiri please don't fix things this way.
When network name spaces are disabled, you're supposed to abstract all of this stuff away behind accessor macros so that it is truly zero cost.
For example, look at how "dev_net()" and related helpers works.
This means you need to do something like:
/*
* Net namespace inlines
*/
static inline
struct net *neigh_parms_net(const struct neigh_parms *np)
{
return read_pnet(&np->net);
}static inline
void neigh_parms_net_set(struct neigh_parms *np, struct net *net) {
#ifdef CONFIG_NET_NS release_net(np->net); np->net = hold_net(net);
#endif
}
And then use these helpers consistently in your new code.
Thanks.
Quoted 33 lines · Tue, Dec 10, 2013 at 08:45:38PM CET, [email protected] wrote:
From: Jiri Pirko <[email protected]>
Date: Tue, 10 Dec 2013 08:44:57 +0100Quoted 7 lines
This fixes compile error when
CONFIG_NET_NSis not set.Introduced by:
commit1d4c8c29841b9991cdf3c7cc4ba7f96a94f104ca
"neigh: restore old behaviour of default parms values"Signed-off-by Jiri Pirko <[email protected]>Jiri please don't fix things this way.
When network name spaces are disabled, you're supposed to abstract all of this stuff away behind accessor macros so that it is truly zero cost.
For example, look at how "
dev_net()" and related helpers works.This means you need to do something like:
/*
* Net namespace inlines
*/
static inline
struct net *neigh_parms_net(const structneigh_parms*np){ return read_pnet(&np->net); }static inline
voidneigh_parms_net_set(struct neigh_parms *np, struct net *net){
Quoted 7 lines
#ifdef CONFIG_NET_NS release_net(np->net); np->net = hold_net(net);#endif
}And then use these helpers consistently in your new code.
Will do. Thanks.
Quoted 2 lines
Thanks.