* [patch net-next] neighbour: always have struct net pointer in struct neigh_parms
@ 2013-12-10 7:44 Jiri Pirko
2013-12-10 19:45 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2013-12-10 7:44 UTC (permalink / raw)
To: netdev; +Cc: davem
This fixes compile error when CONFIG_NET_NS is not set.
Introduced by:
commit 1d4c8c29841b9991cdf3c7cc4ba7f96a94f104ca
"neigh: restore old behaviour of default parms values"
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
include/net/neighbour.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 41b1ce6..157c038 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -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 *);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [patch net-next] neighbour: always have struct net pointer in struct neigh_parms
2013-12-10 7:44 [patch net-next] neighbour: always have struct net pointer in struct neigh_parms Jiri Pirko
@ 2013-12-10 19:45 ` David Miller
2013-12-10 19:48 ` Jiri Pirko
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2013-12-10 19:45 UTC (permalink / raw)
To: jiri; +Cc: netdev
From: Jiri Pirko <jiri@resnulli.us>
Date: Tue, 10 Dec 2013 08:44:57 +0100
> This fixes compile error when CONFIG_NET_NS is not set.
>
> Introduced by:
> commit 1d4c8c29841b9991cdf3c7cc4ba7f96a94f104ca
> "neigh: restore old behaviour of default parms values"
>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
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.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch net-next] neighbour: always have struct net pointer in struct neigh_parms
2013-12-10 19:45 ` David Miller
@ 2013-12-10 19:48 ` Jiri Pirko
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2013-12-10 19:48 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Tue, Dec 10, 2013 at 08:45:38PM CET, davem@davemloft.net wrote:
>From: Jiri Pirko <jiri@resnulli.us>
>Date: Tue, 10 Dec 2013 08:44:57 +0100
>
>> This fixes compile error when CONFIG_NET_NS is not set.
>>
>> Introduced by:
>> commit 1d4c8c29841b9991cdf3c7cc4ba7f96a94f104ca
>> "neigh: restore old behaviour of default parms values"
>>
>> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>
>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.
Will do. Thanks.
>
>Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-10 19:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10 7:44 [patch net-next] neighbour: always have struct net pointer in struct neigh_parms Jiri Pirko
2013-12-10 19:45 ` David Miller
2013-12-10 19:48 ` Jiri Pirko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox