mac80211: introduce hw config change flags
authorJohannes Berg <johannes@sipsolutions.net>
Thu, 9 Oct 2008 10:18:51 +0000 (12:18 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 31 Oct 2008 23:00:07 +0000 (19:00 -0400)
This makes mac80211 notify the driver which configuration
actually changed, e.g. channel etc.

No driver changes, this is just plumbing, driver authors are
expected to act on this if they want to.

Also remove the HW CONFIG debug printk, it's incorrect, often
we configure something else.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
24 files changed:
drivers/net/wireless/adm8211.c
drivers/net/wireless/ath5k/base.c
drivers/net/wireless/ath9k/main.c
drivers/net/wireless/b43/main.c
drivers/net/wireless/b43legacy/main.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/libertas_tf/main.c
drivers/net/wireless/mac80211_hwsim.c
drivers/net/wireless/p54/p54common.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rtl8180_dev.c
drivers/net/wireless/rtl8187_dev.c
drivers/net/wireless/zd1211rw/zd_mac.c
include/net/mac80211.h
net/mac80211/cfg.c
net/mac80211/ieee80211_i.h
net/mac80211/iface.c
net/mac80211/main.c
net/mac80211/scan.c
net/mac80211/util.c
net/mac80211/wext.c

index 6e18c9d367872edc7c246d38ecbe1bd3594ceb16..9a1e0c514c086484e5486930eb675b04bf2edc92 100644 (file)
@@ -1314,9 +1314,10 @@ static int adm8211_set_ssid(struct ieee80211_hw *dev, u8 *ssid, size_t ssid_len)
        return 0;
 }
 
-static int adm8211_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
+static int adm8211_config(struct ieee80211_hw *dev, u32 changed)
 {
        struct adm8211_priv *priv = dev->priv;
+       struct ieee80211_conf *conf = &dev->conf;
        int channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
 
        if (channel != priv->channel) {
index 9e47d727e2206ff28c647f648bb29caf4888057d..fcd688765d0468030569cb24d7579d75e7fa9a56 100644 (file)
@@ -219,8 +219,7 @@ static int ath5k_add_interface(struct ieee80211_hw *hw,
                struct ieee80211_if_init_conf *conf);
 static void ath5k_remove_interface(struct ieee80211_hw *hw,
                struct ieee80211_if_init_conf *conf);
-static int ath5k_config(struct ieee80211_hw *hw,
-               struct ieee80211_conf *conf);
+static int ath5k_config(struct ieee80211_hw *hw, u32 changed);
 static int ath5k_config_interface(struct ieee80211_hw *hw,
                struct ieee80211_vif *vif,
                struct ieee80211_if_conf *conf);
@@ -2780,10 +2779,10 @@ end:
  * TODO: Phy disable/diversity etc
  */
 static int
-ath5k_config(struct ieee80211_hw *hw,
-                       struct ieee80211_conf *conf)
+ath5k_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct ath5k_softc *sc = hw->priv;
+       struct ieee80211_conf *conf = &hw->conf;
 
        sc->bintval = conf->beacon_int;
        sc->power_level = conf->power_level;
index 5e087c92a6d9280d63c7de48c4482d10f98adea3..f49910799ede5869b079174abef89de5aae2beea 100644 (file)
@@ -1230,11 +1230,11 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
                        __func__, error);
 }
 
-static int ath9k_config(struct ieee80211_hw *hw,
-                       struct ieee80211_conf *conf)
+static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct ath_softc *sc = hw->priv;
        struct ieee80211_channel *curchan = hw->conf.channel;
+       struct ieee80211_conf *conf = &hw->conf;
        int pos;
 
        DPRINTF(sc, ATH_DBG_CONFIG, "%s: Set channel: %d MHz\n",
index 6b85428b0e1db7fa2334808e498b0e1e7647fd01..2e81af1022e4d36ef2a5202cbcad16e44d1f8371 100644 (file)
@@ -3320,11 +3320,12 @@ init_failure:
        return err;
 }
 
