diff mbox

[Trusty,SRU] Provide compat macro for skb_get_hash

Message ID 1408357730-18263-1-git-send-email-stefan.bader@canonical.com
State New
Headers show

Commit Message

Stefan Bader Aug. 18, 2014, 10:28 a.m. UTC
I think this should do the trick. Not tested, so given it looks so
simple, maybe it is wrong.

-Stefan

From 4dcc78d81761d175433fbd0570373b3005464bbe Mon Sep 17 00:00:00 2001
From: Stefan Bader <stefan.bader@canonical.com>
Date: Mon, 18 Aug 2014 10:29:32 +0200
Subject: [PATCH] UBUNTU: SAUCE: Add compat macro for skb_get_hash

Commit df4530d690a14dd net: Change skb_get_rxhash to skb_get_hash
changed a function that is part of the 3.13 kernel API to pull in
some newer driver code.
In order for external modules (which check the LINUX_VERSION_CODE
to find out which API functions to use) to still compile correctly,
add a compat definition for the old name.

BugLink: http://bugs.launchpad.net/bugs/1358162

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 include/linux/skbuff.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Andy Whitcroft Aug. 18, 2014, 11:11 a.m. UTC | #1
On Mon, Aug 18, 2014 at 12:28:50PM +0200, Stefan Bader wrote:
> I think this should do the trick. Not tested, so given it looks so
> simple, maybe it is wrong.
> 
> -Stefan 

For clarity, consumers of this kernel API such as compat-* will not
expect this API change in trusty as the upstream change was 3.14 or so.
They could either become all conditional on Ubuntu ABI levels, or
perhaps more simply we could provide this compatibility interface.

> From 4dcc78d81761d175433fbd0570373b3005464bbe Mon Sep 17 00:00:00 2001
> From: Stefan Bader <stefan.bader@canonical.com>
> Date: Mon, 18 Aug 2014 10:29:32 +0200
> Subject: [PATCH] UBUNTU: SAUCE: Add compat macro for skb_get_hash
> 
> Commit df4530d690a14dd net: Change skb_get_rxhash to skb_get_hash
> changed a function that is part of the 3.13 kernel API to pull in
> some newer driver code.
> In order for external modules (which check the LINUX_VERSION_CODE
> to find out which API functions to use) to still compile correctly,
> add a compat definition for the old name.
> 
> BugLink: http://bugs.launchpad.net/bugs/1358162
> 
> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  include/linux/skbuff.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index e9b1a3c..fa71ce2 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -751,6 +751,7 @@ static inline __u32 skb_get_hash(struct sk_buff *skb)
>  
>  	return skb->rxhash;
>  }
> +#define skb_get_rxhash	skb_get_hash
>  
>  static inline void skb_clear_hash(struct sk_buff *skb)
>  {

From the commit description it does seem to be a simple rename:

  commit 3958afa1b272eb07109fd31549e69193b4d7c364
  Author: Tom Herbert <therbert@google.com>
  Date:   Sun Dec 15 22:12:06 2013 -0800

    net: Change skb_get_rxhash to skb_get_hash
    
    Changing name of function as part of making the hash in skbuff to be
    generic property, not just for receive path.

And the diff seems to agree, the signature is the same:

  -void __skb_get_rxhash(struct sk_buff *skb);
  -static inline __u32 skb_get_rxhash(struct sk_buff *skb)
  +void __skb_get_hash(struct sk_buff *skb);
  +static inline __u32 skb_get_hash(struct sk_buff *skb)

So this seems sufficient:

Acked-by: Andy Whitcroft <apw@canonical.com>

-apw
Tim Gardner Aug. 18, 2014, 12:14 p.m. UTC | #2

Stefan Bader Aug. 21, 2014, 11:37 a.m. UTC | #3
On 18.08.2014 14:14, Tim Gardner wrote:
> 
> 
Apparently it would be safer if we did an

#undef skb_get_rxhash

before defining it ourselves. Can we fiddle that into the original patch on
master-next or does that need to be a fixup patch?

-Stefan
Tim Gardner Aug. 21, 2014, 1:15 p.m. UTC | #4
On 08/21/2014 05:37 AM, Stefan Bader wrote:
> On 18.08.2014 14:14, Tim Gardner wrote:
>>
>>
> Apparently it would be safer if we did an
>
> #undef skb_get_rxhash
>
> before defining it ourselves. Can we fiddle that into the original patch on
> master-next or does that need to be a fixup patch?
>
> -Stefan
>

I guess we could, but I don't understand why it would ever be unsafe ? 
Or rather, why would I care as long as it compiles for our kernel ?

rtg
diff mbox

Patch

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index e9b1a3c..fa71ce2 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -751,6 +751,7 @@  static inline __u32 skb_get_hash(struct sk_buff *skb)
 
 	return skb->rxhash;
 }
+#define skb_get_rxhash	skb_get_hash
 
 static inline void skb_clear_hash(struct sk_buff *skb)
 {