From: Stefan Schmidt <stefan@osg.samsung.com>
To: Alexander Aring <aar@pengutronix.de>, linux-wpan@vger.kernel.org
Cc: kernel@pengutronix.de, jukka.rissanen@linux.intel.com,
hannes@stressinduktion.org, mcr@sandelman.ca,
werner@almesberger.net
Subject: Re: [RFC bluetooth-next 02/19] ieee802154: add short address helpers
Date: Wed, 23 Mar 2016 10:59:19 +0100 [thread overview]
Message-ID: <56F268F7.2070504@osg.samsung.com> (raw)
In-Reply-To: <1458652515-7862-3-git-send-email-aar@pengutronix.de>
Hello.
On 22/03/16 14:14, Alexander Aring wrote:
> This patch introduce some short address handling functionality into
> ieee802154 headers.
>
> Signed-off-by: Alexander Aring<aar@pengutronix.de>
> ---
> include/linux/ieee802154.h | 29 +++++++++++++++++++++++++++++
> include/net/mac802154.h | 10 ++++++++++
> 2 files changed, 39 insertions(+)
>
> diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h
> index 303f446..3b3ea58 100644
> --- a/include/linux/ieee802154.h
> +++ b/include/linux/ieee802154.h
> @@ -47,6 +47,7 @@
> #define IEEE802154_ADDR_SHORT_UNSPEC 0xfffe
>
> #define IEEE802154_EXTENDED_ADDR_LEN 8
> +#define IEEE802154_SHORT_ADDR_LEN 2
>
> #define IEEE802154_LIFS_PERIOD 40
> #define IEEE802154_SIFS_PERIOD 12
> @@ -280,6 +281,34 @@ static inline bool ieee802154_is_valid_extended_unicast_addr(__le64 addr)
> }
>
> /**
> + * ieee802154_is_broadcast_short_addr - check if short addr is broadcast
> + * @addr: short addr to check
> + */
> +static inline bool ieee802154_is_broadcast_short_addr(__le16 addr)
> +{
> + return addr == cpu_to_le16(IEEE802154_ADDR_SHORT_BROADCAST);
If I wrote this I would put it into parenthesis like this for clarity:
return (addr == cpu_to_le16(IEEE802154_ADDR_SHORT_BROADCAST));
But this is basically a nitpick and I honestly do not know what the kernel coding style has to say about it.
> +}
> +
> +/**
> + * ieee802154_is_unspec_short_addr - check if short addr is unspecified
> + * @addr: short addr to check
> + */
> +static inline bool ieee802154_is_unspec_short_addr(__le16 addr)
> +{
> + return addr == cpu_to_le16(IEEE802154_ADDR_SHORT_UNSPEC);
> +}
> +
> +/**
> + * ieee802154_is_valid_src_short_addr - check if source short address is valid
> + * @addr: short addr to check
> + */
> +static inline bool ieee802154_is_valid_src_short_addr(__le16 addr)
> +{
> + return !(ieee802154_is_broadcast_short_addr(addr) ||
> + ieee802154_is_unspec_short_addr(addr));
> +}
> +
> +/**
> * ieee802154_random_extended_addr - generates a random extended address
> * @addr: extended addr pointer to place the random address
> */
> diff --git a/include/net/mac802154.h b/include/net/mac802154.h
> index 6cd7a70..e465c85 100644
> --- a/include/net/mac802154.h
> +++ b/include/net/mac802154.h
> @@ -288,6 +288,16 @@ static inline void ieee802154_le16_to_be16(void *be16_dst, const void *le16_src)
> }
>
> /**
> + * ieee802154_be16_to_le16 - copies and convert be16 to le16
> + * @le16_dst: le16 destination pointer
> + * @be16_src: be16 source pointer
> + */
> +static inline void ieee802154_be16_to_le16(void *le16_dst, const void *be16_src)
> +{
> + put_unaligned_le16(get_unaligned_be16(be16_src), le16_dst);
> +}
> +
> +/**
> * ieee802154_alloc_hw - Allocate a new hardware device
> *
> * This must be called once for each hardware device. The returned pointer
Besides the nitpick this looks fine to me as well.
Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
regards
Stefan Schmidt
next prev parent reply other threads:[~2016-03-23 9:59 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 13:14 [RFC bluetooth-next 00/19] 6lowpan: l2 neighbour data and short address Alexander Aring
2016-03-22 13:14 ` [RFC bluetooth-next 01/19] ieee802154: cleanups for ieee802154.h Alexander Aring
2016-03-23 9:59 ` Stefan Schmidt
2016-03-22 13:14 ` [RFC bluetooth-next 02/19] ieee802154: add short address helpers Alexander Aring
2016-03-23 9:59 ` Stefan Schmidt [this message]
2016-03-22 13:14 ` [RFC bluetooth-next 03/19] nl802154: avoid address change while running lowpan Alexander Aring
2016-03-23 9:59 ` Stefan Schmidt
2016-03-22 13:15 ` [RFC bluetooth-next 04/19] ieee802154: 6lowpan: fix short addr hash Alexander Aring
2016-03-23 9:58 ` Stefan Schmidt
2016-03-22 13:15 ` [RFC bluetooth-next 05/19] 6lowpan: change naming for lowpan private data Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 06/19] 6lowpan: move lowpan_802154_dev to 6lowpan Alexander Aring
2016-03-23 10:08 ` Stefan Schmidt
2016-03-22 13:15 ` [RFC bluetooth-next 07/19] 6lowpan: iphc: rename add lowpan prefix Alexander Aring
2016-03-23 10:09 ` Stefan Schmidt
2016-04-08 17:36 ` Marcel Holtmann
2016-04-11 17:00 ` Stefan Schmidt
2016-03-22 13:15 ` [RFC bluetooth-next 08/19] 6lowpan: iphc: remove unnecessary zero data Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 09/19] 6lowpan: move eui64 uncompress function Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 10/19] 6lowpan: add lowpan_is_ll function Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 11/19] 6lowpan: move mac802154 header Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 12/19] 6lowpan: add private neighbour data Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 13/19] addrconf: add 802.15.4 short addr slaac Alexander Aring
2016-03-23 10:50 ` Hannes Frederic Sowa
2016-04-05 8:20 ` Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 14/19] ndisc: add addr_len parameter to ndisc_opt_addr_space Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 15/19] ndisc: add addr_len parameter to ndisc_opt_addr_data Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 16/19] ndisc: add addr_len parameter to ndisc_fill_addr_option Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 17/19] ndisc: add short address to ndisc opts parsing Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 18/19] ndisc: add support for short address option Alexander Aring
2016-03-22 13:15 ` [RFC bluetooth-next 19/19] 6lowpan: add support for 802.15.4 short addr handling Alexander Aring
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=56F268F7.2070504@osg.samsung.com \
--to=stefan@osg.samsung.com \
--cc=aar@pengutronix.de \
--cc=hannes@stressinduktion.org \
--cc=jukka.rissanen@linux.intel.com \
--cc=kernel@pengutronix.de \
--cc=linux-wpan@vger.kernel.org \
--cc=mcr@sandelman.ca \
--cc=werner@almesberger.net \
/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