-static int b43_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
+static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct b43_wl *wl = hw_to_b43_wl(hw);
        struct b43_wldev *dev;
        struct b43_phy *phy;
+       struct ieee80211_conf *conf = &hw->conf;
        unsigned long flags;
        int antenna;
        int err = 0;
index 867f01ce45c72d1ec5050abcb21124c85300e3b0..793cc396562f4a0a340331a5d1278a0761e8e865 100644 (file)
@@ -2557,11 +2557,12 @@ init_failure:
 }
 
 static int b43legacy_op_dev_config(struct ieee80211_hw *hw,
-                                  struct ieee80211_conf *conf)
+                                  u32 changed)
 {
        struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
        struct b43legacy_wldev *dev;
        struct b43legacy_phy *phy;
+       struct ieee80211_conf *conf = &hw->conf;
        unsigned long flags;
        unsigned int new_phymode = 0xFFFF;
        int antenna_tx;
index e6695e80fb537b80c96e6eda81d654e6354e2e9d..79a24410dd0ae2aeb4ab47ce9dbe3f0eb1ae3c56 100644 (file)
@@ -2734,10 +2734,11 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw,
  * be set inappropriately and the driver currently sets the hardware up to
  * use it whenever needed.
  */
-static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
+static int iwl4965_mac_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct iwl_priv *priv = hw->priv;
        const struct iwl_channel_info *ch_info;
+       struct ieee80211_conf *conf = &hw->conf;
        unsigned long flags;
        int ret = 0;
        u16 channel;
index d3a2966d9181f241385a86df32b5c0fc61d38fae..b1464c71ea0a9f5b7cc5025cb1c0d50d52dd19e1 100644 (file)
@@ -6415,7 +6415,7 @@ static void iwl3945_bg_abort_scan(struct work_struct *work)
        mutex_unlock(&priv->mutex);
 }
 
