Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278884
b: refs/heads/master
c: adbde34
h: refs/heads/master
v: v3
  • Loading branch information
Vasanthakumar Thiagarajan authored and John W. Linville committed Dec 13, 2011
1 parent 0fb7f84 commit 0088ece
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fb03c5eb8c0bbf4561cb5aa72e0a9546e9574661
refs/heads/master: adbde344dc12514d68620afae8d34035e72544b1
26 changes: 26 additions & 0 deletions trunk/include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -3063,6 +3063,32 @@ void cfg80211_roamed(struct net_device *dev,
const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);

/**
* cfg80211_roamed_bss - notify cfg80211 of roaming
*
* @dev: network device
* @bss: entry of bss to which STA got roamed
* @req_ie: association request IEs (maybe be %NULL)
* @req_ie_len: association request IEs length
* @resp_ie: association response IEs (may be %NULL)
* @resp_ie_len: assoc response IEs length
* @gfp: allocation flags
*
* This is just a wrapper to notify cfg80211 of roaming event with driver
* passing bss to avoid a race in timeout of the bss entry. It should be
* called by the underlying driver whenever it roamed from one AP to another
* while connected. Drivers which have roaming implemented in firmware
* may use this function to avoid a race in bss entry timeout where the bss
* entry of the new AP is seen in the driver, but gets timed out by the time
* it is accessed in __cfg80211_roamed() due to delay in scheduling
* rdev->event_work. In case of any failures, the reference is released
* either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise,
* it will be released while diconneting from the current bss.
*/
void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);

/**
* cfg80211_disconnected - notify cfg80211 that connection was dropped
*
Expand Down
6 changes: 2 additions & 4 deletions trunk/net/wireless/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,11 @@ struct cfg80211_event {
u16 status;
} cr;
struct {
struct ieee80211_channel *channel;
u8 bssid[ETH_ALEN];
const u8 *req_ie;
const u8 *resp_ie;
size_t req_ie_len;
size_t resp_ie_len;
struct cfg80211_bss *bss;
} rm;
struct {
const u8 *ie;
Expand Down Expand Up @@ -403,8 +402,7 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
struct net_device *dev, u16 reason,
bool wextev);
void __cfg80211_roamed(struct wireless_dev *wdev,
struct ieee80211_channel *channel,
const u8 *bssid,
struct cfg80211_bss *bss,
const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len);
int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
Expand Down
61 changes: 40 additions & 21 deletions trunk/net/wireless/sme.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,45 +553,35 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
EXPORT_SYMBOL(cfg80211_connect_result);

void __cfg80211_roamed(struct wireless_dev *wdev,
struct ieee80211_channel *channel,
const u8 *bssid,
struct cfg80211_bss *bss,
const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len)
{
struct cfg80211_bss *bss;
#ifdef CONFIG_CFG80211_WEXT
union iwreq_data wrqu;
#endif

ASSERT_WDEV_LOCK(wdev);

if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION &&
wdev->iftype != NL80211_IFTYPE_P2P_CLIENT))
return;
goto out;

if (wdev->sme_state != CFG80211_SME_CONNECTED)
return;
goto out;

/* internal error -- how did we get to CONNECTED w/o BSS? */
if (WARN_ON(!wdev->current_bss)) {
return;
goto out;
}

cfg80211_unhold_bss(wdev->current_bss);
cfg80211_put_bss(&wdev->current_bss->pub);
wdev->current_bss = NULL;

bss = cfg80211_get_bss(wdev->wiphy, channel, bssid,
wdev->ssid, wdev->ssid_len,
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);

if (WARN_ON(!bss))
return;

cfg80211_hold_bss(bss_from_pub(bss));
wdev->current_bss = bss_from_pub(bss);

