ar9170: cleanup of bss_info_changed and beacon config
authorJoerg Albert <jal2@gmx.de>
Fri, 21 Aug 2009 21:25:07 +0000 (23:25 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 28 Aug 2009 18:40:41 +0000 (14:40 -0400)
Add beacon control by BSS_CHANGED_BEACON_ENABLED and
bss_conf->enable_beacon from mac80211.

Signed-off-by: Joerg Albert <jal2@gmx.de>
Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ar9170/ar9170.h
drivers/net/wireless/ath/ar9170/mac.c
drivers/net/wireless/ath/ar9170/main.c

index ce407248d7d84951974f38401944d329e0d0b968..914e4718a9a80e8571240deeefda8a6c585a81b5 100644 (file)
@@ -178,6 +178,7 @@ struct ar9170 {
        /* beaconing */
        struct sk_buff *beacon;
        struct work_struct beacon_work;
+       bool enable_beacon;
 
        /* cryptographic engine */
        u64 usedkeys;
index 60049366e863fffaa6848afea01079b02265e3fd..614e3218a2bc2cbe19641007e8b1d2f6add8492e 100644 (file)
@@ -383,24 +383,26 @@ int ar9170_set_beacon_timers(struct ar9170 *ar)
        if (ar->vif) {
                v |= ar->vif->bss_conf.beacon_int;
 
-               switch (ar->vif->type) {
-               case NL80211_IFTYPE_MESH_POINT:
-               case NL80211_IFTYPE_ADHOC:
-                       v |= BIT(25);
-                       break;
-               case NL80211_IFTYPE_AP:
-                       v |= BIT(24);
-                       pretbtt = (ar->vif->bss_conf.beacon_int - 6) << 16;
-                       break;
-               default:
+               if (ar->enable_beacon) {
+                       switch (ar->vif->type) {
+                       case NL80211_IFTYPE_MESH_POINT:
+                       case NL80211_IFTYPE_ADHOC:
+                               v |= BIT(25);
+                               break;
+                       case NL80211_IFTYPE_AP:
+                               v |= BIT(24);
+                               pretbtt = (ar->vif->bss_conf.beacon_int - 6) <<
+                                         16;
+                               break;
+                       default:
                        break;
+                       }
                }
 
                v |= ar->vif->bss_conf.dtim_period << 16;
        }
 
        ar9170_regwrite_begin(ar);
-
        ar9170_regwrite(AR9170_MAC_REG_PRETBTT, pretbtt);
        ar9170_regwrite(AR9170_MAC_REG_BCN_PERIOD, v);
        ar9170_regwrite_finish();
index 658b32312cafd30c88bebc7d7c3223bce18a4af9..c0fc3554c9247c04e40fc1772ac41aec3159bfec 100644 (file)
@@ -2148,11 +2148,17 @@ static void ar9170_op_bss_info_changed(struct ieee80211_hw *hw,
                        goto out;
        }
 
-       if (changed & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_ENABLED)) {
+       if (changed & BSS_CHANGED_BEACON_ENABLED)
+               ar->enable_beacon = bss_conf->enable_beacon;
+
+       if (changed & BSS_CHANGED_BEACON) {
                err = ar9170_update_beacon(ar);
                if (err)
                        goto out;
+       }
 
+       if (changed & (BSS_CHANGED_BEACON_ENABLED | BSS_CHANGED_BEACON |
+                      BSS_CHANGED_BEACON_INT)) {
                err = ar9170_set_beacon_timers(ar);
                if (err)
                        goto out;
@@ -2165,12 +2171,6 @@ static void ar9170_op_bss_info_changed(struct ieee80211_hw *hw,
 #endif /* CONFIG_AR9170_LEDS */
        }
 
-       if (changed & BSS_CHANGED_BEACON_INT) {
-               err = ar9170_set_beacon_timers(ar);
-               if (err)
-                       goto out;
-       }
-
        if (changed & BSS_CHANGED_HT) {
                /* TODO */
                err = 0;