-static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
+static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed);
 
 static void iwl3945_bg_scan_completed(struct work_struct *work)
 {
@@ -6428,7 +6428,7 @@ static void iwl3945_bg_scan_completed(struct work_struct *work)
                return;
 
        if (test_bit(STATUS_CONF_PENDING, &priv->status))
-               iwl3945_mac_config(priv->hw, ieee80211_get_hw_conf(priv->hw));
+               iwl3945_mac_config(priv->hw, 0);
 
        ieee80211_scan_completed(priv->hw);
 
@@ -6616,10 +6616,11 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw,
  * be set inappropriately and the driver currently sets the hardware up to
  * use it whenever needed.
  */
-static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
+static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct iwl3945_priv *priv = hw->priv;
        const struct iwl3945_channel_info *ch_info;
+       struct ieee80211_conf *conf = &hw->conf;
        unsigned long flags;
        int ret = 0;
 
index feff945ad856368e737eac8a344352b947ad73c5..241ddcfa352e51b38e2d7b07fa0cf3e03f7af924 100644 (file)
@@ -354,9 +354,11 @@ static void lbtf_op_remove_interface(struct ieee80211_hw *hw,
        priv->vif = NULL;
 }
 
-static int lbtf_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
+static int lbtf_op_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct lbtf_private *priv = hw->priv;
+       struct ieee80211_conf *conf = &hw->conf;
+
        if (conf->channel->center_freq != priv->cur_freq) {
                priv->cur_freq = conf->channel->center_freq;
                lbtf_set_channel(priv, conf->channel->hw_value);
index 3f236b54668308ff89d5d54cbdcd4f8811fbd533..e2aeef8de7071193623f2b301c6a9702816db0a6 100644 (file)
@@ -359,10 +359,10 @@ static void mac80211_hwsim_beacon(unsigned long arg)
 }
 
 
-static int mac80211_hwsim_config(struct ieee80211_hw *hw,
-                                struct ieee80211_conf *conf)
+static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct mac80211_hwsim_data *data = hw->priv;
+       struct ieee80211_conf *conf = &hw->conf;
 
        printk(KERN_DEBUG "%s:%s (freq=%d radio_enabled=%d beacon_int=%d)\n",
               wiphy_name(hw->wiphy), __func__,
index b3e75eb4d5bac0ee8a335b44a7e73bff5997e3aa..b3c297ed00cd84dc16523367ac3522abe42f7ba4 100644 (file)
@@ -1192,10 +1192,11 @@ static void p54_remove_interface(struct ieee80211_hw *dev,
        p54_set_filter(dev, 0, NULL);
 }
 
-static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
+static int p54_config(struct ieee80211_hw *dev, u32 changed)
 {
        int ret;
        struct p54_common *priv = dev->priv;
+       struct ieee80211_conf *conf = &dev->conf;
 
        mutex_lock(&priv->conf_mutex);
        priv->rx_antenna = 2; /* automatic */
index 1359a3768404b89b70e3908f2f297a46d9f30745..8ec8f7e9ec642746e336a9fc192d422b57aa1ea1 100644 (file)
@@ -997,7 +997,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
                            struct ieee80211_if_init_conf *conf);
 void rt2x00mac_remove_interface(struct ieee80211_hw *hw,
                                struct ieee80211_if_init_conf *conf);
-int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
+int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed);
 int rt2x00mac_config_interface(struct ieee80211_hw *hw,
                               struct ieee80211_vif *vif,
                               struct ieee80211_if_conf *conf);
index 9e0472bd1edfdb6350a29287afcd450fc576a220..697806cf94e208885983b02b6ac0d2a911c15517 100644 (file)
@@ -1245,7 +1245,7 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
        /*
         * Reconfigure device.
         */
-       retval = rt2x00mac_config(rt2x00dev->hw, &rt2x00dev->hw->conf);
+       retval = rt2x00mac_config(rt2x00dev->hw, ~0);
        if (retval)
                goto exit;
 
index 2c6cc5c374ff3be765b681e07d17fede815a3d22..da7b49a364fff45a3e7571619d7fdc96c036035d 100644 (file)
@@ -335,9 +335,10 @@ void rt2x00mac_remove_interface(struct ieee80211_hw *hw,
 }
 EXPORT_SYMBOL_GPL(rt2x00mac_remove_interface);
 
-int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
+int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct rt2x00_dev *rt2x00dev = hw->priv;
+       struct ieee80211_conf *conf = &hw->conf;
        int radio_on;
        int status;
 
index 9de8f57486df9e73ecc488f1c2914ab9c8fd2fb7..e8d22393797fe6629c62d1179e4d9f403000b6da 100644 (file)
@@ -692,9 +692,10 @@ static void rtl8180_remove_interface(struct ieee80211_hw *dev,
        priv->vif = NULL;
 }
 
-static int rtl8180_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
+static int rtl8180_config(struct ieee80211_hw *dev, u32 changed)
 {
        struct rtl8180_priv *priv = dev->priv;
+       struct ieee80211_conf *conf = &dev->conf;
 
        priv->rf->set_chan(dev, conf);
 
index 9ceae9017f86c63c8057096ecafdbc4850bb0244..2c69ab37c650594aaedb95e48e2c9c9ad16a0723 100644 (file)
@@ -873,9 +873,10 @@ static void rtl8187_remove_interface(struct ieee80211_hw *dev,
        mutex_unlock(&priv->conf_mutex);
 }
 
-static int rtl8187_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
+static int rtl8187_config(struct ieee80211_hw *dev, u32 changed)
 {
        struct rtl8187_priv *priv = dev->priv;
+       struct ieee80211_conf *conf = &dev->conf;
        u32 reg;
 
        mutex_lock(&priv->conf_mutex);
index de45509d757ea0669889b3e920705972a54b0285..6c3e21887fc8a00ba5a48b70a21bddafa81884ec 100644 (file)
@@ -743,9 +743,11 @@ static void zd_op_remove_interface(struct ieee80211_hw *hw,
        zd_write_mac_addr(&mac->chip, NULL);
 }
 
-static int zd_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
+static int zd_op_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct zd_mac *mac = zd_hw_mac(hw);
+       struct ieee80211_conf *conf = &hw->conf;
+
        return zd_chip_set_channel(&mac->chip, conf->channel->hw_value);
 }
 
index 5f28b7f89887f7cf566096f618a7b7b801ca2708..34e8569b59bbf4cbfd839b8b9c40e726a717a7df 100644 (file)
@@ -463,13 +463,33 @@ static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
 }
 #define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
 
+/**
+ * enum ieee80211_conf_changed - denotes which configuration changed
+ *
+ * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed
+ * @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed
+ * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
+ * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
+ * @IEEE80211_CONF_CHANGE_PS: the PS flag changed
+ * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
+ * @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed
+ */
+enum ieee80211_conf_changed {
+       IEEE80211_CONF_CHANGE_RADIO_ENABLED     = BIT(0),
+       IEEE80211_CONF_CHANGE_BEACON_INTERVAL   = BIT(1),
+       IEEE80211_CONF_CHANGE_LISTEN_INTERVAL   = BIT(2),
+       IEEE80211_CONF_CHANGE_RADIOTAP          = BIT(3),
+       IEEE80211_CONF_CHANGE_PS                = BIT(4),
+       IEEE80211_CONF_CHANGE_POWER             = BIT(5),
+       IEEE80211_CONF_CHANGE_CHANNEL           = BIT(6),
+};
+
 /**
  * struct ieee80211_conf - configuration of the device
  *
  * This struct indicates how the driver shall configure the hardware.
  *
  * @radio_enabled: when zero, driver is required to switch off the radio.
- *     TODO make a flag
  * @beacon_int: beacon interval (TODO make interface config)
  * @listen_interval: listen interval in units of beacon interval
  * @flags: configuration flags defined above
@@ -479,13 +499,13 @@ static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
  * @channel: the channel to tune to
  */
 struct ieee80211_conf {
-       int radio_enabled;
-
        int beacon_int;
-       u16 listen_interval;
        u32 flags;
        int power_level;
 
+       u16 listen_interval;
+       bool radio_enabled;
+
        struct ieee80211_channel *channel;
 
        struct ieee80211_sta_ht_cap ht_cap;
@@ -1214,7 +1234,7 @@ struct ieee80211_ops {
                             struct ieee80211_if_init_conf *conf);
        void (*remove_interface)(struct ieee80211_hw *hw,
                                 struct ieee80211_if_init_conf *conf);
-       int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
+       int (*config)(struct ieee80211_hw *hw, u32 changed);
        int (*config_interface)(struct ieee80211_hw *hw,
                                struct ieee80211_vif *vif,
                                struct ieee80211_if_conf *conf);
index a5dea617aab37b80552267afc17299b172987849..8ea30902d5db1d26a797320ae82bb9c5ba737fa0 100644 (file)
@@ -394,7 +394,8 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
         */
        if (params->interval) {
                sdata->local->hw.conf.beacon_int = params->interval;
-               ieee80211_hw_config(sdata->local);
+               ieee80211_hw_config(sdata->local,
+                                   IEEE80211_CONF_CHANGE_BEACON_INTERVAL);
                /*
                 * We updated some parameter so if below bails out
                 * it's not an error.
index 88015838a63c661c5c9d3a084bf68d78b6fc63e1..1deb787ff8dc7248d8ae52de3aca4a093212550a 100644 (file)
@@ -875,7 +875,7 @@ static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
 }
 
 
-int ieee80211_hw_config(struct ieee80211_local *local);
+int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
 int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed);
 void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
 void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
index 8336fee68d3e05b717047e4d8a1ac5f3623542a8..df28c5f7c9c0a2695f049fb6bb910b11a9886d62 100644 (file)
@@ -65,7 +65,7 @@ static int ieee80211_open(struct net_device *dev)
        struct ieee80211_if_init_conf conf;
        u32 changed = 0;
        int res;
-       bool need_hw_reconfig = 0;
+       u32 hw_reconf_flags = 0;
        u8 null_addr[ETH_ALEN] = {0};
 
        /* fail early if user set an invalid address */
@@ -152,7 +152,8 @@ static int ieee80211_open(struct net_device *dev)
                        res = local->ops->start(local_to_hw(local));
                if (res)
                        goto err_del_bss;
-               need_hw_reconfig = 1;
+               /* we're brought up, everything changes */
+               hw_reconf_flags = ~0;
                ieee80211_led_radio(local, local->hw.conf.radio_enabled);
        }
 
@@ -198,8 +199,10 @@ static int ieee80211_open(struct net_device *dev)
 
                /* must be before the call to ieee80211_configure_filter */
                local->monitors++;
-               if (local->monitors == 1)
+               if (local->monitors == 1) {
                        local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP;
+                       hw_reconf_flags |= IEEE80211_CONF_CHANGE_RADIOTAP;
+               }
 
                if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL)
                        local->fif_fcsfail++;
@@ -279,8 +282,8 @@ static int ieee80211_open(struct net_device *dev)
                atomic_inc(&local->iff_promiscs);
 
        local->open_count++;
-       if (need_hw_reconfig) {
-               ieee80211_hw_config(local);
+       if (hw_reconf_flags) {
+               ieee80211_hw_config(local, hw_reconf_flags);
                /*
                 * set default queue parameters so drivers don't
                 * need to initialise the hardware if the hardware
@@ -322,6 +325,7 @@ static int ieee80211_stop(struct net_device *dev)
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_if_init_conf conf;
        struct sta_info *sta;
+       u32 hw_reconf_flags = 0;
 
        /*
         * Stop TX on this interface first.
@@ -405,8 +409,10 @@ static int ieee80211_stop(struct net_device *dev)
                }
 
                local->monitors--;
-               if (local->monitors == 0)
+               if (local->monitors == 0) {
                        local->hw.conf.flags &= ~IEEE80211_CONF_RADIOTAP;
+                       hw_reconf_flags |= IEEE80211_CONF_CHANGE_RADIOTAP;
+               }
 
                if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL)
                        local->fif_fcsfail--;
@@ -504,8 +510,15 @@ static int ieee80211_stop(struct net_device *dev)
 
                tasklet_disable(&local->tx_pending_tasklet);
                tasklet_disable(&local->tasklet);
+
+               /* no reconfiguring after stop! */
+               hw_reconf_flags = 0;
        }
 
+       /* do after stop to avoid reconfiguring when we stop anyway */
+       if (hw_reconf_flags)
+               ieee80211_hw_config(local, hw_reconf_flags);
+
        return 0;
 }
 
index 07f812755e55fcb902fafbce34c87e91e13a183a..c936017f6d4888201698fe39abd03841f4c0779f 100644 (file)
@@ -197,31 +197,34 @@ int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed)
                                            &sdata->vif, &conf);
 }
 
