Merge ssh://master.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6
[linux-2.6.git] / net / mac80211 / cfg.c
index 9cd73b1..140503d 100644 (file)
@@ -1215,6 +1215,9 @@ static int ieee80211_set_channel(struct wiphy *wiphy,
 {
        struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata = NULL;
+       struct ieee80211_channel *old_oper;
+       enum nl80211_channel_type old_oper_type;
+       enum nl80211_channel_type old_vif_oper_type= NL80211_CHAN_NO_HT;
 
        if (netdev)
                sdata = IEEE80211_DEV_TO_SUB_IF(netdev);
@@ -1232,13 +1235,23 @@ static int ieee80211_set_channel(struct wiphy *wiphy,
                break;
        }
 
-       local->oper_channel = chan;
+       if (sdata)
+               old_vif_oper_type = sdata->vif.bss_conf.channel_type;
+       old_oper_type = local->_oper_channel_type;
 
        if (!ieee80211_set_channel_type(local, sdata, channel_type))
                return -EBUSY;
 
-       ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
-       if (sdata && sdata->vif.type != NL80211_IFTYPE_MONITOR)
+       old_oper = local->oper_channel;
+       local->oper_channel = chan;
+
+       /* Update driver if changes were actually made. */
+       if ((old_oper != local->oper_channel) ||
+           (old_oper_type != local->_oper_channel_type))
+               ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
+
+       if ((sdata && sdata->vif.type != NL80211_IFTYPE_MONITOR) &&
+           old_vif_oper_type != sdata->vif.bss_conf.channel_type)
                ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_HT);
 
        return 0;
@@ -1274,8 +1287,11 @@ static int ieee80211_scan(struct wiphy *wiphy,
        case NL80211_IFTYPE_P2P_GO:
                if (sdata->local->ops->hw_scan)
                        break;
-               /* FIXME: implement NoA while scanning in software */
-               return -EOPNOTSUPP;
+               /*
+                * FIXME: implement NoA while scanning in software,
+                * for now fall through to allow scanning only when
+                * beaconing hasn't been configured yet
+                */
        case NL80211_IFTYPE_AP:
                if (sdata->u.ap.beacon)
                        return -EOPNOTSUPP;
@@ -1847,6 +1863,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
 
        wk->type = IEEE80211_WORK_OFFCHANNEL_TX;
        wk->chan = chan;
+       wk->chan_type = channel_type;
        wk->sdata = sdata;
        wk->done = ieee80211_offchan_tx_done;
        wk->offchan_tx.frame = skb;