Merge tag 'char-misc-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[firefly-linux-kernel-4.4.55.git] / net / mac80211 / tdls.c
index 8a92a920ff17fa78b76640439f5ed81fd7a0ccb3..ad31b2dab4f5ab0731d53e54f00b30e65b085ec4 100644 (file)
@@ -167,23 +167,16 @@ static void ieee80211_tdls_add_bss_coex_ie(struct sk_buff *skb)
 static u16 ieee80211_get_tdls_sta_capab(struct ieee80211_sub_if_data *sdata,
                                        u16 status_code)
 {
-       struct ieee80211_local *local = sdata->local;
-       u16 capab;
-
        /* The capability will be 0 when sending a failure code */
        if (status_code != 0)
                return 0;
 
-       capab = 0;
-       if (ieee80211_get_sdata_band(sdata) != IEEE80211_BAND_2GHZ)
-               return capab;
-
-       if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE))
-               capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME;
-       if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE))
-               capab |= WLAN_CAPABILITY_SHORT_PREAMBLE;
+       if (ieee80211_get_sdata_band(sdata) == IEEE80211_BAND_2GHZ) {
+               return WLAN_CAPABILITY_SHORT_SLOT_TIME |
+                      WLAN_CAPABILITY_SHORT_PREAMBLE;
+       }
 
-       return capab;
+       return 0;
 }
 
 static void ieee80211_tdls_add_link_ie(struct ieee80211_sub_if_data *sdata,
@@ -942,7 +935,7 @@ ieee80211_tdls_prep_mgmt_packet(struct wiphy *wiphy, struct net_device *dev,
         * packet through the AP.
         */
        if ((action_code == WLAN_TDLS_TEARDOWN) &&
-           (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)) {
+           ieee80211_hw_check(&sdata->local->hw, REPORTS_TX_ACK_STATUS)) {
                bool try_resend; /* Should we keep skb for possible resend */
 
                /* If not sending directly to peer - no point in keeping skb */
@@ -1183,6 +1176,12 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
 
        switch (oper) {
        case NL80211_TDLS_ENABLE_LINK:
+               if (sdata->vif.csa_active) {
+                       tdls_dbg(sdata, "TDLS: disallow link during CSA\n");
+                       ret = -EBUSY;
+                       break;
+               }
+
                rcu_read_lock();
                sta = sta_info_get(sdata, peer);
                if (!sta) {