diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-11-17 02:20:54 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-11-17 03:49:17 -0500 |
commit | cb41c8dd01d74d091618f72e28f0282f064a9f0a (patch) | |
tree | b81251728589e0f91f90f17fde0799687b3841e8 | |
parent | b821ecd4c8a0b3b1fc1bdd191bb7d555d818cafe (diff) |
ieee802154: rename and move WPAN_NUM_ defines
This patch moves the 802.15.4 constraints WPAN_NUM_ defines into
"net/ieee802154.h" which should contain all necessary 802.15.4 related
information. Also rename these defines to a common name which is
IEEE802154_MAX_CHANNEL and IEEE802154_MAX_PAGE.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | include/linux/ieee802154.h | 3 | ||||
-rw-r--r-- | include/net/cfg802154.h | 11 | ||||
-rw-r--r-- | net/ieee802154/nl802154.c | 4 |
3 files changed, 7 insertions, 11 deletions
diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h index 5a40c0418438..6e82d888287c 100644 --- a/include/linux/ieee802154.h +++ b/include/linux/ieee802154.h | |||
@@ -39,6 +39,9 @@ | |||
39 | #define IEEE802154_LIFS_PERIOD 40 | 39 | #define IEEE802154_LIFS_PERIOD 40 |
40 | #define IEEE802154_SIFS_PERIOD 12 | 40 | #define IEEE802154_SIFS_PERIOD 12 |
41 | 41 | ||
42 | #define IEEE802154_MAX_CHANNEL 26 | ||
43 | #define IEEE802154_MAX_PAGE 31 | ||
44 | |||
42 | #define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */ | 45 | #define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */ |
43 | #define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */ | 46 | #define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */ |
44 | #define IEEE802154_FC_TYPE_ACK 0x2 /* Frame is acknowledgment */ | 47 | #define IEEE802154_FC_TYPE_ACK 0x2 /* Frame is acknowledgment */ |
diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h index 507ac9d3d38a..228f1f7668f7 100644 --- a/include/net/cfg802154.h +++ b/include/net/cfg802154.h | |||
@@ -17,20 +17,13 @@ | |||
17 | #ifndef __NET_CFG802154_H | 17 | #ifndef __NET_CFG802154_H |
18 | #define __NET_CFG802154_H | 18 | #define __NET_CFG802154_H |
19 | 19 | ||
20 | #include <linux/ieee802154.h> | ||
20 | #include <linux/netdevice.h> | 21 | #include <linux/netdevice.h> |
21 | #include <linux/mutex.h> | 22 | #include <linux/mutex.h> |
22 | #include <linux/bug.h> | 23 | #include <linux/bug.h> |
23 | 24 | ||
24 | #include <net/nl802154.h> | 25 | #include <net/nl802154.h> |
25 | 26 | ||
26 | /* According to the IEEE 802.15.4 stadard the upper most significant bits of | ||
27 | * the 32-bit channel bitmaps shall be used as an integer value to specify 32 | ||
28 | * possible channel pages. The lower 27 bits of the channel bit map shall be | ||
29 | * used as a bit mask to specify channel numbers within a channel page. | ||
30 | */ | ||
31 | #define WPAN_NUM_CHANNELS 27 | ||
32 | #define WPAN_NUM_PAGES 32 | ||
33 | |||
34 | struct wpan_phy; | 27 | struct wpan_phy; |
35 | 28 | ||
36 | struct cfg802154_ops { | 29 | struct cfg802154_ops { |
@@ -81,7 +74,7 @@ struct wpan_phy { | |||
81 | */ | 74 | */ |
82 | u8 current_channel; | 75 | u8 current_channel; |
83 | u8 current_page; | 76 | u8 current_page; |
84 | u32 channels_supported[32]; | 77 | u32 channels_supported[IEEE802154_MAX_PAGE + 1]; |
85 | s8 transmit_power; | 78 | s8 transmit_power; |
86 | u8 cca_mode; | 79 | u8 cca_mode; |
87 | 80 | ||
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c index 6b9bc93944a6..b82b01669a67 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c | |||
@@ -245,7 +245,7 @@ nl802154_send_wpan_phy_channels(struct cfg802154_registered_device *rdev, | |||
245 | if (!nl_page) | 245 | if (!nl_page) |
246 | return -ENOBUFS; | 246 | return -ENOBUFS; |
247 | 247 | ||
248 | for (page = 0; page < WPAN_NUM_PAGES; page++) { | 248 | for (page = 0; page <= IEEE802154_MAX_PAGE; page++) { |
249 | if (nla_put_u32(msg, NL802154_ATTR_SUPPORTED_CHANNEL, | 249 | if (nla_put_u32(msg, NL802154_ATTR_SUPPORTED_CHANNEL, |
250 | rdev->wpan_phy.channels_supported[page])) | 250 | rdev->wpan_phy.channels_supported[page])) |
251 | return -ENOBUFS; | 251 | return -ENOBUFS; |
@@ -616,7 +616,7 @@ static int nl802154_set_channel(struct sk_buff *skb, struct genl_info *info) | |||
616 | channel = nla_get_u8(info->attrs[NL802154_ATTR_CHANNEL]); | 616 | channel = nla_get_u8(info->attrs[NL802154_ATTR_CHANNEL]); |
617 | 617 | ||
618 | /* check 802.15.4 constraints */ | 618 | /* check 802.15.4 constraints */ |
619 | if (page >= WPAN_NUM_PAGES || channel >= WPAN_NUM_CHANNELS) | 619 | if (page > IEEE802154_MAX_PAGE || channel > IEEE802154_MAX_CHANNEL) |
620 | return -EINVAL; | 620 | return -EINVAL; |
621 | 621 | ||
622 | return rdev_set_channel(rdev, page, channel); | 622 | return rdev_set_channel(rdev, page, channel); |