Subject: Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

From: Nicolas Dichtel <[email-masked]>
Date: Tue, 19 Apr 2016 09:45:32 +0200

Le 19/04/2016 05:41, David Miller a écrit :
[snip]
> I just tested out a clever idea, where for architectures where
> unaligned accesses is a problem, we insert a zero length NOP attribute
> before the 64-bit stats.  This makes it properly aligned.  A quick
> hack patch just passed testing on my sparc64 box, but I'll go over it
> some more.
We saw also problems with architectures like tilera.

Just for reminder, there was a first attempt by Thomas to make this patch
generic: http://patchwork.ozlabs.org/patch/207097/

But we finally discover that some netlink API use the attribute '0'.
Ideally, it would be great to 'tell' to the libnetlink the attribute used for
padding, so that every attribute can be aligned on 8 if needed, but I don't see
a way to do it without changing the whole libnetlink API (and thus all users).
Or could we done the opposite: using Thomas patch by default and introducing a
new API in the libnetlink for netlink messages where the attribute '0' is used?
Some were identified in this patch:
31e20bad8d58 ("diag: warn about missing first netlink attribute").

I like this idea, because it will fix all users, not only rtnl, but the risk is
to forget someone.

Any thoughts?

Regards,
Nicolas