diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-11-05 20:51:23 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-11-05 21:53:05 +0100 |
commit | 239a84a9a0bcbc7214eb93fb3ba76962de846239 (patch) | |
tree | 4f116ed009e704b44bbfa9f45d4fca51c3be3a98 /include/net/mac802154.h | |
parent | ieee802154: add ieee802154_random_extended_addr (diff) | |
download | linux-239a84a9a0bcbc7214eb93fb3ba76962de846239.tar.xz linux-239a84a9a0bcbc7214eb93fb3ba76962de846239.zip |
mac802154: add ieee802154_le64_to_be64
This patch adds a new function to convert a le64 to a be64. This is
useful to translate an extended address to a netdev dev_addr.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to '')
-rw-r--r-- | include/net/mac802154.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/net/mac802154.h b/include/net/mac802154.h index 10711a6409f4..cc188cb4f94d 100644 --- a/include/net/mac802154.h +++ b/include/net/mac802154.h @@ -17,6 +17,7 @@ #define NET_MAC802154_H #include <net/af_ieee802154.h> +#include <linux/ieee802154.h> #include <linux/skbuff.h> /* General MAC frame format: @@ -231,6 +232,18 @@ static inline __le64 ieee802154_netdev_to_extended_addr(const void *dev_addr) return (__force __le64)swab64p(dev_addr); } +/** + * ieee802154_le64_to_be64 - copies and convert le64 to be64 + * @be64_dst: be64 destination pointer + * @le64_src: le64 source pointer + */ +static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src) +{ + __be64 tmp = (__force __be64)swab64p(le64_src); + + memcpy(be64_dst, &tmp, IEEE802154_EXTENDED_ADDR_LEN); +} + /* Basic interface to register ieee802154 hwice */ struct ieee802154_hw * ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops); |