Commit 5a17d9ed authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by David S. Miller

flowcache: make flow_key_size() return "unsigned int"

Flow keys aren't 4GB+ numbers so 64-bit arithmetic is excessive.

Space savings (I'm not sure what CSWTCH is):

	add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-48 (-48)
	function                                     old     new   delta
	flow_cache_lookup                           1163    1159      -4
	CSWTCH                                     75997   75953     -44
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d39004ab
...@@ -202,7 +202,7 @@ static inline struct flowi *flowidn_to_flowi(struct flowidn *fldn) ...@@ -202,7 +202,7 @@ static inline struct flowi *flowidn_to_flowi(struct flowidn *fldn)
typedef unsigned long flow_compare_t; typedef unsigned long flow_compare_t;
static inline size_t flow_key_size(u16 family) static inline unsigned int flow_key_size(u16 family)
{ {
switch (family) { switch (family) {
case AF_INET: case AF_INET:
......
...@@ -161,7 +161,7 @@ static void flow_new_hash_rnd(struct flow_cache *fc, ...@@ -161,7 +161,7 @@ static void flow_new_hash_rnd(struct flow_cache *fc,
static u32 flow_hash_code(struct flow_cache *fc, static u32 flow_hash_code(struct flow_cache *fc,
struct flow_cache_percpu *fcp, struct flow_cache_percpu *fcp,
const struct flowi *key, const struct flowi *key,
size_t keysize) unsigned int keysize)
{ {
const u32 *k = (const u32 *) key; const u32 *k = (const u32 *) key;
const u32 length = keysize * sizeof(flow_compare_t) / sizeof(u32); const u32 length = keysize * sizeof(flow_compare_t) / sizeof(u32);
...@@ -174,7 +174,7 @@ static u32 flow_hash_code(struct flow_cache *fc, ...@@ -174,7 +174,7 @@ static u32 flow_hash_code(struct flow_cache *fc,
* important assumptions that we can here, such as alignment. * important assumptions that we can here, such as alignment.
*/ */
static int flow_key_compare(const struct flowi *key1, const struct flowi *key2, static int flow_key_compare(const struct flowi *key1, const struct flowi *key2,
size_t keysize) unsigned int keysize)
{ {
const flow_compare_t *k1, *k1_lim, *k2; const flow_compare_t *k1, *k1_lim, *k2;
...@@ -199,7 +199,7 @@ flow_cache_lookup(struct net *net, const struct flowi *key, u16 family, u8 dir, ...@@ -199,7 +199,7 @@ flow_cache_lookup(struct net *net, const struct flowi *key, u16 family, u8 dir,
struct flow_cache_percpu *fcp; struct flow_cache_percpu *fcp;
struct flow_cache_entry *fle, *tfle; struct flow_cache_entry *fle, *tfle;
struct flow_cache_object *flo; struct flow_cache_object *flo;
size_t keysize; unsigned int keysize;
unsigned int hash; unsigned int hash;
local_bh_disable(); local_bh_disable();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment