netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fan Du <fan.du@windriver.com>
To: <nicolas.dichtel@6wind.com>
Cc: <davem@davemloft.net>, <yoshfuji@linux-ipv6.org>,
	<jmorris@namei.org>, <steffen.klassert@secunet.com>,
	<netdev@vger.kernel.org>
Subject: Re: [RFC PATCH net-next V2] net: split rt_genid for ipv4 and ipv6
Date: Wed, 24 Jul 2013 09:30:26 +0800	[thread overview]
Message-ID: <51EF2E32.8020606@windriver.com> (raw)
In-Reply-To: <51EEFAF9.2030300@6wind.com>



On 2013年07月24日 05:51, Nicolas Dichtel wrote:
> Le 23/07/2013 03:37, Fan Du a écrit :
>> Current net name space has only one genid for both IPv4 and IPv6, it has below drawbacks:
>>
>> - Add/delete an IPv4 address will invalidate all IPv6 routing table entries.
>> - Insert/remove XFRM policy will also invalidate both IPv4/IPv6 routing table entries
>> even when the policy is only applied for one address family.
>>
>> Thus, this patch attempt to split one genid for two to cater for IPv4 and IPv6 separately
>> in a fine granularity.
>>
>> Signed-off-by: Fan Du <fan.du@windriver.com>
>>
>> V2:
>> -Fix compile issue when IPv6 not enabled
>> -Put genid into struct netns_ipv4/ipv6
>> ---
>> include/net/net_namespace.h | 39 ++++++++++++++++++++++++++++++++++-----
>> include/net/netns/ipv4.h | 1 +
>> include/net/netns/ipv6.h | 1 +
>> net/ipv4/route.c | 16 ++++++++--------
>> net/ipv6/af_inet6.c | 1 +
>> net/ipv6/route.c | 4 ++--
>> net/xfrm/xfrm_policy.c | 8 +++++++-
>> 7 files changed, 54 insertions(+), 16 deletions(-)
>>
>> diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
>> index 84e37b1..763e63f 100644
>> --- a/include/net/net_namespace.h
>> +++ b/include/net/net_namespace.h
>> @@ -119,7 +119,6 @@ struct net {
>> struct netns_ipvs *ipvs;
>> #endif
>> struct sock *diag_nlsk;
>> - atomic_t rt_genid;
>> atomic_t fnhe_genid;
>> };
>>
>> @@ -333,14 +332,44 @@ static inline void unregister_net_sysctl_table(struct ctl_table_header *header)
>> }
>> #endif
>>
>> -static inline int rt_genid(struct net *net)
>> +static inline int rt_genid_ipv4(struct net *net)
>> {
>> - return atomic_read(&net->rt_genid);
>> + return atomic_read(&net->ipv4.rt_genid_ipv4);
>> }
>>
>> -static inline void rt_genid_bump(struct net *net)
>> +static inline void rt_genid_bump_ipv4(struct net *net)
>> {
>> - atomic_inc(&net->rt_genid);
>> + atomic_inc(&net->ipv4.rt_genid_ipv4);
>> +}
>> +
>> +#if IS_ENABLED(CONFIG_IPV6)
>> +static inline int rt_genid_ipv6(struct net *net)
>> +{
>> + return atomic_read(&net->ipv6.rt_genid_ipv6);
>> +}
>> +
>> +static inline void rt_genid_bump_ipv6(struct net *net)
>> +{
>> + atomic_inc(&net->ipv6.rt_genid_ipv6);
>> +}
>> +#else
>> +static inline int rt_genid_ipv6(struct net *net)
>> +{
>> + return 0;
>> +}
>> +
>> +static inline void rt_genid_bump_ipv6(struct net *net)
>> +{
>> +}
>> +#endif
>> +
>> +/* For callers who don't really care about whether it's IPv4 or IPv6 */
>> +static inline void rt_genid_bump_all(struct net *net)
>> +{
>> + atomic_inc(&net->ipv4.rt_genid_ipv4);
>> +#if IS_ENABLED(CONFIG_IPV6)
>> + atomic_inc(&net->ipv6.rt_genid_ipv6);
>> +#endif
>> }
>>
>> static inline int fnhe_genid(struct net *net)
>> diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
>> index 2ba9de8..d87af01 100644
>> --- a/include/net/netns/ipv4.h
>> +++ b/include/net/netns/ipv4.h
>> @@ -77,5 +77,6 @@ struct netns_ipv4 {
>> struct fib_rules_ops *mr_rules_ops;
>> #endif
>> #endif
>> + atomic_t rt_genid_ipv4;
> Just nitpiking: maybe _ipv4 is redundant? It's already in 'struct netns_ipv4'.
> Same for IPv6.
>
Hallo Nicolas

That's not nitpicking at all :), will chop _ipv4/6 off in next version.
Thanks for your comments.

-- 
浮沉随浪只记今朝笑

--fan

      reply	other threads:[~2013-07-24  1:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23  1:37 Fan Du
2013-07-23  2:04 ` Hannes Frederic Sowa
2013-07-24  8:12   ` Fan Du
2013-07-23 21:51 ` Nicolas Dichtel
2013-07-24  1:30   ` Fan Du [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51EF2E32.8020606@windriver.com \
    --to=fan.du@windriver.com \
    --cc=davem@davemloft.net \
    --cc=jmorris@namei.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=steffen.klassert@secunet.com \
    --cc=yoshfuji@linux-ipv6.org \
    --subject='Re: [RFC PATCH net-next V2] net: split rt_genid for ipv4 and ipv6' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).