nl80211_send_roamed(wiphy_to_dev(wdev->wiphy), wdev->netdev, bssid,
nl80211_send_roamed(wiphy_to_dev(wdev->wiphy), wdev->netdev, bss->bssid,
req_ie, req_ie_len, resp_ie, resp_ie_len,
GFP_KERNEL);

Expand All @@ -612,18 +602,43 @@ void __cfg80211_roamed(struct wireless_dev *wdev,

memset(&wrqu, 0, sizeof(wrqu));
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
memcpy(wrqu.ap_addr.sa_data, bssid, ETH_ALEN);
memcpy(wdev->wext.prev_bssid, bssid, ETH_ALEN);
memcpy(wrqu.ap_addr.sa_data, bss->bssid, ETH_ALEN);
memcpy(wdev->wext.prev_bssid, bss->bssid, ETH_ALEN);
wdev->wext.prev_bssid_valid = true;
wireless_send_event(wdev->netdev, SIOCGIWAP, &wrqu, NULL);
#endif

return;
out:
cfg80211_put_bss(bss);
}

void cfg80211_roamed(struct net_device *dev,
struct ieee80211_channel *channel,
const u8 *bssid,
const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_bss *bss;

CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTED);

bss = cfg80211_get_bss(wdev->wiphy, channel, bssid, wdev->ssid,
wdev->ssid_len, WLAN_CAPABILITY_ESS,
WLAN_CAPABILITY_ESS);
if (WARN_ON(!bss))
return;

cfg80211_roamed_bss(dev, bss, req_ie, req_ie_len, resp_ie,
resp_ie_len, gfp);
}
EXPORT_SYMBOL(cfg80211_roamed);

void cfg80211_roamed_bss(struct net_device *dev,
struct cfg80211_bss *bss, const u8 *req_ie,
size_t req_ie_len, const u8 *resp_ie,
size_t resp_ie_len, gfp_t gfp)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
Expand All @@ -632,26 +647,30 @@ void cfg80211_roamed(struct net_device *dev,

CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTED);

if (WARN_ON(!bss))
return;

ev = kzalloc(sizeof(*ev) + req_ie_len + resp_ie_len, gfp);
if (!ev)
if (!ev) {
cfg80211_put_bss(bss);
return;
}

ev->type = EVENT_ROAMED;
ev->rm.channel = channel;
memcpy(ev->rm.bssid, bssid, ETH_ALEN);
ev->rm.req_ie = ((u8 *)ev) + sizeof(*ev);
ev->rm.req_ie_len = req_ie_len;
memcpy((void *)ev->rm.req_ie, req_ie, req_ie_len);
ev->rm.resp_ie = ((u8 *)ev) + sizeof(*ev) + req_ie_len;
ev->rm.resp_ie_len = resp_ie_len;
memcpy((void *)ev->rm.resp_ie, resp_ie, resp_ie_len);
ev->rm.bss = bss;

spin_lock_irqsave(&wdev->event_lock, flags);
list_add_tail(&ev->list, &wdev->event_list);
spin_unlock_irqrestore(&wdev->event_lock, flags);
queue_work(cfg80211_wq, &rdev->event_work);
}
EXPORT_SYMBOL(cfg80211_roamed);
EXPORT_SYMBOL(cfg80211_roamed_bss);

void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
size_t ie_len, u16 reason, bool from_ap)
Expand Down
6 changes: 3 additions & 3 deletions trunk/net/wireless/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,9 +740,9 @@ static void cfg80211_process_wdev_events(struct wireless_dev *wdev)
NULL);
break;
case EVENT_ROAMED:
__cfg80211_roamed(wdev, ev->rm.channel, ev->rm.bssid,
ev->rm.req_ie, ev->rm.req_ie_len,
ev->rm.resp_ie, ev->rm.resp_ie_len);
__cfg80211_roamed(wdev, ev->rm.bss, ev->rm.req_ie,
ev->rm.req_ie_len, ev->rm.resp_ie,
ev->rm.resp_ie_len);
break;
case EVENT_DISCONNECTED:
__cfg80211_disconnected(wdev->netdev,
Expand Down

0 comments on commit 0088ece

Please sign in to comment.