diff options
| author | Himanshu Agarwal <himanaga@qti.qualcomm.com> | 2016-08-02 16:09:46 +0530 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2016-08-11 17:26:39 +0530 |
| commit | dfdcf02e91364b87d0abc1b34196b380fee8be81 (patch) | |
| tree | 2e9f008a424cfd1f7e3d1ca94262c20697c7d80b | |
| parent | 16e6385708ce0fc095b4e5b0a17fec480b23e697 (diff) | |
qcacld-2.0: Fix to make common change intf api for ibss/sta/p2pcli
Propagation from qcacld-3.0 to qcacld-2.0.
Current code is using seperate change interface for IBSS and
STA/P2PCLI.
Fix the API such that IBSS/STA/P2PCLI all can use same API.
Change-Id: I7a1d9fa3ef42091fcb7f71d95b604e3dceb8da50
CRs-Fixed: 1053289
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_cfg80211.c | 92 | ||||
| -rwxr-xr-x | CORE/HDD/src/wlan_hdd_main.c | 41 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/wma.c | 71 | ||||
| -rw-r--r-- | CORE/VOSS/src/vos_api.c | 3 |
4 files changed, 79 insertions, 128 deletions
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index a2ee8599c0ce..2eabccd8cc90 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -15071,29 +15071,22 @@ static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, return ret; } -static int -wlan_hdd_change_iface_to_adhoc(struct net_device *ndev, - tCsrRoamProfile *pRoamProfile, - enum nl80211_iftype type) -{ - hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(ndev); - hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); - hdd_config_t *pConfig = pHddCtx->cfg_ini; - struct wireless_dev *wdev = ndev->ieee80211_ptr; - - pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; - pRoamProfile->phyMode = hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); - pAdapter->device_mode = WLAN_HDD_IBSS; - wdev->iftype = type; - - return 0; -} - -static int wlan_hdd_change_iface_to_sta_mode(struct net_device *ndev, - enum nl80211_iftype type) +/** + * wlan_hdd_change_client_iface_to_new_mode() - to change iface to provided mode + * @ndev: pointer to net device provided by supplicant + * @type: type of the interface, upper layer wanted to change + * + * Upper layer provides the new interface mode that needs to be changed + * for given net device + * + * Return: success or failure in terms of integer value + */ +static int wlan_hdd_change_client_iface_to_new_mode(struct net_device *ndev, + enum nl80211_iftype type) { hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(ndev); hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); + hdd_config_t *config = pHddCtx->cfg_ini; hdd_wext_state_t *wext; struct wireless_dev *wdev; VOS_STATUS status; @@ -15115,6 +15108,8 @@ static int wlan_hdd_change_iface_to_sta_mode(struct net_device *ndev, pAdapter->device_mode = (type == NL80211_IFTYPE_STATION)? WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; + } else if (type == NL80211_IFTYPE_ADHOC) { + pAdapter->device_mode = WLAN_HDD_IBSS; } else { pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? @@ -15131,6 +15126,11 @@ static int wlan_hdd_change_iface_to_sta_mode(struct net_device *ndev, wext = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); wext->roamProfile.pAddIEScan = pAdapter->scan_info.scanAddIE.addIEdata; wext->roamProfile.nAddIEScanLength = pAdapter->scan_info.scanAddIE.length; + if (type == NL80211_IFTYPE_ADHOC) { + wext->roamProfile.BSSType = eCSR_BSS_TYPE_START_IBSS; + wext->roamProfile.phyMode = + hdd_cfg_xlate_to_csr_phy_mode(config->dot11Mode); + } EXIT(); return vos_status_to_os_return(status); @@ -15174,7 +15174,6 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, tCsrRoamProfile *pRoamProfile = NULL; eCsrRoamBssType LastBSSType; hdd_config_t *pConfig = NULL; - eMib_dot11DesiredBssType connectedBssType; unsigned long rc; VOS_STATUS vstatus; eHalStatus hstatus; @@ -15225,7 +15224,13 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, switch (type) { case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_P2P_CLIENT: - status = wlan_hdd_change_iface_to_sta_mode(ndev, type); + case NL80211_IFTYPE_ADHOC: + if (type == NL80211_IFTYPE_ADHOC) { + wlan_hdd_tdls_exit(pAdapter); + wlan_hdd_clean_tx_flow_control_timer(pHddCtx, pAdapter); + hddLog(LOG1, FL("Setting interface Type to ADHOC")); + } + status = wlan_hdd_change_client_iface_to_new_mode(ndev, type); if (status != 0) return status; @@ -15237,7 +15242,13 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, pAdapter); pAdapter->tx_flow_timer_initialized = VOS_TRUE; } - WLANTL_RegisterTXFlowControl(pHddCtx->pvosContext, + + /* + * for ibss interface type flow control is not required + * so don't register tx flow control + */ + if (type != NL80211_IFTYPE_ADHOC) + WLANTL_RegisterTXFlowControl(pHddCtx->pvosContext, hdd_tx_resume_cb, pAdapter->sessionId, (void *)pAdapter); @@ -15245,13 +15256,6 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, goto done; - case NL80211_IFTYPE_ADHOC: - wlan_hdd_tdls_exit(pAdapter); - wlan_hdd_clean_tx_flow_control_timer(pHddCtx, pAdapter); - hddLog(LOG1, FL("Setting interface Type to ADHOC")); - wlan_hdd_change_iface_to_adhoc(ndev, pRoamProfile, type); - break; - case NL80211_IFTYPE_AP: case NL80211_IFTYPE_P2P_GO: { @@ -15395,7 +15399,7 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_P2P_CLIENT: case NL80211_IFTYPE_ADHOC: - status = wlan_hdd_change_iface_to_sta_mode(ndev, type); + status = wlan_hdd_change_client_iface_to_new_mode(ndev, type); if (status != 0) return status; @@ -15455,32 +15459,6 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, return -EOPNOTSUPP; } - if (LastBSSType != pRoamProfile->BSSType) { - /* Interface type changed update in wiphy structure */ - wdev->iftype = type; - - /* The BSS mode changed, We need to issue disconnect - if connected or in IBSS disconnect state */ - if (hdd_connGetConnectedBssType( - WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType) || - (eCSR_BSS_TYPE_START_IBSS == LastBSSType)) { - /* Need to issue a disconnect to CSR.*/ - INIT_COMPLETION(pAdapter->disconnect_comp_var); - if (eHAL_STATUS_SUCCESS == - sme_RoamDisconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), - pAdapter->sessionId, - eCSR_DISCONNECT_REASON_UNSPECIFIED)) { - rc = wait_for_completion_timeout( - &pAdapter->disconnect_comp_var, - msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); - if (!rc) { - hddLog(LOGE, - FL("Wait on disconnect_comp_var failed")); - } - } - } - } - done: /* Set bitmask based on updated value */ wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c index e6134c499a49..f62cbee69e5b 100755 --- a/CORE/HDD/src/wlan_hdd_main.c +++ b/CORE/HDD/src/wlan_hdd_main.c @@ -10315,6 +10315,35 @@ static void hdd_close_tx_queues(hdd_context_t *hdd_ctx) EXIT(); } +/** + * hdd_check_and_init_tdls() - check and init TDLS operation for desired mode + * @adapter: pointer to device adapter + * @type: type of interface + * + * This routine will check the mode of adapter and if it is required then it + * will initialize the TDLS operations + * + * Return: VOS_STATUS + */ +#ifdef FEATURE_WLAN_TDLS +static VOS_STATUS hdd_check_and_init_tdls(hdd_adapter_t *adapter, uint32_t type) +{ + if (VOS_IBSS_MODE != type) { + if (0 != wlan_hdd_tdls_init(adapter)) { + hddLog(LOGE, FL("wlan_hdd_tdls_init failed")); + return VOS_STATUS_E_FAILURE; + } + set_bit(TDLS_INIT_DONE, &adapter->event_flags); + } + return VOS_STATUS_SUCCESS; +} +#else +static VOS_STATUS hdd_check_and_init_tdls(hdd_adapter_t *adapter, uint32_t type) +{ + return VOS_STATUS_SUCCESS; +} +#endif + VOS_STATUS hdd_init_station_mode( hdd_adapter_t *pAdapter ) { struct net_device *pWlanDev = pAdapter->dev; @@ -10410,23 +10439,15 @@ VOS_STATUS hdd_init_station_mode( hdd_adapter_t *pAdapter ) __func__, ret_val); } -#ifdef FEATURE_WLAN_TDLS - if(0 != wlan_hdd_tdls_init(pAdapter)) - { - status = VOS_STATUS_E_FAILURE; - hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wlan_hdd_tdls_init failed",__func__); + status = hdd_check_and_init_tdls(pAdapter, type); + if (status != VOS_STATUS_SUCCESS) goto error_tdls_init; - } - set_bit(TDLS_INIT_DONE, &pAdapter->event_flags); -#endif return VOS_STATUS_SUCCESS; -#ifdef FEATURE_WLAN_TDLS error_tdls_init: clear_bit(WMM_INIT_DONE, &pAdapter->event_flags); hdd_wmm_adapter_close(pAdapter); -#endif error_wmm_init: clear_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags); hdd_deinit_tx_rx(pAdapter); diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index 0af63c3a6f65..1858ffc560f4 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -15779,13 +15779,11 @@ static void wma_add_bss_ibss_mode(tp_wma_handle wma, tpAddBssParams add_bss) struct wma_target_req *msg; u_int8_t vdev_id, peer_id; VOS_STATUS status; - tDelStaSelfParams del_sta_param; - tAddStaSelfParams add_sta_self_param; tSetBssKeyParams key_info; u_int8_t nss_2g, nss_5g; - WMA_LOGD("%s: add_bss->sessionId = %d", __func__, add_bss->sessionId); - vdev_id = add_bss->sessionId; + WMA_LOGD("%s: add_bss->sessionId = %d", __func__, add_bss->sessionId); + vdev_id = add_bss->sessionId; pdev = vos_get_context(VOS_MODULE_ID_TXRX, wma->vos_context); if (NULL == pdev) { @@ -15809,64 +15807,15 @@ static void wma_add_bss_ibss_mode(tp_wma_handle wma, tpAddBssParams add_bss) goto send_fail_resp; } - /* only change vdev type to ibss during 1st time join_ibss handling */ - - if (FALSE == wma_is_vdev_in_ibss_mode(wma, vdev_id)) { - - WMA_LOGD("%s: vdev found for vdev id %d. deleting the vdev", - __func__, vdev_id); - - /* remove peers on the existing non-ibss vdev */ - TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { - WMA_LOGE("%s: peer found for vdev id %d. deleting the peer", - __func__, vdev_id); - wma_remove_peer(wma, (u_int8_t *)&vdev->mac_addr, - vdev_id, peer, VOS_FALSE); - } - - /* remove the non-ibss vdev */ - vos_copy_macaddr((v_MACADDR_t *)&(del_sta_param.selfMacAddr), - (v_MACADDR_t *)&(vdev->mac_addr)); - del_sta_param.sessionId = vdev_id; - del_sta_param.status = 0; - - wma_vdev_detach(wma, &del_sta_param, 0); - - /* create new vdev for ibss */ - vos_copy_macaddr((v_MACADDR_t *)&(add_sta_self_param.selfMacAddr), - (v_MACADDR_t *)&(add_bss->selfMacAddr)); - add_sta_self_param.sessionId = vdev_id; - add_sta_self_param.type = WMI_VDEV_TYPE_IBSS; - add_sta_self_param.subType = 0; - add_sta_self_param.status = 0; - add_sta_self_param.nss_2g = add_bss->nss_2g; - add_sta_self_param.nss_5g = add_bss->nss_5g; - add_sta_self_param.tx_aggregation_size = - add_bss->tx_aggregation_size; - add_sta_self_param.rx_aggregation_size = - add_bss->rx_aggregation_size; - - vdev = wma_vdev_attach(wma, &add_sta_self_param, 0); - if (!vdev) { - WMA_LOGE("%s: Failed to create vdev", __func__); - goto send_fail_resp; - } - - WLANTL_RegisterVdev(wma->vos_context, vdev); - /* Register with TxRx Module for Data Ack Complete Cb */ - wdi_in_data_tx_cb_set(vdev, wma_data_tx_ack_comp_hdlr, wma); - WMA_LOGA("new IBSS vdev created with mac %pM", add_bss->selfMacAddr); - - /* create ibss bss peer */ - status = wma_create_peer(wma, pdev, vdev, add_bss->selfMacAddr, - WMI_PEER_TYPE_DEFAULT, vdev_id, - VOS_FALSE); - if (status != VOS_STATUS_SUCCESS) { + /* create ibss bss peer */ + status = wma_create_peer(wma, pdev, vdev, add_bss->selfMacAddr, + WMI_PEER_TYPE_DEFAULT, vdev_id, + VOS_FALSE); + if (status != VOS_STATUS_SUCCESS) { WMA_LOGE("%s: Failed to create peer", __func__); - goto send_fail_resp; - } - WMA_LOGA("IBSS BSS peer created with mac %pM", add_bss->selfMacAddr); - } + goto send_fail_resp; + } + WMA_LOGA("IBSS BSS peer created with mac %pM", add_bss->selfMacAddr); peer = ol_txrx_find_peer_by_addr(pdev, add_bss->selfMacAddr, &peer_id); if (!peer) { diff --git a/CORE/VOSS/src/vos_api.c b/CORE/VOSS/src/vos_api.c index de027652b253..d02535b0e19d 100644 --- a/CORE/VOSS/src/vos_api.c +++ b/CORE/VOSS/src/vos_api.c @@ -2381,6 +2381,9 @@ VOS_STATUS vos_get_vdev_types(tVOS_CON_MODE mode, tANI_U32 *type, case VOS_OCB_MODE: *type = WMI_VDEV_TYPE_OCB; break; + case VOS_IBSS_MODE: + *type = WMI_VDEV_TYPE_IBSS; + break; case VOS_NDI_MODE: *type = WMI_VDEV_TYPE_NDI; break; |
