mac802154: Handle basic beaconing
[linux-2.6-block.git] / net / mac802154 / cfg.c
index 187cebcaf23332cc86e5fdacf35b45d26a71f85a..5c3cb019f7513d2fefd4dd016f984fd57f804b38 100644 (file)
@@ -114,8 +114,8 @@ ieee802154_set_channel(struct wpan_phy *wpan_phy, u8 page, u8 channel)
            wpan_phy->current_channel == channel)
                return 0;
 
-       /* Refuse to change channels during a scanning operation */
-       if (mac802154_is_scanning(local))
+       /* Refuse to change channels during scanning or beaconing */
+       if (mac802154_is_scanning(local) || mac802154_is_beaconing(local))
                return -EBUSY;
 
        ret = drv_set_channel(local, page, channel);
@@ -290,6 +290,31 @@ static int mac802154_abort_scan(struct wpan_phy *wpan_phy,
        return mac802154_abort_scan_locked(local, sdata);
 }
 
+static int mac802154_send_beacons(struct wpan_phy *wpan_phy,
+                                 struct cfg802154_beacon_request *request)
+{
+       struct ieee802154_sub_if_data *sdata;
+
+       sdata = IEEE802154_WPAN_DEV_TO_SUB_IF(request->wpan_dev);
+
+       ASSERT_RTNL();
+
+       return mac802154_send_beacons_locked(sdata, request);
+}
+
+static int mac802154_stop_beacons(struct wpan_phy *wpan_phy,
+                                 struct wpan_dev *wpan_dev)
+{
+       struct ieee802154_local *local = wpan_phy_priv(wpan_phy);
+       struct ieee802154_sub_if_data *sdata;
+
+       sdata = IEEE802154_WPAN_DEV_TO_SUB_IF(wpan_dev);
+
+       ASSERT_RTNL();
+
+       return mac802154_stop_beacons_locked(local, sdata);
+}
+
 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
 static void
 ieee802154_get_llsec_table(struct wpan_phy *wpan_phy,
@@ -499,6 +524,8 @@ const struct cfg802154_ops mac802154_config_ops = {
        .set_ackreq_default = ieee802154_set_ackreq_default,
        .trigger_scan = mac802154_trigger_scan,
        .abort_scan = mac802154_abort_scan,
+       .send_beacons = mac802154_send_beacons,
+       .stop_beacons = mac802154_stop_beacons,
 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
        .get_llsec_table = ieee802154_get_llsec_table,
        .lock_llsec_table = ieee802154_lock_llsec_table,