From d796457f7a562485b4a97670743c642c2a5c8dc7 Mon Sep 17 00:00:00 2001 From: Shital Jaju Date: Thu, 14 Aug 2014 10:13:26 -0700 Subject: [PATCH] Update the cfg layer with new channel info The upper layer is not notified of the change in channel after roaming. This results in AGO creation on incorrect channel (previous AP channel) after roaming. This change will update the cfg layer with the new channel info after receiving romaing event. Bug 200024418 Change-Id: Iabe7b329edc14fcc1491ec99966d06f249468105 Signed-off-by: Shital Jaju (cherry picked from commit df1e9aa0c460ee38f07a9a2ecd20006bf825c8a3) Reviewed-on: http://git-master/r/552767 Reviewed-by: Bibhay Ranjan Reviewed-by: Srinivas Ramachandran Tested-by: Srinivas Ramachandran Reviewed-by: Ashutosh Jha --- drivers/net/wireless/bcmdhd/wl_cfg80211.c | 37 +++++++++++++++-------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/bcmdhd/wl_cfg80211.c b/drivers/net/wireless/bcmdhd/wl_cfg80211.c index 12c88db6e1c..328ce79d24a 100644 --- a/drivers/net/wireless/bcmdhd/wl_cfg80211.c +++ b/drivers/net/wireless/bcmdhd/wl_cfg80211.c @@ -7537,26 +7537,37 @@ static s32 wl_update_bss_info(struct wl_priv *wl, struct net_device *ndev) u8 *curbssid; s32 err = 0; struct wiphy *wiphy; + struct ieee80211_supported_band *band; + struct ieee80211_channel *channel = NULL; + u16 chan; + u32 freq; + mutex_lock(&wl->usr_sync); wiphy = wl_to_wiphy(wl); ssid = (struct wlc_ssid *)wl_read_prof(wl, ndev, WL_PROF_SSID); curbssid = wl_read_prof(wl, ndev, WL_PROF_BSSID); - bss = cfg80211_get_bss(wiphy, NULL, curbssid, - ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, - WLAN_CAPABILITY_ESS); - - mutex_lock(&wl->usr_sync); + *(u32 *) wl->extra_buf = htod32(WL_EXTRA_BUF_MAX); + err = wldev_ioctl(ndev, WLC_GET_BSS_INFO, + wl->extra_buf, WL_EXTRA_BUF_MAX, false); + if (unlikely(err)) { + WL_ERR(("Could not get bss info %d\n", err)); + goto update_bss_info_out; + } + bi = (struct wl_bss_info *)(wl->extra_buf + 4); + chan = bi->ctl_ch ? bi->ctl_ch : + CHSPEC_CHANNEL(wl_chspec_driver_to_host(bi->chanspec)); + if (chan <= CH_MAX_2G_CHANNEL) + band = wiphy->bands[IEEE80211_BAND_2GHZ]; + else + band = wiphy->bands[IEEE80211_BAND_5GHZ]; + freq = ieee80211_channel_to_frequency(chan, band->band); + channel = ieee80211_get_channel(wiphy, freq); + bss = cfg80211_get_bss(wiphy, channel, curbssid, + ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, + WLAN_CAPABILITY_ESS); if (!bss) { WL_DBG(("Could not find the AP\n")); - *(u32 *) wl->extra_buf = htod32(WL_EXTRA_BUF_MAX); - err = wldev_ioctl(ndev, WLC_GET_BSS_INFO, - wl->extra_buf, WL_EXTRA_BUF_MAX, false); - if (unlikely(err)) { - WL_ERR(("Could not get bss info %d\n", err)); - goto update_bss_info_out; - } - bi = (struct wl_bss_info *)(wl->extra_buf + 4); if (memcmp(bi->BSSID.octet, curbssid, ETHER_ADDR_LEN)) { WL_ERR(("Bssid doesn't match\n")); err = -EIO; -- 2.39.2