aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-03-18 17:05:33 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-18 22:00:34 -0400
commit6eada0110c8984477f5f1e57a0b7f7b2fc841e30 (patch)
treeb7f6118fe6d137d56a2264fb81a8f5718236abb9 /include/net
parent8f6320de5f6a817ba360be6ae39f721c7f9b26fb (diff)
netns: constify net_hash_mix() and various callers
const qualifiers ease code review by making clear which objects are not written in a function. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/inet_hashtables.h6
-rw-r--r--include/net/netns/hash.h4
2 files changed, 5 insertions, 5 deletions
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index bcd64756e5fe..eb1963af0ebd 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -221,8 +221,8 @@ inet_bind_bucket_create(struct kmem_cache *cachep, struct net *net,
221void inet_bind_bucket_destroy(struct kmem_cache *cachep, 221void inet_bind_bucket_destroy(struct kmem_cache *cachep,
222 struct inet_bind_bucket *tb); 222 struct inet_bind_bucket *tb);
223 223
224static inline int inet_bhashfn(struct net *net, const __u16 lport, 224static inline u32 inet_bhashfn(const struct net *net, const __u16 lport,
225 const int bhash_size) 225 const u32 bhash_size)
226{ 226{
227 return (lport + net_hash_mix(net)) & (bhash_size - 1); 227 return (lport + net_hash_mix(net)) & (bhash_size - 1);
228} 228}
@@ -231,7 +231,7 @@ void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
231 const unsigned short snum); 231 const unsigned short snum);
232 232
233/* These can have wildcards, don't try too hard. */ 233/* These can have wildcards, don't try too hard. */
234static inline int inet_lhashfn(struct net *net, const unsigned short num) 234static inline u32 inet_lhashfn(const struct net *net, const unsigned short num)
235{ 235{
236 return (num + net_hash_mix(net)) & (INET_LHTABLE_SIZE - 1); 236 return (num + net_hash_mix(net)) & (INET_LHTABLE_SIZE - 1);
237} 237}
diff --git a/include/net/netns/hash.h b/include/net/netns/hash.h
index c06ac58ca107..69a6715d9f3f 100644
--- a/include/net/netns/hash.h
+++ b/include/net/netns/hash.h
@@ -5,7 +5,7 @@
5 5
6struct net; 6struct net;
7 7
8static inline unsigned int net_hash_mix(struct net *net) 8static inline u32 net_hash_mix(const struct net *net)
9{ 9{
10#ifdef CONFIG_NET_NS 10#ifdef CONFIG_NET_NS
11 /* 11 /*
@@ -13,7 +13,7 @@ static inline unsigned int net_hash_mix(struct net *net)
13 * always zeroed 13 * always zeroed
14 */ 14 */
15 15
16 return (unsigned)(((unsigned long)net) >> L1_CACHE_SHIFT); 16 return (u32)(((unsigned long)net) >> L1_CACHE_SHIFT);
17#else 17#else
18 return 0; 18 return 0;
19#endif 19#endif