flowi: Abstract out functions to get flow hash based on flowi

Create __get_hash_from_flowi6 and __get_hash_from_flowi4 to get the
flow keys and hash based on flowi structures. These are called by
__skb_get_hash_flowi6 and __skb_get_hash_flowi4. Also, created
get_hash_from_flowi6 and get_hash_from_flowi4 which can be called
when just the hash value for a flowi is needed.

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Tom Herbert 2015-09-01 09:24:25 -07:00 committed by David S. Miller
parent bcc83839ff
commit c6cc1ca7f4
4 changed files with 69 additions and 4 deletions

View file

@ -10,6 +10,7 @@
#include <linux/socket.h>
#include <linux/in6.h>
#include <linux/atomic.h>
#include <net/flow_dissector.h>
/*
* ifindex generation is per-net namespace, and loopback is
@ -243,4 +244,22 @@ void flow_cache_flush(struct net *net);
void flow_cache_flush_deferred(struct net *net);
extern atomic_t flow_cache_genid;
__u32 __get_hash_from_flowi6(struct flowi6 *fl6, struct flow_keys *keys);
static inline __u32 get_hash_from_flowi6(struct flowi6 *fl6)
{
struct flow_keys keys;
return __get_hash_from_flowi6(fl6, &keys);
}
__u32 __get_hash_from_flowi4(struct flowi4 *fl4, struct flow_keys *keys);
static inline __u32 get_hash_from_flowi4(struct flowi4 *fl4)
{
struct flow_keys keys;
return __get_hash_from_flowi4(fl4, &keys);
}
#endif