Message ID | 1406756298.3178.52.camel@edumazet-glaptop2.roam.corp.google.com |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Wed, 30 Jul 2014 23:38:18 +0200 > From: Eric Dumazet <edumazet@google.com> > > Remove '__' prefix, it has no purpose. > > Signed-off-by: Eric Dumazet <edumazet@google.com> Actually, I think it does. If you look at where this came from, it's commit: commit b50026b5ac8fe2932e6af0c54b21da0913c4c1c7 Author: Hannes Frederic Sowa <hannes@stressinduktion.org> Date: Sat Oct 19 21:48:52 2013 +0200 ipv6: split inet6_ehashfn to hash functions per compilation unit and in that change Hannes uses the convention that __foo() functions take an initval argument for the hash computation where as foo() functions do not. I'm not applying this, sorry :) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 2014-07-31 at 21:56 -0700, David Miller wrote: > From: Eric Dumazet <eric.dumazet@gmail.com> > Date: Wed, 30 Jul 2014 23:38:18 +0200 > > > From: Eric Dumazet <edumazet@google.com> > > > > Remove '__' prefix, it has no purpose. > > > > Signed-off-by: Eric Dumazet <edumazet@google.com> > > Actually, I think it does. > > If you look at where this came from, it's commit: > > commit b50026b5ac8fe2932e6af0c54b21da0913c4c1c7 > Author: Hannes Frederic Sowa <hannes@stressinduktion.org> > Date: Sat Oct 19 21:48:52 2013 +0200 > > ipv6: split inet6_ehashfn to hash functions per compilation unit > > and in that change Hannes uses the convention that __foo() functions > take an initval argument for the hash computation where as foo() > functions do not. > > I'm not applying this, sorry :) Well, there is no ipv6_addr_jhash() anymore. Should we rename jhash() to __jhash() then ???? This seems pretty odd and useless. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, On Fri, Aug 1, 2014, at 06:56, David Miller wrote: > From: Eric Dumazet <eric.dumazet@gmail.com> > Date: Wed, 30 Jul 2014 23:38:18 +0200 > > > From: Eric Dumazet <edumazet@google.com> > > > > Remove '__' prefix, it has no purpose. > > > > Signed-off-by: Eric Dumazet <edumazet@google.com> > > Actually, I think it does. > > If you look at where this came from, it's commit: > > commit b50026b5ac8fe2932e6af0c54b21da0913c4c1c7 > Author: Hannes Frederic Sowa <hannes@stressinduktion.org> > Date: Sat Oct 19 21:48:52 2013 +0200 > > ipv6: split inet6_ehashfn to hash functions per compilation unit > > and in that change Hannes uses the convention that __foo() functions > take an initval argument for the hash computation where as foo() > functions do not. > > I'm not applying this, sorry :) The idea was that all the hashing functions (like socket hashing etc.) provide the secret to ipv6_addr_jhash and thus this function should not be called directly but by helper functions. I normally use '__' prefixed function which need a bit more care to handle them correctly (e.g. unlocked versions, argument hiding etc.) and I think this was also the reason I did so at that time. That said, nowadays most hashing functions need (should have) a secret in the network stack and programmers should already know how to deal with that. I don't have a strong opinion on that but would be fine if you apply Eric's patch. Thanks, Hannes -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index a2db816e8461..c956e4ee4aa0 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -540,7 +540,7 @@ static inline u32 ipv6_addr_hash(const struct in6_addr *a) } /* more secured version of ipv6_addr_hash() */ -static inline u32 __ipv6_addr_jhash(const struct in6_addr *a, const u32 initval) +static inline u32 ipv6_addr_jhash(const struct in6_addr *a, const u32 initval) { u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1]; diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index 262e13c02ec2..96f7d07a3267 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c @@ -38,7 +38,7 @@ static unsigned int inet6_ehashfn(struct net *net, net_get_random_once(&ipv6_hash_secret, sizeof(ipv6_hash_secret)); lhash = (__force u32)laddr->s6_addr32[3]; - fhash = __ipv6_addr_jhash(faddr, ipv6_hash_secret); + fhash = ipv6_addr_jhash(faddr, ipv6_hash_secret); return __inet6_ehashfn(lhash, lport, fhash, fport, inet6_ehash_secret + net_hash_mix(net)); diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index f5dafe609f8b..bbd16185411b 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -545,8 +545,8 @@ static void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt) net_get_random_once(&ip6_idents_hashrnd, sizeof(ip6_idents_hashrnd)); - hash = __ipv6_addr_jhash(&rt->rt6i_dst.addr, ip6_idents_hashrnd); - hash = __ipv6_addr_jhash(&rt->rt6i_src.addr, hash); + hash = ipv6_addr_jhash(&rt->rt6i_dst.addr, ip6_idents_hashrnd); + hash = ipv6_addr_jhash(&rt->rt6i_src.addr, hash); id = ip_idents_reserve(hash, 1); fhdr->identification = htonl(id); diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 5b6091de5868..cbedc59ced26 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -70,7 +70,7 @@ static unsigned int udp6_ehashfn(struct net *net, sizeof(udp_ipv6_hash_secret)); lhash = (__force u32)laddr->s6_addr32[3]; - fhash = __ipv6_addr_jhash(faddr, udp_ipv6_hash_secret); + fhash = ipv6_addr_jhash(faddr, udp_ipv6_hash_secret); return __inet6_ehashfn(lhash, lport, fhash, fport, udp_ipv6_hash_secret + net_hash_mix(net));