summaryrefslogtreecommitdiff
path: root/include/net/mac802154.h
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-11-02 06:18:40 +0300
committerMarcel Holtmann <marcel@holtmann.org>2014-11-02 06:51:07 +0300
commitab24f50f2a3e3f6a38b4852530534aa99d86b4d1 (patch)
treeff0109b22e75750a8514847d984b15831b3b0e7b /include/net/mac802154.h
parent8f499f991c275d5251a427c424360a9c60f549e4 (diff)
downloadlinux-ab24f50f2a3e3f6a38b4852530534aa99d86b4d1.tar.xz
mac802154: add helper for converting dev_addr
This patch adds a helper for converting the dev_addr attribute in netdevice to __le64 type. The dev_addr attribute is a char pointer and contains the extended address in big endian byte order. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net/mac802154.h')
-rw-r--r--include/net/mac802154.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index 8f1de6844cb0..c17acbd0dadc 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -214,6 +214,15 @@ struct ieee802154_ops {
const bool on);
};
+/**
+ * ieee802154_netdev_to_extended_addr - convert __be64 u8 pointer to __le64
+ * @dev_addr: big endian address pointer like netdevice dev_addr attribute
+ */
+static inline __le64 ieee802154_netdev_to_extended_addr(const u8 *dev_addr)
+{
+ return (__le64)swab64(*((__be64 *)dev_addr));
+}
+
/* Basic interface to register ieee802154 hwice */
struct ieee802154_hw *
ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops);