[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1461091667.10638.229.camel@edumazet-glaptop3.roam.corp.google.com>
Date: Tue, 19 Apr 2016 11:47:47 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: roopa@...ulusnetworks.com, netdev@...r.kernel.org,
jhs@...atatu.com, tgraf@...g.ch, nicolas.dichtel@...nd.com
Subject: Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to
dump link stats
On Tue, 2016-04-19 at 14:31 -0400, David Miller wrote:
> +#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS
> + /* IF necessary, add a zero length NOP attribute so that the
> + * nla_data() of the IFLA_STATS64 will be 64-bit aligned.
> + *
> + * The nlattr header is 4 bytes in size, that's why we test
> + * if the skb->data _is_ aligned. This NOP attribute, plus
> + * nlattr header for IFLA_STATS64, will make nla_data() 8-byte
> + * aligned.
> + */
> + if (IS_ALIGNED((unsigned long)skb->data, 8)) {
> + attr = nla_reserve(skb, IFLA_PAD, 0);
> + if (!attr)
> + return -EMSGSIZE;
> + }
> +#endif
Since we want to use this in other places, we could define a helper.
nla_align_64bit(skb, attribute) or something.
Powered by blists - more mailing lists