-int ieee80211_hw_config(struct ieee80211_local *local)
+int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
 {
        struct ieee80211_channel *chan;
        int ret = 0;
+       int power;
 
        if (local->sw_scanning)
                chan = local->scan_channel;
        else
                chan = local->oper_channel;
 
-       local->hw.conf.channel = chan;
+       if (chan != local->hw.conf.channel) {
+               local->hw.conf.channel = chan;
+               changed |= IEEE80211_CONF_CHANGE_CHANNEL;
+       }
+
 
        if (!local->hw.conf.power_level)
-               local->hw.conf.power_level = chan->max_power;
+               power = chan->max_power;
        else
-               local->hw.conf.power_level = min(chan->max_power,
-                                              local->hw.conf.power_level);
-
-#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
-       printk(KERN_DEBUG "%s: HW CONFIG: freq=%d\n",
-              wiphy_name(local->hw.wiphy), chan->center_freq);
-#endif
+               power = min(chan->max_power, local->hw.conf.power_level);
+       if (local->hw.conf.power_level != power) {
+               changed |= IEEE80211_CONF_CHANGE_POWER;
+               local->hw.conf.power_level = power;
+       }
 
-       if (local->open_count) {
-               ret = local->ops->config(local_to_hw(local), &local->hw.conf);
+       if (changed && local->open_count) {
+               ret = local->ops->config(local_to_hw(local), changed);
                /*
                 * HW reconfiguration should never fail, the driver has told
                 * us what it can support so it should live up to that promise.
@@ -672,7 +675,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
        local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
        local->short_retry_limit = 7;
        local->long_retry_limit = 4;
-       local->hw.conf.radio_enabled = 1;
+       local->hw.conf.radio_enabled = true;
 
        INIT_LIST_HEAD(&local->interfaces);
 
index 0989b1c062e3faaf560c1d03aa4c79d0f2f3b113..7372d7abb8c0ecc439bb5a076640d1168e65947f 100644 (file)
@@ -448,12 +448,17 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
 
        if (local->hw_scanning) {
                local->hw_scanning = false;
-               ieee80211_hw_config(local);
+               /*
+                * Somebody might have requested channel change during scan
+                * that we won't have acted upon, try now. ieee80211_hw_config
+                * will set the flag based on actual changes.
+                */
+               ieee80211_hw_config(local, 0);
                goto done;
        }
 
        local->sw_scanning = false;
-       ieee80211_hw_config(local);
+       ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
 
        netif_tx_lock_bh(local->mdev);
        netif_addr_lock(local->mdev);
@@ -540,7 +545,8 @@ void ieee80211_scan_work(struct work_struct *work)
 
                if (!skip) {
                        local->scan_channel = chan;
-                       if (ieee80211_hw_config(local))
+                       if (ieee80211_hw_config(local,
+                                               IEEE80211_CONF_CHANGE_CHANNEL))
                                skip = 1;
                }
 
index 9941a60a23278f414ad2815f59098bc1797fdab6..3288c3de67ca24bce94000d44f8a746e5a818931 100644 (file)
@@ -645,7 +645,8 @@ int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz)
                if (local->sw_scanning || local->hw_scanning)
                        ret = 0;
                else
-                       ret = ieee80211_hw_config(local);
+                       ret = ieee80211_hw_config(
+                               local, IEEE80211_CONF_CHANGE_CHANNEL);
 
                rate_control_clear(local);
        }
