summaryrefslogtreecommitdiff
path: root/include/linux/ieee802154.h
diff options
context:
space:
mode:
authorAlexander Aring <aar@pengutronix.de>2016-07-07 00:32:25 +0300
committerMarcel Holtmann <marcel@holtmann.org>2016-07-08 14:23:12 +0300
commit19580cc1ed299c736b56b45c7576b477f185f8f5 (patch)
tree9462cfe0a4bfa24f5c7e91a96288353c441bf5d0 /include/linux/ieee802154.h
parent9cc577dd25b9762df7f353658426bb2e048c480a (diff)
downloadlinux-19580cc1ed299c736b56b45c7576b477f185f8f5.tar.xz
ieee802154: add ieee802154_skb_src_pan helper
This patch adds ieee802154_skb_src_pan function to get the pointer address of the source pan id at skb mac pointer. Signed-off-by: Alexander Aring <aar@pengutronix.de> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/linux/ieee802154.h')
-rw-r--r--include/linux/ieee802154.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h
index 91f4665fea63..ddb890174a0e 100644
--- a/include/linux/ieee802154.h
+++ b/include/linux/ieee802154.h
@@ -50,6 +50,7 @@
#define IEEE802154_EXTENDED_ADDR_LEN 8
#define IEEE802154_SHORT_ADDR_LEN 2
+#define IEEE802154_PAN_ID_LEN 2
#define IEEE802154_LIFS_PERIOD 40
#define IEEE802154_SIFS_PERIOD 12
@@ -224,12 +225,15 @@ enum {
#define IEEE802154_FCTL_SECEN 0x0004
#define IEEE802154_FCTL_INTRA_PAN 0x0040
#define IEEE802154_FCTL_DADDR 0x0c00
+#define IEEE802154_FCTL_SADDR 0xc000
#define IEEE802154_FTYPE_DATA 0x0001
#define IEEE802154_FCTL_ADDR_NONE 0x0000
#define IEEE802154_FCTL_DADDR_SHORT 0x0800
#define IEEE802154_FCTL_DADDR_EXTENDED 0x0c00
+#define IEEE802154_FCTL_SADDR_SHORT 0x8000
+#define IEEE802154_FCTL_SADDR_EXTENDED 0xc000
/*
* ieee802154_is_data - check if type is IEEE802154_FTYPE_DATA
@@ -277,6 +281,15 @@ static inline __le16 ieee802154_daddr_mode(__le16 fc)
return fc & cpu_to_le16(IEEE802154_FCTL_DADDR);
}
+/*
+ * ieee802154_saddr_mode - get saddr mode from fc
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline __le16 ieee802154_saddr_mode(__le16 fc)
+{
+ return fc & cpu_to_le16(IEEE802154_FCTL_SADDR);
+}
+
/**
* ieee802154_is_valid_psdu_len - check if psdu len is valid
* available lengths: