netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Phoebe Buckheister" <phoebe.buckheister@itwm.fraunhofer.de>
To: "David Miller" <davem@davemloft.net>
Cc: phoebe.buckheister@itwm.fraunhofer.de, netdev@vger.kernel.org,
	linux-zigbee-devel@lists.sourceforge.net
Subject: Re: [PATCH net-next v4 1/4] ieee802154: add generic header handling routines
Date: Tue, 4 Mar 2014 23:49:33 +0100	[thread overview]
Message-ID: <a23fcc368f1421286c1115c2365942ce.squirrel@webmail.itwm.fhg.de> (raw)
In-Reply-To: <20140304.172025.2034977449200344617.davem@davemloft.net>

> Why have an intermediate copy when that's not necessary at all?  It
> seems like pure overhead to be.
>
> Furthermore, cpu's have byte-shifting load and store instructions
> which will be used if you make use of the 'p' versions of the endian
> swap functions, such as cpu_to_le16p().
>
> So it's going to cost basically nothing.

I didn't mean the runtime cost of any conversion that might happen, I was
thinking about how much these conversions would affect the code that uses
these header structs. While for the u16/u32 fields this might be not much,
it will be more for the hardware address fields since these are stored as
the little endian encoding of u64 field you get when reading the u8[8] as
a __be64. If I understand you correctly, these fields would also have to
be in network byte order in the header struct, introducing copy-and-swaps
in every upper layer that uses those addresses and making address matching
harder since memcmp won't work anymore.

What would be better here? Explicit endianness on all fields for
consistency and thus __le64 for EUI64 members with copy-swap functions to
convert those addresses into u8[8] where required, explicit endianness on
everything except addresses, or keeping it as is? I'm honestly not sure.

I want to note here that struct ieee802154_addr, which holds the address
information and is also used by BSD socket calls, has always used host
byte order for its own fields. This might itself be a huge mistake, but it
is relevant to this discussion.

  reply	other threads:[~2014-03-04 22:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04 14:34 [PATCH net-next v4 0/4] ieee802154: clean up header handling Phoebe Buckheister
2014-03-04 14:34 ` [PATCH net-next v4 2/4] mac802154: use new header ops in wpan devices Phoebe Buckheister
     [not found] ` <1393943688-24221-1-git-send-email-phoebe.buckheister-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
2014-03-04 14:34   ` [PATCH net-next v4 1/4] ieee802154: add generic header handling routines Phoebe Buckheister
2014-03-04 22:00     ` David Miller
2014-03-04 22:16       ` Phoebe Buckheister
2014-03-04 22:20         ` David Miller
2014-03-04 22:49           ` Phoebe Buckheister [this message]
2014-03-05  0:23             ` David Miller
     [not found]               ` <20140304.192309.337489223683931299.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2014-03-05  1:01                 ` Phoebe Buckheister
2014-03-05  1:09                   ` David Miller
2014-03-09 17:59           ` Ben Hutchings
     [not found]             ` <1394387943.15968.1.camel-nDn/Rdv9kqW9Jme8/bJn5UCKIB8iOfG2tUK59QYPAWc@public.gmane.org>
2014-03-09 22:49               ` David Miller
2014-03-05 19:15       ` Phoebe Buckheister
2014-03-06  0:39         ` David Miller
2014-03-06 10:11           ` Phoebe Buckheister
2014-03-06 18:07             ` David Miller
2014-03-06 18:28               ` Phoebe Buckheister
2014-03-04 14:34   ` [PATCH net-next v4 3/4] ieee802154: remove addresses from mac_cb Phoebe Buckheister
2014-03-04 14:34   ` [PATCH net-next v4 4/4] ieee802154: remove seq member of mac_cb 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=a23fcc368f1421286c1115c2365942ce.squirrel@webmail.itwm.fhg.de \
    --to=phoebe.buckheister@itwm.fraunhofer.de \
    --cc=davem@davemloft.net \
    --cc=linux-zigbee-devel@lists.sourceforge.net \
    --cc=netdev@vger.kernel.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).