From b5e38ef48a9907c974cb5c0ac93737c3590afbf4 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Mon, 2 Jan 2017 12:09:34 +0530 Subject: [PATCH] qcacld-3.0: Use cfg80211_roamed_bss API to indicate the roaming qcacld-2.0 to qcacld-3.0 propagation After disconnect request, the driver sends disconnect indication to the kernel and it schedules a workqueue to process this disconnect event. Now if this workqueue is delayed and connect request is received before its scheduled, the disconnect event workqueue reset the ssid_len of the wdev. Now as the ssid_len does not match with bss ssid length the get bss returns NULL and thus roam indication is not sent to supplicant. To fix this use cfg80211_roamed_bss to indicate the roaming and use the ssid and ssid len from driver to get the bss. Change-Id: I5b88ce41951cb61582ee801be124ca0b5b6b825b CRs-Fixed: 1098150 --- core/hdd/inc/wlan_hdd_main.h | 19 ++++++++++++++++ core/hdd/src/wlan_hdd_assoc.c | 32 +++++++++++++++----------- core/hdd/src/wlan_hdd_cfg80211.c | 39 +------------------------------- core/hdd/src/wlan_hdd_main.c | 6 +---- 4 files changed, 40 insertions(+), 56 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 182bb2ebc1..cdf77fdf51 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1982,6 +1982,25 @@ int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, bool reinit); int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx); int hdd_start_adapter(hdd_adapter_t *adapter); + +/** + * hdd_get_bss_entry() - Get the bss entry matching the chan, bssid and ssid + * @wiphy: wiphy + * @channel: channel of the BSS to find + * @bssid: bssid of the BSS to find + * @ssid: ssid of the BSS to find + * @ssid_len: ssid len of of the BSS to find + * + * The API is a wrapper to get bss from kernel matching the chan, + * bssid and ssid + * + * Return: bss structure if found else NULL + */ +struct cfg80211_bss *hdd_cfg80211_get_bss(struct wiphy *wiphy, + struct ieee80211_channel *channel, + const u8 *bssid, + const u8 *ssid, size_t ssid_len); + void hdd_connect_result(struct net_device *dev, const u8 *bssid, tCsrRoamInfo *roam_info, const u8 *req_ie, size_t req_ie_len, const u8 *resp_ie, diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 95ca434c61..564f62a657 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -1996,17 +1996,14 @@ static void hdd_send_re_assoc_event(struct net_device *dev, qdf_mem_zero(rspRsnIe + len, IW_GENERIC_IE_MAX - len); chan = ieee80211_get_channel(pAdapter->wdev.wiphy, - (int)pCsrRoamInfo->pBssDesc->channelId); + (int)pCsrRoamInfo->pBssDesc->channelId); sme_roam_get_connect_profile(hal_handle, pAdapter->sessionId, &roam_profile); - bss = cfg80211_get_bss(pAdapter->wdev.wiphy, chan, - pCsrRoamInfo->bssid.bytes, - &roam_profile.SSID.ssId[0], roam_profile.SSID.length, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) && !defined(WITH_BACKPORTS) - WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); -#else - IEEE80211_BSS_TYPE_ESS, IEEE80211_PRIVACY_ANY); -#endif + + bss = hdd_cfg80211_get_bss(pAdapter->wdev.wiphy, + chan, pCsrRoamInfo->bssid.bytes, + &roam_profile.SSID.ssId[0], + roam_profile.SSID.length); if (bss == NULL) hdd_err("Get BSS returned NULL"); @@ -2584,6 +2581,8 @@ static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter, if (ft_carrier_on) { if (!hddDisconInProgress) { + struct cfg80211_bss *roam_bss; + /* * After roaming is completed, * active session count is @@ -2620,10 +2619,17 @@ static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter, QDF_TRACE_LEVEL_DEBUG, pFTAssocReq, assocReqlen); - - cfg80211_roamed(dev, chan, - pRoamInfo-> - bssid.bytes, + roam_bss = + hdd_cfg80211_get_bss( + pAdapter->wdev.wiphy, + chan, + pRoamInfo->bssid.bytes, + pRoamInfo->u. + pConnectedProfile->SSID.ssId, + pRoamInfo->u. + pConnectedProfile->SSID.length); + cfg80211_roamed_bss(dev, + roam_bss, pFTAssocReq, assocReqlen, pFTAssocRsp, diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 241d7b6819..8ef0c9d6e0 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -11122,43 +11122,6 @@ static int wlan_hdd_cfg80211_set_default_key(struct wiphy *wiphy, return ret; } -/* - * wlan_hdd_cfg80211_get_bss :to get the bss from kernel cache. - * @wiphy: wiphy pointer - * @channel: channel of the BSS - * @bssid: Bssid of BSS - * @ssid: Ssid of the BSS - * @ssid_len: ssid length - * - * Return: bss found in kernel cache - */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) && !defined(WITH_BACKPORTS) -static -struct cfg80211_bss *wlan_hdd_cfg80211_get_bss(struct wiphy *wiphy, - struct ieee80211_channel *channel, const u8 *bssid, - const u8 *ssid, size_t ssid_len) -{ - return cfg80211_get_bss(wiphy, channel, bssid, - ssid, - ssid_len, - WLAN_CAPABILITY_ESS, - WLAN_CAPABILITY_ESS); -} -#else -static -struct cfg80211_bss *wlan_hdd_cfg80211_get_bss(struct wiphy *wiphy, - struct ieee80211_channel *channel, const u8 *bssid, - const u8 *ssid, size_t ssid_len) -{ - return cfg80211_get_bss(wiphy, channel, bssid, - ssid, - ssid_len, - IEEE80211_BSS_TYPE_ESS, - IEEE80211_PRIVACY_ANY); -} -#endif - - /* * wlan_hdd_cfg80211_update_bss_list :to inform nl80211 * interface that BSS might have been lost. @@ -11175,7 +11138,7 @@ struct cfg80211_bss *wlan_hdd_cfg80211_update_bss_list( struct wiphy *wiphy = wdev->wiphy; struct cfg80211_bss *bss = NULL; - bss = wlan_hdd_cfg80211_get_bss(wiphy, NULL, bssid, + bss = hdd_cfg80211_get_bss(wiphy, NULL, bssid, NULL, 0); if (bss == NULL) { hdd_err("BSS not present"); diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 998681aedb..dd2b96e19e 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3864,10 +3864,8 @@ static bool hdd_is_interface_up(hdd_adapter_t *adapter) return false; } -#if defined CFG80211_CONNECT_BSS #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) \ - && !defined(WITH_BACKPORTS) && !defined(IEEE80211_PRIVACY) -static + && !defined(WITH_BACKPORTS) struct cfg80211_bss *hdd_cfg80211_get_bss(struct wiphy *wiphy, struct ieee80211_channel *channel, const u8 *bssid, const u8 *ssid, @@ -3879,7 +3877,6 @@ struct cfg80211_bss *hdd_cfg80211_get_bss(struct wiphy *wiphy, WLAN_CAPABILITY_ESS); } #else -static struct cfg80211_bss *hdd_cfg80211_get_bss(struct wiphy *wiphy, struct ieee80211_channel *channel, const u8 *bssid, const u8 *ssid, @@ -3891,7 +3888,6 @@ struct cfg80211_bss *hdd_cfg80211_get_bss(struct wiphy *wiphy, IEEE80211_PRIVACY_ANY); } #endif -#endif #if defined CFG80211_CONNECT_BSS /**