diff mbox

[bluetooth-next,1/4] netlink: add nla_get for le32 and le64

Message ID 1443423626-3609-2-git-send-email-alex.aring@gmail.com
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Alexander Aring Sept. 28, 2015, 7 a.m. UTC
This patch adds missing inline wrappers for nla_get_le32 and
nla_get_le64. The 802.15.4 MAC byteorder is little endian and we keep
the byteorder for fields like address configuration in the same
byteorder as it comes from the MAC layer.

To provide these fields for nl802154 userspace applications, we need
these inline wrappers for netlink.

Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 include/net/netlink.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Marcel Holtmann Sept. 29, 2015, 4:08 p.m. UTC | #1
Hi Dave,

> This patch adds missing inline wrappers for nla_get_le32 and
> nla_get_le64. The 802.15.4 MAC byteorder is little endian and we keep
> the byteorder for fields like address configuration in the same
> byteorder as it comes from the MAC layer.
> 
> To provide these fields for nl802154 userspace applications, we need
> these inline wrappers for netlink.
> 
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> include/net/netlink.h | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
> 
> diff --git a/include/net/netlink.h b/include/net/netlink.h
> index 2a5dbcc..0e31727 100644
> --- a/include/net/netlink.h
> +++ b/include/net/netlink.h
> @@ -1004,6 +1004,15 @@ static inline __be32 nla_get_be32(const struct nlattr *nla)
> }
> 
> /**
> + * nla_get_le32 - return payload of __le32 attribute
> + * @nla: __le32 netlink attribute
> + */
> +static inline __le32 nla_get_le32(const struct nlattr *nla)
> +{
> +	return *(__le32 *) nla_data(nla);
> +}
> +
> +/**
>  * nla_get_u16 - return payload of u16 attribute
>  * @nla: u16 netlink attribute
>  */
> @@ -1066,6 +1075,15 @@ static inline __be64 nla_get_be64(const struct nlattr *nla)
> }
> 
> /**
> + * nla_get_le64 - return payload of __le64 attribute
> + * @nla: __le64 netlink attribute
> + */
> +static inline __le64 nla_get_le64(const struct nlattr *nla)
> +{
> +	return *(__le64 *) nla_data(nla);
> +}
> +
> +/**
>  * nla_get_s32 - return payload of s32 attribute
>  * @nla: s32 netlink attribute
>  */

do you have any objections to me taking this change through the bluetooth-next tree?

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Sept. 30, 2015, 4:17 a.m. UTC | #2
From: Marcel Holtmann <marcel@holtmann.org>
Date: Tue, 29 Sep 2015 18:08:32 +0200

> do you have any objections to me taking this change through the bluetooth-next tree?

No objections.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/netlink.h b/include/net/netlink.h
index 2a5dbcc..0e31727 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -1004,6 +1004,15 @@  static inline __be32 nla_get_be32(const struct nlattr *nla)
 }
 
 /**
+ * nla_get_le32 - return payload of __le32 attribute
+ * @nla: __le32 netlink attribute
+ */
+static inline __le32 nla_get_le32(const struct nlattr *nla)
+{
+	return *(__le32 *) nla_data(nla);
+}
+
+/**
  * nla_get_u16 - return payload of u16 attribute
  * @nla: u16 netlink attribute
  */
@@ -1066,6 +1075,15 @@  static inline __be64 nla_get_be64(const struct nlattr *nla)
 }
 
 /**
+ * nla_get_le64 - return payload of __le64 attribute
+ * @nla: __le64 netlink attribute
+ */
+static inline __le64 nla_get_le64(const struct nlattr *nla)
+{
+	return *(__le64 *) nla_data(nla);
+}
+
+/**
  * nla_get_s32 - return payload of s32 attribute
  * @nla: s32 netlink attribute
  */