-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arnaldo Carvalho de Melo
authored and
David S. Miller
committed
Aug 29, 2005
1 parent
b74351b
commit b40851d
Showing
3 changed files
with
46 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 0597f2680d666a3bcf101ac0c771ba7e50016bbd | ||
refs/heads/master: 304a16180fb6d2b153b45f6fbbcec1fa814496e5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* INET An implementation of the TCP/IP protocol suite for the LINUX | ||
* operating system. INET is implemented using the BSD Socket | ||
* interface as the means of communication with the user level. | ||
* | ||
* Authors: Lotsa people, from code originally in tcp | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version | ||
* 2 of the License, or (at your option) any later version. | ||
*/ | ||
|
||
#ifndef _INET_HASHTABLES_H | ||
#define _INET_HASHTABLES_H | ||
|
||
#include <linux/types.h> | ||
|
||
static inline int inet_ehashfn(const __u32 laddr, const __u16 lport, | ||
const __u32 faddr, const __u16 fport, | ||
const int ehash_size) | ||
{ | ||
int h = (laddr ^ lport) ^ (faddr ^ fport); | ||
h ^= h >> 16; | ||
h ^= h >> 8; | ||
return h & (ehash_size - 1); | ||
} | ||
|
||
static inline int inet_sk_ehashfn(const struct sock *sk, const int ehash_size) | ||
{ | ||
const struct inet_sock *inet = inet_sk(sk); | ||
const __u32 laddr = inet->rcv_saddr; | ||
const __u16 lport = inet->num; | ||
const __u32 faddr = inet->daddr; | ||
const __u16 fport = inet->dport; | ||
|
||
return inet_ehashfn(laddr, lport, faddr, fport, ehash_size); | ||
} | ||
|
||
#endif /* _INET_HASHTABLES_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters