summaryrefslogtreecommitdiff
path: root/net/mac802154/cfg.c
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-11-12 03:36:57 +0100
committerMarcel Holtmann <marcel@holtmann.org>2014-11-12 05:10:39 +0100
commit702bf371282f5912fe53f0b247fa2d7df9d7951f (patch)
tree123edbe0d9a6f8a361507bff5c7da83e1d0bd88d /net/mac802154/cfg.c
parent820bd66fb28ce0c47cb024895d8bace58f5be56d (diff)
ieee820154: add pan_id setting support
This patch adds support for setting pan_id via nl802154 framework. Adding a comment because setting 0xffff as pan_id seems to be valid setting. The pan_id 0xffff as source pan is invalid. I am not sure now about this setting but for the current netlink interface this is an invalid setting, so we do the same now. Maybe we need to change that when we have coordinator support and association support. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154/cfg.c')
-rw-r--r--net/mac802154/cfg.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/net/mac802154/cfg.c b/net/mac802154/cfg.c
index 9d5b1895c752..db6e5e981a83 100644
--- a/net/mac802154/cfg.c
+++ b/net/mac802154/cfg.c
@@ -64,8 +64,28 @@ ieee802154_set_channel(struct wpan_phy *wpan_phy, const u8 page,
return ret;
}
+static int ieee802154_set_pan_id(struct wpan_phy *wpan_phy,
+ struct wpan_dev *wpan_dev, const u16 pan_id)
+{
+ ASSERT_RTNL();
+
+ /* TODO
+ * I am not sure about to check here on broadcast pan_id.
+ * Broadcast is a valid setting, comment from 802.15.4:
+ * If this value is 0xffff, the device is not associated.
+ *
+ * This could useful to simple deassociate an device.
+ */
+ if (pan_id == IEEE802154_PAN_ID_BROADCAST)
+ return -EINVAL;
+
+ wpan_dev->pan_id = cpu_to_le16(pan_id);
+ return 0;
+}
+
const struct cfg802154_ops mac802154_config_ops = {
.add_virtual_intf_deprecated = ieee802154_add_iface_deprecated,
.del_virtual_intf_deprecated = ieee802154_del_iface_deprecated,
.set_channel = ieee802154_set_channel,
+ .set_pan_id = ieee802154_set_pan_id,
};