mac80211: add ieee80211_sdata_running
authorJohannes Berg <johannes@sipsolutions.net>
Wed, 23 Dec 2009 12:15:31 +0000 (13:15 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 28 Dec 2009 21:54:49 +0000 (16:54 -0500)
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>
15 files changed:
net/mac80211/cfg.c
net/mac80211/ibss.c
net/mac80211/ieee80211_i.h
net/mac80211/iface.c
net/mac80211/key.c
net/mac80211/main.c
net/mac80211/mesh.c
net/mac80211/mlme.c
net/mac80211/pm.c
net/mac80211/rx.c
net/mac80211/scan.c
net/mac80211/sta_info.c
net/mac80211/status.c
net/mac80211/tx.c
net/mac80211/util.c

index 63843e3e576a2164dc2d768f82b442448aa3ee3d..fdac1bcbfcc0607b95fafd84f9dfc27376e14b2a 100644 (file)
@@ -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;
index ef6c6b2401d1d25d0bb2be1f268231bd880734d6..3a61f3ba85c90dc6333cf80fe359b36d44e916f5 100644 (file)
@@ -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;
index 88b0ba6c74842b0120d27eda7c31efa1e8441542..adeae03c26a30c3e1efdbe4eb1c5a96a50ae7134 100644 (file)
@@ -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);
index a6e6da3cab70c27abdd039168c4148086988879b..1ceca14331d46277e36eb1e7e3b8c8dedeab9dd1 100644 (file)
@@ -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 &&
index 32ee6d0ee34d71b37f87a5a6d4abf097a52f35d3..8160d9c5372ea09e8fbc6c01b54c3e00703d3188 100644 (file)
@@ -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);
index d4426748ab10c857a3b690f0953b413360f33609..e93bc558d785a5d2bb65a0e2cc632697a4fea1d7 100644 (file)
@@ -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 {
index e0bd85e3d4b64f3137ba58fa8026bda7c023625a..61080c5fad50f2ef859ac6461d6168d69cddaaa6 100644 (file)
@@ -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)
index 2f9ed8b9c3f00bd7c6522151bd69e806e3448658..7f9909340c09fa78e1336d5a9b4b3b8d76f0ca4a 100644 (file)
@@ -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)
index 05e161c3cbc548bba9942a8221e60a73fb5dc1b7..913dc7e3b29e74f4e7979629478ae9678c5664a1 100644 (file)
@@ -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 */
index 6cbf1a7b3157467785581ad3814ef4f738c3391b..f60dfca52196a651aec5a6bbc1c6516d843a69a1 100644 (file)
@@ -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 ||
index 66da0ab1d8faceafd8affb9303269e03b2c51134..ae1830056521443bdf6672b7ddefb94b6043cf9f 100644 (file)
@@ -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;
        }
index d1a77e79d7a982789b138b705f7a6fcd5f3ef8e2..f039e761aec11c2d2431f23fe5c74edb7d277cdd 100644 (file)
@@ -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;
        }
index 0c0850d37ddacfb617177e3256d50b6fa4e0758f..0ebcdda2420028819c0ed4f90e299d9f28f39f53 100644 (file)
@@ -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) &&
index ac48c86ae6b367ea57d0e9e58b6577d827ec8c81..1593a2ffd67aeb031750068e920e2ec52564cc15 100644 (file)
@@ -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;
index b01972579c7c09c168dfdc250aef82aacd1090ed..5ffe9e831b66cb58fec48cf772804453df188185 100644 (file)
@@ -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,