netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phoebe Buckheister <phoebe.buckheister-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
To: David Laight <David.Laight-ZS65k/vG3HxXrIkS9f7CXA@public.gmane.org>
Cc: "netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org"
	<davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	"linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org"
	<linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [PATCH net-next 2/8] ieee802154: add address struct with proper endiannes and some operations
Date: Fri, 14 Mar 2014 17:30:10 +0100	[thread overview]
Message-ID: <20140314173010.25039487@zoidberg> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D0F6DDDE4-VkEWCZq2GCInGFn1LkZF6NBPR1lH4CV8@public.gmane.org>

On Fri, 14 Mar 2014 16:00:39 +0000
David Laight <David.Laight-ZS65k/vG3HxXrIkS9f7CXA@public.gmane.org> wrote:

> From: Phoebe Buckheister
> > Add a replacement ieee802154_addr struct with proper endianness on
> > fields. Short address fields are stored as __le16 as on the network,
> > extended (EUI64) addresses are __le64 as opposed to the u8[8] format
> > used previously. This disconnect with the netdev address, which is
> > stored as big-endian u8[8], is intentional.
> ...
> > +struct ieee802154_addr {
> > +	u8 mode;
> > +	__le16 pan_id;
> > +	union {
> > +		__le16 short_addr;
> > +		__le64 extended_addr;
> > +	};
> > +};
> 
> There is a lot of padding in there - especially on 64bit systems.
> You didn't make it clear where the above is used, but if it is
> passed to userspace I'd add explicit padding fields to ensure
> that the alignment is the same on all (sensible) architectures

Yes, there is. The intention for this struct was to be used only within
the stack, not to be exported to userspace - the original
ieee802154_addr (now *_sa) should be used for that for consistency. If
there was a way to fix endianness exported through visible kernel
interfaces, this struct should indeed not be used. Since I'm not sure
whether that's possible, I haven't added padding fields yet.

As explained in the cover letter, I do think we could change that, and
if we ever wanted to, now would be the time to do it. If we did, I'd
lay out the struct as u8 mode, u8 __pad1, __le16 pan_id, u32 __pad2,
and then the union.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech

  parent reply	other threads:[~2014-03-14 16:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14 15:23 [PATCH net-next 0/8] ieee802154: fix endianness and header handling Phoebe Buckheister
2014-03-14 15:23 ` [PATCH net-next 1/8] ieee802154: rename struct ieee802154_addr to *_sa Phoebe Buckheister
     [not found] ` <1394810613-5657-1-git-send-email-phoebe.buckheister-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
2014-03-14 15:23   ` [PATCH net-next 2/8] ieee802154: add address struct with proper endiannes and some operations Phoebe Buckheister
2014-03-14 16:00     ` David Laight
     [not found]       ` <063D6719AE5E284EB5DD2968C1650D6D0F6DDDE4-VkEWCZq2GCInGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2014-03-14 16:30         ` Phoebe Buckheister [this message]
2014-03-14 15:23   ` [PATCH net-next 3/8] ieee802154: enforce consistent endianness in the 802.15.4 stack Phoebe Buckheister
2014-03-14 15:23   ` [PATCH net-next 4/8] ieee802154: add header structs with endiannes and operations Phoebe Buckheister
2014-03-14 15:23   ` [PATCH net-next 5/8] mac802154: use header operations to create/parse headers Phoebe Buckheister
2014-03-14 15:23   ` [PATCH net-next 6/8] ieee802154: use ieee802154_addr instead of *_sa variants Phoebe Buckheister
2014-03-14 15:23   ` [PATCH net-next 7/8] 6lowpan: move lowpan frag_info out of 802.15.4 headers Phoebe Buckheister
2014-03-14 15:23   ` [PATCH net-next 8/8] ieee802154: add proper length checks to header creations Phoebe Buckheister

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=20140314173010.25039487@zoidberg \
    --to=phoebe.buckheister-mpn0npgs4xgatndf+kubs4quadtiucjx@public.gmane.org \
    --cc=David.Laight-ZS65k/vG3HxXrIkS9f7CXA@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).