lkml.org 
[lkml]   [2020]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v3 -next 3/4] net: emaclite: Fix arm64 compilation warnings
Date
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Friday, January 31, 2020 7:08 PM
> To: Radhey Shyam Pandey <radheys@xilinx.com>
> Cc: davem@davemloft.net; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; Anirudha Sarangi <anirudh@xilinx.com>; Michal Simek
> <michals@xilinx.com>; gregkh@linuxfoundation.org;
> mchehab+samsung@kernel.org; John Linn <linnj@xilinx.com>; linux-arm-
> kernel@lists.infradead.org
> Subject: Re: [PATCH v3 -next 3/4] net: emaclite: Fix arm64 compilation warnings
>
> On Fri, Jan 31, 2020 at 05:17:49PM +0530, Radhey Shyam Pandey wrote:
> >
> > /* BUFFER_ALIGN(adr) calculates the number of bytes to the next alignment.
> */
> > -#define BUFFER_ALIGN(adr) ((ALIGNMENT - ((u32)adr)) % ALIGNMENT)
> > +#define BUFFER_ALIGN(adr) ((ALIGNMENT - ((ulong)adr)) % ALIGNMENT)
>
> Hi Radhey
>
> linux/kernel.h has a few interesting macros, like
>
> #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
>
> These are more likely to be correct across all architectures than
> anything you role yourself.
>
Thanks for the review. I agree using a kernel macro is preferred. However,
as a second thought it seems we can get rid of this custom BUFFER_ALIGN
macro and simply calling skb_reserve(skb, NET_IP_ALIGN) will make the
protocol header to be aligned on at least a 4-byte boundary.

> Andrew

\
 
 \ /
  Last update: 2020-02-10 15:29    [W:0.072 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site