index a3af1514124466c86aaeffaca482ece14fb52821..94c4b35eeb14dd88ac0fc42f3fe28e58d5e1a3db 100644 (file)
@@ -656,7 +656,7 @@ static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
                                      union iwreq_data *data, char *extra)
 {
        struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-       bool need_reconfig = 0;
+       u32 reconf_flags = 0;
        int new_power_level;
 
        if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM)
@@ -680,17 +680,17 @@ static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
 
        if (local->hw.conf.power_level != new_power_level) {
                local->hw.conf.power_level = new_power_level;
-               need_reconfig = 1;
+               reconf_flags |= IEEE80211_CONF_CHANGE_POWER;
        }
 
        if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) {
                local->hw.conf.radio_enabled = !(data->txpower.disabled);
-               need_reconfig = 1;
+               reconf_flags |= IEEE80211_CONF_CHANGE_RADIO_ENABLED;
                ieee80211_led_radio(local, local->hw.conf.radio_enabled);
        }
 
-       if (need_reconfig)
-               ieee80211_hw_config(local);
+       if (reconf_flags)
+               ieee80211_hw_config(local, reconf_flags);
 
        return 0;
 }
@@ -976,7 +976,7 @@ static int ieee80211_ioctl_siwpower(struct net_device *dev,
 
        if (wrq->disabled) {
                conf->flags &= ~IEEE80211_CONF_PS;
-               return ieee80211_hw_config(local);
+               return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
        }
 
        switch (wrq->flags & IW_POWER_MODE) {
@@ -989,7 +989,7 @@ static int ieee80211_ioctl_siwpower(struct net_device *dev,
                return -EINVAL;
        }
 
-       return ieee80211_hw_config(local);
+       return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
 }
 
 static int ieee80211_ioctl_giwpower(struct net_device *dev,