mac80211: revamp beacon configuration

This patch changes mac80211's beacon configuration handling
to never pass skbs to the driver directly but rather always
require the driver to use ieee80211_beacon_get(). Additionally,
it introduces "change flags" on the config_interface() call
to enable drivers to figure out what is changing. Finally, it
removes the beacon_update() driver callback in favour of
having IBSS beacon delivered by ieee80211_beacon_get() as well.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Johannes Berg
2008-07-09 14:40:37 +02:00
committed by John W. Linville
parent f3947e2dfa
commit 9d139c810a
21 changed files with 228 additions and 250 deletions

View File

@@ -348,6 +348,7 @@ int rt2x00mac_config_interface(struct ieee80211_hw *hw,
{
struct rt2x00_dev *rt2x00dev = hw->priv;
struct rt2x00_intf *intf = vif_to_intf(vif);
struct sk_buff *beacon;
int status;
/*
@@ -363,8 +364,11 @@ int rt2x00mac_config_interface(struct ieee80211_hw *hw,
* If the interface does not work in master mode,
* then the bssid value in the interface structure
* should now be set.
*
* conf->bssid can be NULL if coming from the internal
* beacon update routine.
*/
if (conf->type != IEEE80211_IF_TYPE_AP)
if (conf->bssid && vif->type != IEEE80211_IF_TYPE_AP)
memcpy(&intf->bssid, conf->bssid, ETH_ALEN);
spin_unlock(&intf->lock);
@@ -375,17 +379,23 @@ int rt2x00mac_config_interface(struct ieee80211_hw *hw,
* values as arguments we make keep access to rt2x00_intf thread safe
* even without the lock.
*/
rt2x00lib_config_intf(rt2x00dev, intf, conf->type, NULL, conf->bssid);
rt2x00lib_config_intf(rt2x00dev, intf, vif->type, NULL, conf->bssid);
/*
* We only need to initialize the beacon when master mode is enabled.
* We only need to initialize the beacon when in master/ibss mode.
*/
if (conf->type != IEEE80211_IF_TYPE_AP || !conf->beacon)
if ((vif->type != IEEE80211_IF_TYPE_AP &&
vif->type != IEEE80211_IF_TYPE_IBSS) ||
!(conf->changed & IEEE80211_IFCC_BEACON))
return 0;
status = rt2x00dev->ops->hw->beacon_update(rt2x00dev->hw, conf->beacon);
beacon = ieee80211_beacon_get(rt2x00dev->hw, vif);
if (!beacon)
return -ENOMEM;
status = rt2x00dev->ops->lib->beacon_update(rt2x00dev->hw, beacon);
if (status)
dev_kfree_skb(conf->beacon);
dev_kfree_skb(beacon);
return status;
}