ath10k: reload HT/VHT capabilities on antenna change
authorRajkumar Manoharan <rmanohar@qti.qualcomm.com>
Tue, 27 Oct 2015 12:21:14 +0000 (17:51 +0530)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 29 Oct 2015 11:00:55 +0000 (13:00 +0200)
To reflect configured antenna settings in HT/VHT MCS map,
reload the HT/VHT capabilities upon antenna change.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/mac.c

index 4e535e2..a7411fe 100644 (file)
@@ -3897,6 +3897,29 @@ static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar)
        return ht_cap;
 }
 
+static void ath10k_mac_setup_ht_vht_cap(struct ath10k *ar)
+{
+       struct ieee80211_supported_band *band;
+       struct ieee80211_sta_vht_cap vht_cap;
+       struct ieee80211_sta_ht_cap ht_cap;
+
+       ht_cap = ath10k_get_ht_cap(ar);
+       vht_cap = ath10k_create_vht_cap(ar);
+
+       if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
+               band = &ar->mac.sbands[IEEE80211_BAND_2GHZ];
+               band->ht_cap = ht_cap;
+
+               /* Enable the VHT support at 2.4 GHz */
+               band->vht_cap = vht_cap;
+       }
+       if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
+               band = &ar->mac.sbands[IEEE80211_BAND_5GHZ];
+               band->ht_cap = ht_cap;
+               band->vht_cap = vht_cap;
+       }
+}
+
 static int __ath10k_set_antenna(struct ath10k *ar, u32 tx_ant, u32 rx_ant)
 {
        int ret;
@@ -3929,6 +3952,9 @@ static int __ath10k_set_antenna(struct ath10k *ar, u32 tx_ant, u32 rx_ant)
                return ret;
        }
 
+       /* Reload HT/VHT capability */
+       ath10k_mac_setup_ht_vht_cap(ar);
+
        return 0;
 }
 
@@ -7102,8 +7128,6 @@ int ath10k_mac_register(struct ath10k *ar)
                WLAN_CIPHER_SUITE_AES_CMAC,
        };
        struct ieee80211_supported_band *band;
-       struct ieee80211_sta_vht_cap vht_cap;
-       struct ieee80211_sta_ht_cap ht_cap;
        void *channels;
        int ret;
 
@@ -7111,9 +7135,6 @@ int ath10k_mac_register(struct ath10k *ar)
 
        SET_IEEE80211_DEV(ar->hw, ar->dev);
 
-       ht_cap = ath10k_get_ht_cap(ar);
-       vht_cap = ath10k_create_vht_cap(ar);
-
        BUILD_BUG_ON((ARRAY_SIZE(ath10k_2ghz_channels) +
                      ARRAY_SIZE(ath10k_5ghz_channels)) !=
                     ATH10K_NUM_CHANS);
@@ -7132,10 +7153,6 @@ int ath10k_mac_register(struct ath10k *ar)
                band->channels = channels;
                band->n_bitrates = ath10k_g_rates_size;
                band->bitrates = ath10k_g_rates;
-               band->ht_cap = ht_cap;
-
-               /* Enable the VHT support at 2.4 GHz */
-               band->vht_cap = vht_cap;
 
                ar->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = band;
        }
@@ -7154,11 +7171,11 @@ int ath10k_mac_register(struct ath10k *ar)
                band->channels = channels;
                band->n_bitrates = ath10k_a_rates_size;
                band->bitrates = ath10k_a_rates;
-               band->ht_cap = ht_cap;
-               band->vht_cap = vht_cap;
                ar->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = band;
        }
 
+       ath10k_mac_setup_ht_vht_cap(ar);
+
        ar->hw->wiphy->interface_modes =
                BIT(NL80211_IFTYPE_STATION) |
                BIT(NL80211_IFTYPE_AP) |