From: Johannes Berg Date: Tue, 10 Feb 2009 20:25:58 +0000 (+0100) Subject: cfg80211: allow users to request removing a BSS X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d491af19db3adcc1eb1653e60a427fb4df36f361;p=mv-sheeva.git 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 Signed-off-by: John W. Linville --- diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index b514abcc2b9..f1d21570e6c 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -791,5 +791,16 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, const u8 *meshid, size_t meshidlen, const u8 *meshcfg); void cfg80211_put_bss(struct cfg80211_bss *bss); +/** + * cfg80211_unlink_bss - unlink BSS from internal data structures + * @wiphy: the wiphy + * @bss: the bss to remove + * + * This function removes the given BSS from the internal data structures + * thereby making it no longer show up in scan results etc. Use this + * function when you detect a BSS is gone. Normally BSSes will also time + * out, so it is not necessary to use this function at all. + */ +void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); #endif /* __NET_CFG80211_H */ diff --git a/net/wireless/scan.c b/net/wireless/scan.c index ec148f68a62..aacccc9ab6c 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -432,6 +432,27 @@ void cfg80211_put_bss(struct cfg80211_bss *pub) } EXPORT_SYMBOL(cfg80211_put_bss); +void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) +{ + struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); + struct cfg80211_internal_bss *bss; + + if (WARN_ON(!pub)) + return; + + bss = container_of(pub, struct cfg80211_internal_bss, pub); + + spin_lock_bh(&dev->bss_lock); + + list_del(&bss->list); + rb_erase(&bss->rbn, &dev->bss_tree); + + spin_unlock_bh(&dev->bss_lock); + + kref_put(&bss->ref, bss_release); +} +EXPORT_SYMBOL(cfg80211_unlink_bss); + #ifdef CONFIG_WIRELESS_EXT int cfg80211_wext_siwscan(struct net_device *dev, struct iw_request_info *info,