wlan: Fix 10th station is unable to connect when in SAP mode
Fixes: In SAP mode, while doing change interface from Station to SoftAP,
we are removing the p2p0 interface.
Change-Id: I0a82a79632208659a497c5af2e405fec1c9f251d
CRs-Fixed: 382752
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 1b904ff..700049e 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -1917,6 +1917,7 @@
struct wireless_dev *wdev;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev );
hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+ hdd_adapter_t *pP2pAdapter = NULL;
tCsrRoamProfile *pRoamProfile = NULL;
eCsrRoamBssType LastBSSType;
hdd_config_t *pConfig = pHddCtx->cfg_ini;
@@ -2009,6 +2010,26 @@
"%s: setting interface Type to %s", __func__,
(type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo");
+ if (NL80211_IFTYPE_AP == type)
+ {
+ /* As Loading WLAN Driver one interface being created for p2p device
+ * address. This will take one HW STA and the max number of clients
+ * that can connect to softAP will be reduced by one. so while changing
+ * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0
+ * interface as it is not required in SoftAP mode.
+ */
+
+ // Get P2P Adapter
+ pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE);
+
+ if (pP2pAdapter)
+ {
+ hdd_stop_adapter(pHddCtx, pP2pAdapter);
+ hdd_deinit_adapter(pHddCtx, pP2pAdapter);
+ hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE);
+ }
+ }
+
//De-init the adapter.
hdd_stop_adapter( pHddCtx, pAdapter );
hdd_deinit_adapter( pHddCtx, pAdapter );
diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c
index ebf9598..abfff18 100644
--- a/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -2686,24 +2686,6 @@
#ifdef CONFIG_CFG80211
wlan_hdd_set_monitor_tx_adapter( WLAN_HDD_GET_CTX(pAdapter), pAdapter );
#endif
-#ifdef WLAN_FEATURE_P2P
- /* If administrative interface is enabled then one interface being
- * created for p2p device address. This will take one HW STA and
- * the max number of clients that can connect to softAP will be
- * reduced by one. So as soon as SoftAP interface got created remove
- * the session for p2p device address.
- */
- if ( VOS_IS_STATUS_SUCCESS( status ) &&
- ( pAdapter->device_mode == WLAN_HDD_SOFTAP ) &&
- ( !strncmp( pAdapter->dev->name, "wlan", 4 )) )
- {
- /* TODO: Revisit this later, either unregister p2p0
- interface here or make change in wifi.c file to pass
- information, that driver is getting loaded for SAP interface,
- in that case, during load time don't start p2p0 interface
- */
- }
-#endif
EXIT();
return status;
}