aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/mac802154.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/mac802154.h')
-rw-r--r--include/net/mac802154.h33
1 files changed, 25 insertions, 8 deletions
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index b7f99615224b..da574bbdc333 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -23,14 +23,6 @@
23 23
24#include <net/cfg802154.h> 24#include <net/cfg802154.h>
25 25
26/* General MAC frame format:
27 * 2 bytes: Frame Control
28 * 1 byte: Sequence Number
29 * 20 bytes: Addressing fields
30 * 14 bytes: Auxiliary Security Header
31 */
32#define MAC802154_FRAME_HARD_HEADER_LEN (2 + 1 + 20 + 14)
33
34/** 26/**
35 * enum ieee802154_hw_addr_filt_flags - hardware address filtering flags 27 * enum ieee802154_hw_addr_filt_flags - hardware address filtering flags
36 * 28 *
@@ -250,6 +242,21 @@ struct ieee802154_ops {
250}; 242};
251 243
252/** 244/**
245 * ieee802154_get_fc_from_skb - get the frame control field from an skb
246 * @skb: skb where the frame control field will be get from
247 */
248static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
249{
250 /* return some invalid fc on failure */
251 if (unlikely(skb->len < 2)) {
252 WARN_ON(1);
253 return cpu_to_le16(0);
254 }
255
256 return (__force __le16)__get_unaligned_memmove16(skb_mac_header(skb));
257}
258
259/**
253 * ieee802154_be64_to_le64 - copies and convert be64 to le64 260 * ieee802154_be64_to_le64 - copies and convert be64 to le64
254 * @le64_dst: le64 destination pointer 261 * @le64_dst: le64 destination pointer
255 * @be64_src: be64 source pointer 262 * @be64_src: be64 source pointer
@@ -270,6 +277,16 @@ static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src)
270} 277}
271 278
272/** 279/**
280 * ieee802154_le16_to_be16 - copies and convert le16 to be16
281 * @be16_dst: be16 destination pointer
282 * @le16_src: le16 source pointer
283 */
284static inline void ieee802154_le16_to_be16(void *be16_dst, const void *le16_src)
285{
286 __put_unaligned_memmove16(swab16p(le16_src), be16_dst);
287}
288
289/**
273 * ieee802154_alloc_hw - Allocate a new hardware device 290 * ieee802154_alloc_hw - Allocate a new hardware device
274 * 291 *
275 * This must be called once for each hardware device. The returned pointer 292 * This must be called once for each hardware device. The returned pointer