aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvraham Stern <avraham.stern@intel.com>2017-04-26 03:58:49 -0400
committerJohannes Berg <johannes.berg@intel.com>2017-04-28 06:28:44 -0400
commit29ce6ecbb83c9185d76e3a7c340c9702d2a54961 (patch)
treecb823f5b578cdef2caab533d0d0d37910b83ddc4
parent21a8e9dd52b64f0170bad208293ef8c30c3c1403 (diff)
cfg80211: unify cfg80211_roamed() and cfg80211_roamed_bss()
cfg80211_roamed() and cfg80211_roamed_bss() take the same arguments except that cfg80211_roamed() requires the BSSID and cfg80211_roamed_bss() requires the bss entry. Unify the two functions by using a struct for driver initiated roaming information so that either the BSSID or the bss entry can be passed as an argument to the unified function. Signed-off-by: Avraham Stern <avraham.stern@intel.com> [modified the ath6k, brcm80211, rndis and wlan-ng drivers accordingly] Signed-off-by: Luca Coelho <luciano.coelho@intel.com> [modify brcmfmac to remove the useless cast, spotted by Arend] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c10
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c13
-rw-r--r--drivers/net/wireless/rndis_wlan.c19
-rw-r--r--drivers/staging/wlan-ng/cfg80211.c7
-rw-r--r--include/net/cfg80211.h58
-rw-r--r--net/wireless/core.h12
-rw-r--r--net/wireless/nl80211.c18
-rw-r--r--net/wireless/nl80211.h5
-rw-r--r--net/wireless/sme.c90
-rw-r--r--net/wireless/util.c4
10 files changed, 115 insertions, 121 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index fd53ffb1f014..0bc42fcceb74 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -806,9 +806,15 @@ void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
806 WLAN_STATUS_SUCCESS, GFP_KERNEL); 806 WLAN_STATUS_SUCCESS, GFP_KERNEL);
807 cfg80211_put_bss(ar->wiphy, bss); 807 cfg80211_put_bss(ar->wiphy, bss);
808 } else if (vif->sme_state == SME_CONNECTED) { 808 } else if (vif->sme_state == SME_CONNECTED) {
809 struct cfg80211_roam_info roam_info = {
810 .bss = bss,
811 .req_ie = assoc_req_ie,
812 .req_ie_len = assoc_req_len,
813 .resp_ie = assoc_resp_ie,
814 .resp_ie_len = assoc_resp_len,
815 };
809 /* inform roam event to cfg80211 */ 816 /* inform roam event to cfg80211 */
810 cfg80211_roamed_bss(vif->ndev, bss, assoc_req_ie, assoc_req_len, 817 cfg80211_roamed(vif->ndev, &roam_info, GFP_KERNEL);
811 assoc_resp_ie, assoc_resp_len, GFP_KERNEL);
812 } 818 }
813} 819}
814 820
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 130f0d4eda06..b43cccfb66b6 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -5359,6 +5359,7 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
5359 struct ieee80211_supported_band *band; 5359 struct ieee80211_supported_band *band;
5360 struct brcmf_bss_info_le *bi; 5360 struct brcmf_bss_info_le *bi;
5361 struct brcmu_chan ch; 5361 struct brcmu_chan ch;
5362 struct cfg80211_roam_info roam_info = {};
5362 u32 freq; 5363 u32 freq;
5363 s32 err = 0; 5364 s32 err = 0;
5364 u8 *buf; 5365 u8 *buf;
@@ -5397,9 +5398,15 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
5397 5398
5398done: 5399done:
5399 kfree(buf); 5400 kfree(buf);
5400 cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid, 5401
5401 conn_info->req_ie, conn_info->req_ie_len, 5402 roam_info.channel = notify_channel;
5402 conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); 5403 roam_info.bssid = profile->bssid;
5404 roam_info.req_ie = conn_info->req_ie;
5405 roam_info.req_ie_len = conn_info->req_ie_len;
5406 roam_info.resp_ie = conn_info->resp_ie;
5407 roam_info.resp_ie_len = conn_info->resp_ie_len;
5408
5409 cfg80211_roamed(ndev, &roam_info, GFP_KERNEL);
5403 brcmf_dbg(CONN, "Report roaming result\n"); 5410 brcmf_dbg(CONN, "Report roaming result\n");
5404 5411
5405 set_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state); 5412 set_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state);
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index eb513628d801..37ae24cbf00e 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2830,15 +2830,22 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev)
2830 } 2830 }
2831 2831
2832 if (priv->infra_mode == NDIS_80211_INFRA_INFRA) { 2832 if (priv->infra_mode == NDIS_80211_INFRA_INFRA) {
2833 if (!roamed) 2833 if (!roamed) {
2834 cfg80211_connect_result(usbdev->net, bssid, req_ie, 2834 cfg80211_connect_result(usbdev->net, bssid, req_ie,
2835 req_ie_len, resp_ie, 2835 req_ie_len, resp_ie,
2836 resp_ie_len, 0, GFP_KERNEL); 2836 resp_ie_len, 0, GFP_KERNEL);
2837 else 2837 } else {
2838 cfg80211_roamed(usbdev->net, 2838 struct cfg80211_roam_info roam_info = {
2839 get_current_channel(usbdev, NULL), 2839 .channel = get_current_channel(usbdev, NULL),
2840 bssid, req_ie, req_ie_len, 2840 .bssid = bssid,
2841 resp_ie, resp_ie_len, GFP_KERNEL); 2841 .req_ie = req_ie,
2842 .req_ie_len = req_ie_len,
2843 .resp_ie = resp_ie,
2844 .resp_ie_len = resp_ie_len,
2845 };
2846
2847 cfg80211_roamed(usbdev->net, &roam_info, GFP_KERNEL);
2848 }
2842 } else if (priv->infra_mode == NDIS_80211_INFRA_ADHOC) 2849 } else if (priv->infra_mode == NDIS_80211_INFRA_ADHOC)
2843 cfg80211_ibss_joined(usbdev->net, bssid, 2850 cfg80211_ibss_joined(usbdev->net, bssid,
2844 get_current_channel(usbdev, NULL), 2851 get_current_channel(usbdev, NULL),
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
index cbb3388a9756..178f6f5d4613 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -666,8 +666,11 @@ void prism2_disconnected(struct wlandevice *wlandev)
666 666
667void prism2_roamed(struct wlandevice *wlandev) 667void prism2_roamed(struct wlandevice *wlandev)
668{ 668{
669 cfg80211_roamed(wlandev->netdev, NULL, wlandev->bssid, 669 struct cfg80211_roam_info roam_info = {
670 NULL, 0, NULL, 0, GFP_KERNEL); 670 .bssid = wlandev->bssid,
671 };
672
673 cfg80211_roamed(wlandev->netdev, &roam_info, GFP_KERNEL);
671} 674}
672 675
673/* Structures for declaring wiphy interface */ 676/* Structures for declaring wiphy interface */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index aa663f70969c..52e810fe0833 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2686,8 +2686,7 @@ struct cfg80211_nan_func {
2686 * indication of requesting reassociation. 2686 * indication of requesting reassociation.
2687 * In both the driver-initiated and new connect() call initiated roaming 2687 * In both the driver-initiated and new connect() call initiated roaming
2688 * cases, the result of roaming is indicated with a call to 2688 * cases, the result of roaming is indicated with a call to
2689 * cfg80211_roamed() or cfg80211_roamed_bss(). 2689 * cfg80211_roamed(). (invoked with the wireless_dev mutex held)
2690 * (invoked with the wireless_dev mutex held)
2691 * @update_connect_params: Update the connect parameters while connected to a 2690 * @update_connect_params: Update the connect parameters while connected to a
2692 * BSS. The updated parameters can be used by driver/firmware for 2691 * BSS. The updated parameters can be used by driver/firmware for
2693 * subsequent BSS selection (roaming) decisions and to form the 2692 * subsequent BSS selection (roaming) decisions and to form the
@@ -5390,51 +5389,46 @@ cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
5390} 5389}
5391 5390
5392/** 5391/**
5393 * cfg80211_roamed - notify cfg80211 of roaming 5392 * struct cfg80211_roam_info - driver initiated roaming information
5394 * 5393 *
5395 * @dev: network device
5396 * @channel: the channel of the new AP 5394 * @channel: the channel of the new AP
5397 * @bssid: the BSSID of the new AP 5395 * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
5396 * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
5398 * @req_ie: association request IEs (maybe be %NULL) 5397 * @req_ie: association request IEs (maybe be %NULL)
5399 * @req_ie_len: association request IEs length 5398 * @req_ie_len: association request IEs length
5400 * @resp_ie: association response IEs (may be %NULL) 5399 * @resp_ie: association response IEs (may be %NULL)
5401 * @resp_ie_len: assoc response IEs length 5400 * @resp_ie_len: assoc response IEs length
5402 * @gfp: allocation flags
5403 *
5404 * It should be called by the underlying driver whenever it roamed
5405 * from one AP to another while connected.
5406 */ 5401 */
5407void cfg80211_roamed(struct net_device *dev, 5402struct cfg80211_roam_info {
5408 struct ieee80211_channel *channel, 5403 struct ieee80211_channel *channel;
5409 const u8 *bssid, 5404 struct cfg80211_bss *bss;
5410 const u8 *req_ie, size_t req_ie_len, 5405 const u8 *bssid;
5411 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 5406 const u8 *req_ie;
5407 size_t req_ie_len;
5408 const u8 *resp_ie;
5409 size_t resp_ie_len;
5410};
5412 5411
5413/** 5412/**
5414 * cfg80211_roamed_bss - notify cfg80211 of roaming 5413 * cfg80211_roamed - notify cfg80211 of roaming
5415 * 5414 *
5416 * @dev: network device 5415 * @dev: network device
5417 * @bss: entry of bss to which STA got roamed 5416 * @info: information about the new BSS. struct &cfg80211_roam_info.
5418 * @req_ie: association request IEs (maybe be %NULL)
5419 * @req_ie_len: association request IEs length
5420 * @resp_ie: association response IEs (may be %NULL)
5421 * @resp_ie_len: assoc response IEs length
5422 * @gfp: allocation flags 5417 * @gfp: allocation flags
5423 * 5418 *
5424 * This is just a wrapper to notify cfg80211 of roaming event with driver 5419 * This function may be called with the driver passing either the BSSID of the
5425 * passing bss to avoid a race in timeout of the bss entry. It should be 5420 * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
5426 * called by the underlying driver whenever it roamed from one AP to another 5421 * It should be called by the underlying driver whenever it roamed from one AP
5427 * while connected. Drivers which have roaming implemented in firmware 5422 * to another while connected. Drivers which have roaming implemented in
5428 * may use this function to avoid a race in bss entry timeout where the bss 5423 * firmware should pass the bss entry to avoid a race in bss entry timeout where
5429 * entry of the new AP is seen in the driver, but gets timed out by the time 5424 * the bss entry of the new AP is seen in the driver, but gets timed out by the
5430 * it is accessed in __cfg80211_roamed() due to delay in scheduling 5425 * time it is accessed in __cfg80211_roamed() due to delay in scheduling
5431 * rdev->event_work. In case of any failures, the reference is released 5426 * rdev->event_work. In case of any failures, the reference is released
5432 * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise, 5427 * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
5433 * it will be released while diconneting from the current bss. 5428 * released while diconneting from the current bss.
5434 */ 5429 */
5435void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, 5430void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
5436 const u8 *req_ie, size_t req_ie_len, 5431 gfp_t gfp);
5437 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
5438 5432
5439/** 5433/**
5440 * cfg80211_disconnected - notify cfg80211 that connection was dropped 5434 * cfg80211_disconnected - notify cfg80211 that connection was dropped
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 06eaf96053a8..96baffab5e5b 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -224,13 +224,7 @@ struct cfg80211_event {
224 224
225 union { 225 union {
226 struct cfg80211_connect_resp_params cr; 226 struct cfg80211_connect_resp_params cr;
227 struct { 227 struct cfg80211_roam_info rm;
228 const u8 *req_ie;
229 const u8 *resp_ie;
230 size_t req_ie_len;
231 size_t resp_ie_len;
232 struct cfg80211_bss *bss;
233 } rm;
234 struct { 228 struct {
235 const u8 *ie; 229 const u8 *ie;
236 size_t ie_len; 230 size_t ie_len;
@@ -390,9 +384,7 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
390 struct net_device *dev, u16 reason, 384 struct net_device *dev, u16 reason,
391 bool wextev); 385 bool wextev);
392void __cfg80211_roamed(struct wireless_dev *wdev, 386void __cfg80211_roamed(struct wireless_dev *wdev,
393 struct cfg80211_bss *bss, 387 struct cfg80211_roam_info *info);
394 const u8 *req_ie, size_t req_ie_len,
395 const u8 *resp_ie, size_t resp_ie_len);
396int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, 388int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
397 struct wireless_dev *wdev); 389 struct wireless_dev *wdev);
398void cfg80211_autodisconnect_wk(struct work_struct *work); 390void cfg80211_autodisconnect_wk(struct work_struct *work);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index dce69a87d4d0..570fc95dc507 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -13646,14 +13646,14 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
13646} 13646}
13647 13647
13648void nl80211_send_roamed(struct cfg80211_registered_device *rdev, 13648void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
13649 struct net_device *netdev, const u8 *bssid, 13649 struct net_device *netdev,
13650 const u8 *req_ie, size_t req_ie_len, 13650 struct cfg80211_roam_info *info, gfp_t gfp)
13651 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp)
13652{ 13651{
13653 struct sk_buff *msg; 13652 struct sk_buff *msg;
13654 void *hdr; 13653 void *hdr;
13654 const u8 *bssid = info->bss ? info->bss->bssid : info->bssid;
13655 13655
13656 msg = nlmsg_new(100 + req_ie_len + resp_ie_len, gfp); 13656 msg = nlmsg_new(100 + info->req_ie_len + info->resp_ie_len, gfp);
13657 if (!msg) 13657 if (!msg)
13658 return; 13658 return;
13659 13659
@@ -13666,10 +13666,12 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
13666 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || 13666 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
13667 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || 13667 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) ||
13668 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid) || 13668 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid) ||
13669 (req_ie && 13669 (info->req_ie &&
13670 nla_put(msg, NL80211_ATTR_REQ_IE, req_ie_len, req_ie)) || 13670 nla_put(msg, NL80211_ATTR_REQ_IE, info->req_ie_len,
13671 (resp_ie && 13671 info->req_ie)) ||
13672 nla_put(msg, NL80211_ATTR_RESP_IE, resp_ie_len, resp_ie))) 13672 (info->resp_ie &&
13673 nla_put(msg, NL80211_ATTR_RESP_IE, info->resp_ie_len,
13674 info->resp_ie)))
13673 goto nla_put_failure; 13675 goto nla_put_failure;
13674 13676
13675 genlmsg_end(msg, hdr); 13677 genlmsg_end(msg, hdr);
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index d5f6860e62ab..b96933322077 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -56,9 +56,8 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
56 struct cfg80211_connect_resp_params *params, 56 struct cfg80211_connect_resp_params *params,
57 gfp_t gfp); 57 gfp_t gfp);
58void nl80211_send_roamed(struct cfg80211_registered_device *rdev, 58void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
59 struct net_device *netdev, const u8 *bssid, 59 struct net_device *netdev,
60 const u8 *req_ie, size_t req_ie_len, 60 struct cfg80211_roam_info *info, gfp_t gfp);
61 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
62void nl80211_send_disconnected(struct cfg80211_registered_device *rdev, 61void nl80211_send_disconnected(struct cfg80211_registered_device *rdev,
63 struct net_device *netdev, u16 reason, 62 struct net_device *netdev, u16 reason,
64 const u8 *ie, size_t ie_len, bool from_ap); 63 const u8 *ie, size_t ie_len, bool from_ap);
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 6459bb7c21f7..532a0007ce82 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -5,6 +5,7 @@
5 * 5 *
6 * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
7 * Copyright (C) 2009 Intel Corporation. All rights reserved. 7 * Copyright (C) 2009 Intel Corporation. All rights reserved.
8 * Copyright 2017 Intel Deutschland GmbH
8 */ 9 */
9 10
10#include <linux/etherdevice.h> 11#include <linux/etherdevice.h>
@@ -870,9 +871,7 @@ EXPORT_SYMBOL(cfg80211_connect_done);
870 871
871/* Consumes bss object one way or another */ 872/* Consumes bss object one way or another */
872void __cfg80211_roamed(struct wireless_dev *wdev, 873void __cfg80211_roamed(struct wireless_dev *wdev,
873 struct cfg80211_bss *bss, 874 struct cfg80211_roam_info *info)
874 const u8 *req_ie, size_t req_ie_len,
875 const u8 *resp_ie, size_t resp_ie_len)
876{ 875{
877#ifdef CONFIG_CFG80211_WEXT 876#ifdef CONFIG_CFG80211_WEXT
878 union iwreq_data wrqu; 877 union iwreq_data wrqu;
@@ -890,97 +889,84 @@ void __cfg80211_roamed(struct wireless_dev *wdev,
890 cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub); 889 cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub);
891 wdev->current_bss = NULL; 890 wdev->current_bss = NULL;
892 891
893 cfg80211_hold_bss(bss_from_pub(bss)); 892 if (WARN_ON(!info->bss))
894 wdev->current_bss = bss_from_pub(bss); 893 return;
894
895 cfg80211_hold_bss(bss_from_pub(info->bss));
896 wdev->current_bss = bss_from_pub(info->bss);
895 897
896 nl80211_send_roamed(wiphy_to_rdev(wdev->wiphy), 898 nl80211_send_roamed(wiphy_to_rdev(wdev->wiphy),
897 wdev->netdev, bss->bssid, 899 wdev->netdev, info, GFP_KERNEL);
898 req_ie, req_ie_len, resp_ie, resp_ie_len,
899 GFP_KERNEL);
900 900
901#ifdef CONFIG_CFG80211_WEXT 901#ifdef CONFIG_CFG80211_WEXT
902 if (req_ie) { 902 if (info->req_ie) {
903 memset(&wrqu, 0, sizeof(wrqu)); 903 memset(&wrqu, 0, sizeof(wrqu));
904 wrqu.data.length = req_ie_len; 904 wrqu.data.length = info->req_ie_len;
905 wireless_send_event(wdev->netdev, IWEVASSOCREQIE, 905 wireless_send_event(wdev->netdev, IWEVASSOCREQIE,
906 &wrqu, req_ie); 906 &wrqu, info->req_ie);
907 } 907 }
908 908
909 if (resp_ie) { 909 if (info->resp_ie) {
910 memset(&wrqu, 0, sizeof(wrqu)); 910 memset(&wrqu, 0, sizeof(wrqu));
911 wrqu.data.length = resp_ie_len; 911 wrqu.data.length = info->resp_ie_len;
912 wireless_send_event(wdev->netdev, IWEVASSOCRESPIE, 912 wireless_send_event(wdev->netdev, IWEVASSOCRESPIE,
913 &wrqu, resp_ie); 913 &wrqu, info->resp_ie);
914 } 914 }
915 915
916 memset(&wrqu, 0, sizeof(wrqu)); 916 memset(&wrqu, 0, sizeof(wrqu));
917 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 917 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
918 memcpy(wrqu.ap_addr.sa_data, bss->bssid, ETH_ALEN); 918 memcpy(wrqu.ap_addr.sa_data, info->bss->bssid, ETH_ALEN);
919 memcpy(wdev->wext.prev_bssid, bss->bssid, ETH_ALEN); 919 memcpy(wdev->wext.prev_bssid, info->bss->bssid, ETH_ALEN);
920 wdev->wext.prev_bssid_valid = true; 920 wdev->wext.prev_bssid_valid = true;
921 wireless_send_event(wdev->netdev, SIOCGIWAP, &wrqu, NULL); 921 wireless_send_event(wdev->netdev, SIOCGIWAP, &wrqu, NULL);
922#endif 922#endif
923 923
924 return; 924 return;
925out: 925out:
926 cfg80211_put_bss(wdev->wiphy, bss); 926 cfg80211_put_bss(wdev->wiphy, info->bss);
927}
928
929void cfg80211_roamed(struct net_device *dev,
930 struct ieee80211_channel *channel,
931 const u8 *bssid,
932 const u8 *req_ie, size_t req_ie_len,
933 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp)
934{
935 struct wireless_dev *wdev = dev->ieee80211_ptr;
936 struct cfg80211_bss *bss;
937
938 bss = cfg80211_get_bss(wdev->wiphy, channel, bssid, wdev->ssid,
939 wdev->ssid_len,
940 wdev->conn_bss_type, IEEE80211_PRIVACY_ANY);
941 if (WARN_ON(!bss))
942 return;
943
944 cfg80211_roamed_bss(dev, bss, req_ie, req_ie_len, resp_ie,
945 resp_ie_len, gfp);
946} 927}
947EXPORT_SYMBOL(cfg80211_roamed);
948 928
949/* Consumes bss object one way or another */ 929/* Consumes info->bss object one way or another */
950void cfg80211_roamed_bss(struct net_device *dev, 930void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
951 struct cfg80211_bss *bss, const u8 *req_ie, 931 gfp_t gfp)
952 size_t req_ie_len, const u8 *resp_ie,
953 size_t resp_ie_len, gfp_t gfp)
954{ 932{
955 struct wireless_dev *wdev = dev->ieee80211_ptr; 933 struct wireless_dev *wdev = dev->ieee80211_ptr;
956 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); 934 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
957 struct cfg80211_event *ev; 935 struct cfg80211_event *ev;
958 unsigned long flags; 936 unsigned long flags;
959 937
960 if (WARN_ON(!bss)) 938 if (!info->bss) {
939 info->bss = cfg80211_get_bss(wdev->wiphy, info->channel,
940 info->bssid, wdev->ssid,
941 wdev->ssid_len,
942 wdev->conn_bss_type,
943 IEEE80211_PRIVACY_ANY);
944 }
945
946 if (WARN_ON(!info->bss))
961 return; 947 return;
962 948
963 ev = kzalloc(sizeof(*ev) + req_ie_len + resp_ie_len, gfp); 949 ev = kzalloc(sizeof(*ev) + info->req_ie_len + info->resp_ie_len, gfp);
964 if (!ev) { 950 if (!ev) {
965 cfg80211_put_bss(wdev->wiphy, bss); 951 cfg80211_put_bss(wdev->wiphy, info->bss);
966 return; 952 return;
967 } 953 }
968 954
969 ev->type = EVENT_ROAMED; 955 ev->type = EVENT_ROAMED;
970 ev->rm.req_ie = ((u8 *)ev) + sizeof(*ev); 956 ev->rm.req_ie = ((u8 *)ev) + sizeof(*ev);
971 ev->rm.req_ie_len = req_ie_len; 957 ev->rm.req_ie_len = info->req_ie_len;
972 memcpy((void *)ev->rm.req_ie, req_ie, req_ie_len); 958 memcpy((void *)ev->rm.req_ie, info->req_ie, info->req_ie_len);
973 ev->rm.resp_ie = ((u8 *)ev) + sizeof(*ev) + req_ie_len; 959 ev->rm.resp_ie = ((u8 *)ev) + sizeof(*ev) + info->req_ie_len;
974 ev->rm.resp_ie_len = resp_ie_len; 960 ev->rm.resp_ie_len = info->resp_ie_len;
975 memcpy((void *)ev->rm.resp_ie, resp_ie, resp_ie_len); 961 memcpy((void *)ev->rm.resp_ie, info->resp_ie, info->resp_ie_len);
976 ev->rm.bss = bss; 962 ev->rm.bss = info->bss;
977 963
978 spin_lock_irqsave(&wdev->event_lock, flags); 964 spin_lock_irqsave(&wdev->event_lock, flags);
979 list_add_tail(&ev->list, &wdev->event_list); 965 list_add_tail(&ev->list, &wdev->event_list);
980 spin_unlock_irqrestore(&wdev->event_lock, flags); 966 spin_unlock_irqrestore(&wdev->event_lock, flags);
981 queue_work(cfg80211_wq, &rdev->event_work); 967 queue_work(cfg80211_wq, &rdev->event_work);
982} 968}
983EXPORT_SYMBOL(cfg80211_roamed_bss); 969EXPORT_SYMBOL(cfg80211_roamed);
984 970
985void __cfg80211_disconnected(struct net_device *dev, const u8 *ie, 971void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
986 size_t ie_len, u16 reason, bool from_ap) 972 size_t ie_len, u16 reason, bool from_ap)
diff --git a/net/wireless/util.c b/net/wireless/util.c
index a46bc42d0910..7198373e2920 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -946,9 +946,7 @@ void cfg80211_process_wdev_events(struct wireless_dev *wdev)
946 ev->cr.status == WLAN_STATUS_SUCCESS); 946 ev->cr.status == WLAN_STATUS_SUCCESS);
947 break; 947 break;
948 case EVENT_ROAMED: 948 case EVENT_ROAMED:
949 __cfg80211_roamed(wdev, ev->rm.bss, ev->rm.req_ie, 949 __cfg80211_roamed(wdev, &ev->rm);
950 ev->rm.req_ie_len, ev->rm.resp_ie,
951 ev->rm.resp_ie_len);
952 break; 950 break;
953 case EVENT_DISCONNECTED: 951 case EVENT_DISCONNECTED:
954 __cfg80211_disconnected(wdev->netdev, 952 __cfg80211_disconnected(wdev->netdev,