summaryrefslogtreecommitdiffstats
path: root/include/linux/skbuff.h
diff options
context:
space:
mode:
authorTom Herbert2015-08-01 01:52:10 +0200
committerDavid S. Miller2015-08-01 02:07:11 +0200
commitf70ea018da0631e10c26a02f5a82d626ffef5bd7 (patch)
tree7e7df0357c66c6e4824707233faedf96f89fde5e /include/linux/skbuff.h
parentMerge branch 'dsa-netconsole' (diff)
downloadkernel-qcow2-linux-f70ea018da0631e10c26a02f5a82d626ffef5bd7.tar.gz
kernel-qcow2-linux-f70ea018da0631e10c26a02f5a82d626ffef5bd7.tar.xz
kernel-qcow2-linux-f70ea018da0631e10c26a02f5a82d626ffef5bd7.zip
net: Add functions to get skb->hash based on flow structures
Add skb_get_hash_flowi6 and skb_get_hash_flowi4 which derive an sk_buff hash from flowi6 and flowi4 structures respectively. These functions can be called when creating a packet in the output path where the new sk_buff does not yet contain a fully formed packet that is parsable by flow dissector. Signed-off-by: Tom Herbert <tom@herbertland.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r--include/linux/skbuff.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 648a2c241993..b7c1286e247d 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -37,6 +37,7 @@
#include <net/flow_dissector.h>
#include <linux/splice.h>
#include <linux/in6.h>
+#include <net/flow.h>
/* A. Checksumming of received packets by device.
*
@@ -945,6 +946,26 @@ static inline __u32 skb_get_hash(struct sk_buff *skb)
return skb->hash;
}
+__u32 __skb_get_hash_flowi6(struct sk_buff *skb, struct flowi6 *fl6);
+
+static inline __u32 skb_get_hash_flowi6(struct sk_buff *skb, struct flowi6 *fl6)
+{
+ if (!skb->l4_hash && !skb->sw_hash)
+ __skb_get_hash_flowi6(skb, fl6);
+
+ return skb->hash;
+}
+
+__u32 __skb_get_hash_flowi4(struct sk_buff *skb, struct flowi4 *fl);
+
+static inline __u32 skb_get_hash_flowi4(struct sk_buff *skb, struct flowi4 *fl4)
+{
+ if (!skb->l4_hash && !skb->sw_hash)
+ __skb_get_hash_flowi4(skb, fl4);
+
+ return skb->hash;
+}
+
__u32 skb_get_hash_perturb(const struct sk_buff *skb, u32 perturb);
static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)