forked from Minki/linux
mac80211: add ieee80211_sdata_running
Instead of always using netif_running(sdata->dev) use ieee80211_sdata_running(sdata) now which is just an inline containing netif_running() for now. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
d30506e035
commit
9607e6b66a
@ -78,17 +78,15 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
|
||||
enum nl80211_iftype type, u32 *flags,
|
||||
struct vif_params *params)
|
||||
{
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||
int ret;
|
||||
|
||||
if (netif_running(dev))
|
||||
if (ieee80211_sdata_running(sdata))
|
||||
return -EBUSY;
|
||||
|
||||
if (!nl80211_params_check(type, params))
|
||||
return -EINVAL;
|
||||
|
||||
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||
|
||||
ret = ieee80211_if_change_type(sdata, type);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -744,7 +744,7 @@ static void ieee80211_ibss_work(struct work_struct *work)
|
||||
if (WARN_ON(local->suspended))
|
||||
return;
|
||||
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
return;
|
||||
|
||||
if (local->scanning)
|
||||
@ -827,7 +827,7 @@ void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local)
|
||||
|
||||
mutex_lock(&local->iflist_mtx);
|
||||
list_for_each_entry(sdata, &local->interfaces, list) {
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
|
||||
continue;
|
||||
|
@ -960,6 +960,11 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local);
|
||||
u32 __ieee80211_recalc_idle(struct ieee80211_local *local);
|
||||
void ieee80211_recalc_idle(struct ieee80211_local *local);
|
||||
|
||||
static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
|
||||
{
|
||||
return netif_running(sdata->dev);
|
||||
}
|
||||
|
||||
/* tx handling */
|
||||
void ieee80211_clear_tx_pending(struct ieee80211_local *local);
|
||||
void ieee80211_tx_pending(unsigned long data);
|
||||
|
@ -65,7 +65,7 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr)
|
||||
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||
int ret;
|
||||
|
||||
if (netif_running(dev))
|
||||
if (ieee80211_sdata_running(sdata))
|
||||
return -EBUSY;
|
||||
|
||||
ret = eth_mac_addr(dev, addr);
|
||||
@ -111,7 +111,7 @@ static int ieee80211_open(struct net_device *dev)
|
||||
list_for_each_entry(nsdata, &local->interfaces, list) {
|
||||
struct net_device *ndev = nsdata->dev;
|
||||
|
||||
if (ndev != dev && netif_running(ndev)) {
|
||||
if (ndev != dev && ieee80211_sdata_running(nsdata)) {
|
||||
/*
|
||||
* Allow only a single IBSS interface to be up at any
|
||||
* time. This is restricted because beacon distribution
|
||||
@ -197,7 +197,7 @@ static int ieee80211_open(struct net_device *dev)
|
||||
struct net_device *ndev = nsdata->dev;
|
||||
|
||||
/*
|
||||
* No need to check netif_running since we do not allow
|
||||
* No need to check running since we do not allow
|
||||
* it to start up with this invalid address.
|
||||
*/
|
||||
if (compare_ether_addr(null_addr, ndev->dev_addr) == 0) {
|
||||
@ -756,7 +756,7 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
|
||||
* and goes into the requested mode.
|
||||
*/
|
||||
|
||||
if (netif_running(sdata->dev))
|
||||
if (ieee80211_sdata_running(sdata))
|
||||
return -EBUSY;
|
||||
|
||||
/* Purge and reset type-dependent state. */
|
||||
@ -930,7 +930,7 @@ u32 __ieee80211_recalc_idle(struct ieee80211_local *local)
|
||||
return ieee80211_idle_off(local, "scanning");
|
||||
|
||||
list_for_each_entry(sdata, &local->interfaces, list) {
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
/* do not count disabled managed interfaces */
|
||||
if (sdata->vif.type == NL80211_IFTYPE_STATION &&
|
||||
|
@ -443,7 +443,7 @@ void ieee80211_key_link(struct ieee80211_key *key,
|
||||
add_todo(old_key, KEY_FLAG_TODO_DELETE);
|
||||
|
||||
add_todo(key, KEY_FLAG_TODO_ADD_DEBUGFS);
|
||||
if (netif_running(sdata->dev))
|
||||
if (ieee80211_sdata_running(sdata))
|
||||
add_todo(key, KEY_FLAG_TODO_HWACCEL_ADD);
|
||||
|
||||
spin_unlock_irqrestore(&sdata->local->key_lock, flags);
|
||||
@ -509,7 +509,7 @@ void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata)
|
||||
{
|
||||
ASSERT_RTNL();
|
||||
|
||||
if (WARN_ON(!netif_running(sdata->dev)))
|
||||
if (WARN_ON(!ieee80211_sdata_running(sdata)))
|
||||
return;
|
||||
|
||||
ieee80211_todo_for_each_key(sdata, KEY_FLAG_TODO_HWACCEL_ADD);
|
||||
|
@ -212,7 +212,7 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
|
||||
}
|
||||
|
||||
if (changed & BSS_CHANGED_BEACON_ENABLED) {
|
||||
if (local->quiescing || !netif_running(sdata->dev) ||
|
||||
if (local->quiescing || !ieee80211_sdata_running(sdata) ||
|
||||
test_bit(SCAN_SW_SCANNING, &local->scanning)) {
|
||||
sdata->vif.bss_conf.enable_beacon = false;
|
||||
} else {
|
||||
|
@ -645,7 +645,7 @@ static void ieee80211_mesh_work(struct work_struct *work)
|
||||
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
|
||||
struct sk_buff *skb;
|
||||
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
return;
|
||||
|
||||
if (local->scanning)
|
||||
|
@ -604,7 +604,7 @@ static void ieee80211_chswitch_work(struct work_struct *work)
|
||||
container_of(work, struct ieee80211_sub_if_data, u.mgd.chswitch_work);
|
||||
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
|
||||
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
return;
|
||||
|
||||
mutex_lock(&ifmgd->mtx);
|
||||
@ -750,7 +750,7 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
|
||||
}
|
||||
|
||||
list_for_each_entry(sdata, &local->interfaces, list) {
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
if (sdata->vif.type != NL80211_IFTYPE_STATION)
|
||||
continue;
|
||||
@ -1263,7 +1263,7 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
|
||||
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
|
||||
bool already = false;
|
||||
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
return;
|
||||
|
||||
if (sdata->local->scanning)
|
||||
@ -2118,7 +2118,7 @@ static void ieee80211_sta_work(struct work_struct *work)
|
||||
enum rx_mgmt_action rma;
|
||||
bool anybusy = false;
|
||||
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
return;
|
||||
|
||||
if (local->scanning)
|
||||
|
@ -93,7 +93,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
|
||||
/* disable beaconing */
|
||||
|
@ -289,7 +289,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
|
||||
if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES)
|
||||
continue;
|
||||
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
|
||||
if (prev_dev) {
|
||||
@ -2056,7 +2056,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
|
||||
skb->protocol = htons(ETH_P_802_2);
|
||||
|
||||
list_for_each_entry_rcu(sdata, &local->interfaces, list) {
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
|
||||
if (sdata->vif.type != NL80211_IFTYPE_MONITOR ||
|
||||
@ -2318,7 +2318,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
|
||||
}
|
||||
if (!found_sta) {
|
||||
list_for_each_entry_rcu(sdata, &local->interfaces, list) {
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
|
||||
if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
|
||||
|
@ -346,7 +346,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
|
||||
|
||||
mutex_lock(&local->iflist_mtx);
|
||||
list_for_each_entry(sdata, &local->interfaces, list) {
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
|
||||
/* Tell AP we're back */
|
||||
@ -396,7 +396,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)
|
||||
|
||||
mutex_lock(&local->iflist_mtx);
|
||||
list_for_each_entry(sdata, &local->interfaces, list) {
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
|
||||
/* disable beaconing */
|
||||
@ -526,7 +526,7 @@ static int ieee80211_scan_state_decision(struct ieee80211_local *local,
|
||||
/* check if at least one STA interface is associated */
|
||||
mutex_lock(&local->iflist_mtx);
|
||||
list_for_each_entry(sdata, &local->interfaces, list) {
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
|
||||
if (sdata->vif.type == NL80211_IFTYPE_STATION) {
|
||||
@ -571,7 +571,7 @@ static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *loca
|
||||
*/
|
||||
mutex_lock(&local->iflist_mtx);
|
||||
list_for_each_entry(sdata, &local->interfaces, list) {
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
|
||||
if (sdata->vif.type == NL80211_IFTYPE_STATION) {
|
||||
@ -603,7 +603,7 @@ static void ieee80211_scan_state_enter_oper_channel(struct ieee80211_local *loca
|
||||
*/
|
||||
mutex_lock(&local->iflist_mtx);
|
||||
list_for_each_entry(sdata, &local->interfaces, list) {
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
|
||||
/* Tell AP we're back */
|
||||
@ -727,7 +727,7 @@ void ieee80211_scan_work(struct work_struct *work)
|
||||
/*
|
||||
* Avoid re-scheduling when the sdata is going away.
|
||||
*/
|
||||
if (!netif_running(sdata->dev)) {
|
||||
if (!ieee80211_sdata_running(sdata)) {
|
||||
ieee80211_scan_completed(&local->hw, true);
|
||||
return;
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ int sta_info_insert(struct sta_info *sta)
|
||||
* something inserts a STA (on one CPU) without holding the RTNL
|
||||
* and another CPU turns off the net device.
|
||||
*/
|
||||
if (unlikely(!netif_running(sdata->dev))) {
|
||||
if (unlikely(!ieee80211_sdata_running(sdata))) {
|
||||
err = -ENETDOWN;
|
||||
goto out_free;
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
|
||||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(sdata, &local->interfaces, list) {
|
||||
if (sdata->vif.type == NL80211_IFTYPE_MONITOR) {
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
|
||||
if ((sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) &&
|
||||
|
@ -1469,7 +1469,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
|
||||
|
||||
list_for_each_entry_rcu(tmp_sdata, &local->interfaces,
|
||||
list) {
|
||||
if (!netif_running(tmp_sdata->dev))
|
||||
if (!ieee80211_sdata_running(tmp_sdata))
|
||||
continue;
|
||||
if (tmp_sdata->vif.type != NL80211_IFTYPE_AP)
|
||||
continue;
|
||||
|
@ -468,7 +468,7 @@ void ieee80211_iterate_active_interfaces(
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
break;
|
||||
}
|
||||
if (netif_running(sdata->dev))
|
||||
if (ieee80211_sdata_running(sdata))
|
||||
iterator(data, sdata->vif.addr,
|
||||
&sdata->vif);
|
||||
}
|
||||
@ -502,7 +502,7 @@ void ieee80211_iterate_active_interfaces_atomic(
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
break;
|
||||
}
|
||||
if (netif_running(sdata->dev))
|
||||
if (ieee80211_sdata_running(sdata))
|
||||
iterator(data, sdata->vif.addr,
|
||||
&sdata->vif);
|
||||
}
|
||||
@ -1056,7 +1056,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
|
||||
list_for_each_entry(sdata, &local->interfaces, list) {
|
||||
if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
|
||||
sdata->vif.type != NL80211_IFTYPE_MONITOR &&
|
||||
netif_running(sdata->dev)) {
|
||||
ieee80211_sdata_running(sdata)) {
|
||||
conf.vif = &sdata->vif;
|
||||
conf.type = sdata->vif.type;
|
||||
conf.mac_addr = sdata->vif.addr;
|
||||
@ -1103,7 +1103,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
|
||||
/* Finally also reconfigure all the BSS information */
|
||||
list_for_each_entry(sdata, &local->interfaces, list) {
|
||||
u32 changed = ~0;
|
||||
if (!netif_running(sdata->dev))
|
||||
if (!ieee80211_sdata_running(sdata))
|
||||
continue;
|
||||
switch (sdata->vif.type) {
|
||||
case NL80211_IFTYPE_STATION:
|
||||
@ -1131,7 +1131,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
|
||||
|
||||
/* add back keys */
|
||||
list_for_each_entry(sdata, &local->interfaces, list)
|
||||
if (netif_running(sdata->dev))
|
||||
if (ieee80211_sdata_running(sdata))
|
||||
ieee80211_enable_keys(sdata);
|
||||
|
||||
ieee80211_wake_queues_by_reason(hw,
|
||||
|
Loading…
Reference in New Issue
Block a user