Linux backports project
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: backports@vger.kernel.org
Subject: [PATCH 2/4] backport-include: backport skb_get_hash_perturb
Date: Thu, 16 Nov 2017 15:38:53 +0100	[thread overview]
Message-ID: <20171116143855.12307-2-nbd@nbd.name> (raw)
In-Reply-To: <20171116143855.12307-1-nbd@nbd.name>

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/skbuff.h | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h
index 61f3b98f..034206b6 100644
--- a/backport/backport-include/linux/skbuff.h
+++ b/backport/backport-include/linux/skbuff.h
@@ -306,14 +306,28 @@ static inline void skb_free_frag(void *data)
 	put_page(virt_to_head_page(data));
 }
 
-/* iwlwifi doesn't need this function, so it's safe to just return 0 */
-static inline
-__u32 skb_get_hash_perturb(const struct sk_buff *skb, u32 perturb)
+#if LINUX_VERSION_IS_LESS(3,3,0)
+
+static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key)
 {
 	return 0;
 }
 
-#endif
+#else
+#include <net/flow_keys.h>
+#include <linux/jhash.h>
+
+static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key)
+{
+	struct flow_keys keys;
+
+	skb_flow_dissect(skb, &keys);
+	return jhash_3words((__force u32)keys.dst,
+			    (__force u32)keys.src ^ keys.ip_proto,
+			    (__force u32)keys.ports, key);
+}
+#endif /* LINUX_VERSION_IS_LESS(3,3,0) */
+#endif /* LINUX_VERSION_IS_LESS(4,2,0) */
 
 #if LINUX_VERSION_IS_LESS(4,13,0)
 static inline void *backport_skb_put(struct sk_buff *skb, unsigned int len)
-- 
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in

  reply	other threads:[~2017-11-16 14:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16 14:38 [PATCH 1/4] kconf: sync with upstream version 37861ffa8c28 Felix Fietkau
2017-11-16 14:38 ` Felix Fietkau [this message]
2017-11-16 14:38 ` [PATCH 3/4] backports: fix events with extack backport Felix Fietkau
2017-11-16 14:38 ` [PATCH 4/4] backports: fix missing linux/verification.h error on < 4.7 Felix Fietkau
2017-11-17  9:47 ` [PATCH 1/4] kconf: sync with upstream version 37861ffa8c28 Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171116143855.12307-2-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=backports@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox