rsi: remove interface changes for AP mode
authorPrameela Rani Garnepudi <prameela.j04cs@gmail.com>
Wed, 16 Aug 2017 13:13:10 +0000 (18:43 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 17 Aug 2017 07:06:55 +0000 (10:06 +0300)
remove_interface callback of mac80211 is handled for AP mode.
Same is notified to firmware through vap_capabilities frame
with VAP status VAP_DELETE.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rsi/rsi_91x_mac80211.c

index edcba567bfe8c593f9b1a741e923aecc0c9e2f26..99446bbc05162814c7d2946f65df240d59779df2 100644 (file)
@@ -405,13 +405,31 @@ static void rsi_mac80211_remove_interface(struct ieee80211_hw *hw,
 {
        struct rsi_hw *adapter = hw->priv;
        struct rsi_common *common = adapter->priv;
+       enum opmode opmode;
+
+       rsi_dbg(INFO_ZONE, "Remove Interface Called\n");
 
        mutex_lock(&common->mutex);
-       if (vif->type == NL80211_IFTYPE_STATION) {
-               adapter->sc_nvifs--;
-               rsi_set_vap_capabilities(common, STA_OPMODE, vif->addr,
-                                        0, VAP_DELETE);
+
+       if (adapter->sc_nvifs <= 0) {
+               mutex_unlock(&common->mutex);
+               return;
+       }
+
+       switch (vif->type) {
+       case NL80211_IFTYPE_STATION:
+               opmode = STA_OPMODE;
+               break;
+       case NL80211_IFTYPE_AP:
+               opmode = AP_OPMODE;
+               break;
+       default:
+               mutex_unlock(&common->mutex);
+               return;
        }
+       rsi_set_vap_capabilities(common, opmode, vif->addr,
+                                0, VAP_DELETE);
+       adapter->sc_nvifs--;
 
        if (!memcmp(adapter->vifs[0], vif, sizeof(struct ieee80211_vif)))
                adapter->vifs[0] = NULL;