diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-02-10 15:25:58 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-13 13:45:54 -0500 |
commit | d491af19db3adcc1eb1653e60a427fb4df36f361 (patch) | |
tree | 7116bcc9f6de56d181d16463252c4aabab77b20e | |
parent | 78c1c7e109f1f14e7c18f290c4ebc58da220c7ba (diff) |
cfg80211: allow users to request removing a BSS
This patch introduces cfg80211_unlink_bss, a function to
allow a driver to remove a BSS from the internal list and
make it not show up in scan results any more -- this is
to be used when the driver detects that the BSS is no
longer available.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/net/cfg80211.h | 11 | ||||
-rw-r--r-- | net/wireless/scan.c | 21 |
2 files changed, 32 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index b514abcc2b93..f1d21570e6cb 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -791,5 +791,16 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, | |||
791 | const u8 *meshid, size_t meshidlen, | 791 | const u8 *meshid, size_t meshidlen, |
792 | const u8 *meshcfg); | 792 | const u8 *meshcfg); |
793 | void cfg80211_put_bss(struct cfg80211_bss *bss); | 793 | void cfg80211_put_bss(struct cfg80211_bss *bss); |
794 | /** | ||
795 | * cfg80211_unlink_bss - unlink BSS from internal data structures | ||
796 | * @wiphy: the wiphy | ||
797 | * @bss: the bss to remove | ||
798 | * | ||
799 | * This function removes the given BSS from the internal data structures | ||
800 | * thereby making it no longer show up in scan results etc. Use this | ||
801 | * function when you detect a BSS is gone. Normally BSSes will also time | ||
802 | * out, so it is not necessary to use this function at all. | ||
803 | */ | ||
804 | void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); | ||
794 | 805 | ||
795 | #endif /* __NET_CFG80211_H */ | 806 | #endif /* __NET_CFG80211_H */ |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index ec148f68a62b..aacccc9ab6ca 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -432,6 +432,27 @@ void cfg80211_put_bss(struct cfg80211_bss *pub) | |||
432 | } | 432 | } |
433 | EXPORT_SYMBOL(cfg80211_put_bss); | 433 | EXPORT_SYMBOL(cfg80211_put_bss); |
434 | 434 | ||
435 | void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) | ||
436 | { | ||
437 | struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); | ||
438 | struct cfg80211_internal_bss *bss; | ||
439 | |||
440 | if (WARN_ON(!pub)) | ||
441 | return; | ||
442 | |||
443 | bss = container_of(pub, struct cfg80211_internal_bss, pub); | ||
444 | |||
445 | spin_lock_bh(&dev->bss_lock); | ||
446 | |||
447 | list_del(&bss->list); | ||
448 | rb_erase(&bss->rbn, &dev->bss_tree); | ||
449 | |||
450 | spin_unlock_bh(&dev->bss_lock); | ||
451 | |||
452 | kref_put(&bss->ref, bss_release); | ||
453 | } | ||
454 | EXPORT_SYMBOL(cfg80211_unlink_bss); | ||
455 | |||
435 | #ifdef CONFIG_WIRELESS_EXT | 456 | #ifdef CONFIG_WIRELESS_EXT |
436 | int cfg80211_wext_siwscan(struct net_device *dev, | 457 | int cfg80211_wext_siwscan(struct net_device *dev, |
437 | struct iw_request_info *info, | 458 | struct iw_request_info *info, |