]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/mac80211/mesh_plink.c
sdio_uart: Fix SDIO break control to now return success or an error
[linux-2.6-omap-h63xx.git] / net / mac80211 / mesh_plink.c
index 5cd97e99be6292f60f72851b2c031e10432a3155..37f0c2b94ae7a7524b28dff277fc8fc2c98b5b5b 100644 (file)
@@ -6,11 +6,11 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/kernel.h>
+#include <linux/random.h>
 #include "ieee80211_i.h"
-#include "ieee80211_rate.h"
+#include "rate.h"
 #include "mesh.h"
-#include <linux/random.h>
 
 #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
 #define mpl_dbg(fmt, args...)  printk(KERN_DEBUG fmt, ##args)
@@ -18,7 +18,6 @@
 #define mpl_dbg(fmt, args...)  do { (void)(0); } while (0)
 #endif
 
-#define IEEE80211_FC(type, stype) cpu_to_le16(type | stype)
 #define PLINK_GET_FRAME_SUBTYPE(p) (p)
 #define PLINK_GET_LLID(p) (p + 1)
 #define PLINK_GET_PLID(p) (p + 3)
@@ -65,14 +64,14 @@ static inline
 void mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata)
 {
        atomic_inc(&sdata->u.sta.mshstats.estab_plinks);
-       mesh_accept_plinks_update(sdata->dev);
+       mesh_accept_plinks_update(sdata);
 }
 
 static inline
 void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata)
 {
        atomic_dec(&sdata->u.sta.mshstats.estab_plinks);
-       mesh_accept_plinks_update(sdata->dev);
+       mesh_accept_plinks_update(sdata);
 }
 
 /**
@@ -84,48 +83,30 @@ void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata)
  */
 static inline void mesh_plink_fsm_restart(struct sta_info *sta)
 {
-       sta->plink_state = LISTEN;
-       sta->llid = sta->plid = sta->reason = sta->plink_retries = 0;
+       sta->plink_state = PLINK_LISTEN;
+       sta->llid = sta->plid = sta->reason = 0;
+       sta->plink_retries = 0;
 }
 
-/**
- * mesh_plink_add - allocate and add a new mesh peer link
- *
- * @hw_addr: hardware address (ETH_ALEN length)
- * @rates: rates the mesh peer supports
- * @dev: local mesh interface
- *
- * The initial state of the new plink is set to LISTEN
- *
- * Returns: non-NULL on success, ERR_PTR() on error.
+/*
+ * NOTE: This is just an alias for sta_info_alloc(), see notes
+ *       on it in the lifecycle management section!
  */
-struct sta_info *mesh_plink_add(u8 *hw_addr, u64 rates, struct net_device *dev)
+static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata,
+                                        u8 *hw_addr, u64 rates)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_local *local = sdata->local;
        struct sta_info *sta;
 
-       if (memcmp(hw_addr, dev->dev_addr, ETH_ALEN) == 0)
-               /* never add ourselves as neighbours */
-               return ERR_PTR(-EINVAL);
-
-       if (is_multicast_ether_addr(hw_addr))
-               return ERR_PTR(-EINVAL);
-
        if (local->num_sta >= MESH_MAX_PLINKS)
-               return ERR_PTR(-ENOSPC);
+               return NULL;
 
-       sta = sta_info_add(local, dev, hw_addr, GFP_KERNEL);
-       if (IS_ERR(sta))
-               return sta;
+       sta = sta_info_alloc(sdata, hw_addr, GFP_ATOMIC);
+       if (!sta)
+               return NULL;
 
-       sta->plink_state = LISTEN;
-       spin_lock_init(&sta->plink_lock);
-       init_timer(&sta->plink_timer);
        sta->flags |= WLAN_STA_AUTHORIZED;
        sta->supp_rates[local->hw.conf.channel->band] = rates;
-       rate_control_rate_init(sta, local);
-
-       mesh_accept_plinks_update(dev);
 
        return sta;
 }
@@ -139,15 +120,30 @@ struct sta_info *mesh_plink_add(u8 *hw_addr, u64 rates, struct net_device *dev)
  *
  * Locking: the caller must hold sta->plink_lock
  */
-void mesh_plink_deactivate(struct sta_info *sta)
+static void __mesh_plink_deactivate(struct sta_info *sta)
 {
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
-       if (sta->plink_state == ESTAB)
+       struct ieee80211_sub_if_data *sdata = sta->sdata;
+
+       if (sta->plink_state == PLINK_ESTAB)
                mesh_plink_dec_estab_count(sdata);
-       sta->plink_state = BLOCKED;
+       sta->plink_state = PLINK_BLOCKED;
        mesh_path_flush_by_nexthop(sta);
 }
 
+/**
+ * __mesh_plink_deactivate - deactivate mesh peer link
+ *
+ * @sta: mesh peer link to deactivate
+ *
+ * All mesh paths with this peer as next hop will be flushed
+ */
+void mesh_plink_deactivate(struct sta_info *sta)
+{
+       spin_lock_bh(&sta->plink_lock);
+       __mesh_plink_deactivate(sta);
+       spin_unlock_bh(&sta->plink_lock);
+}
+
 static int mesh_plink_frame_tx(struct net_device *dev,
                enum plink_frame_type action, u8 *da, __le16 llid, __le16 plid,
                __le16 reason) {
@@ -232,21 +228,29 @@ void mesh_neighbour_update(u8 *hw_addr, u64 rates, struct net_device *dev,
        struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
        struct sta_info *sta;
 
+       rcu_read_lock();
+
        sta = sta_info_get(local, hw_addr);
        if (!sta) {
-               sta = mesh_plink_add(hw_addr, rates, dev);
-               if (IS_ERR(sta))
+               sta = mesh_plink_alloc(sdata, hw_addr, rates);
+               if (!sta) {
+                       rcu_read_unlock();
+                       return;
+               }
+               if (sta_info_insert(sta)) {
+                       rcu_read_unlock();
                        return;
+               }
        }
 
        sta->last_rx = jiffies;
        sta->supp_rates[local->hw.conf.channel->band] = rates;
-       if (peer_accepting_plinks && sta->plink_state == LISTEN &&
+       if (peer_accepting_plinks && sta->plink_state == PLINK_LISTEN &&
                        sdata->u.sta.accepting_plinks &&
                        sdata->u.sta.mshcfg.auto_open_plinks)
                mesh_plink_open(sta);
 
-       sta_info_put(sta);
+       rcu_read_unlock();
 }
 
 static void mesh_plink_timer(unsigned long data)
@@ -259,6 +263,11 @@ static void mesh_plink_timer(unsigned long data)
        DECLARE_MAC_BUF(mac);
 #endif
 
+       /*
+        * This STA is valid because sta_info_destroy() will
+        * del_timer_sync() this timer after having made sure
+        * it cannot be readded (by deleting the plink.)
+        */
        sta = (struct sta_info *) data;
 
        spin_lock_bh(&sta->plink_lock);
@@ -272,12 +281,12 @@ static void mesh_plink_timer(unsigned long data)
        reason = 0;
        llid = sta->llid;
        plid = sta->plid;
-       dev = sta->dev;
-       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       sdata = sta->sdata;
+       dev = sdata->dev;
 
        switch (sta->plink_state) {
-       case OPN_RCVD:
-       case OPN_SNT:
+       case PLINK_OPN_RCVD:
+       case PLINK_OPN_SNT:
                /* retry timer */
                if (sta->plink_retries < dot11MeshMaxRetries(sdata)) {
                        u32 rand;
@@ -288,8 +297,7 @@ static void mesh_plink_timer(unsigned long data)
                        sta->plink_timeout = sta->plink_timeout +
                                             rand % sta->plink_timeout;
                        ++sta->plink_retries;
-                       if (!mod_plink_timer(sta, sta->plink_timeout))
-                               __sta_info_get(sta);
+                       mod_plink_timer(sta, sta->plink_timeout);
                        spin_unlock_bh(&sta->plink_lock);
                        mesh_plink_frame_tx(dev, PLINK_OPEN, sta->addr, llid,
                                            0, 0);
@@ -297,21 +305,19 @@ static void mesh_plink_timer(unsigned long data)
                }
                reason = cpu_to_le16(MESH_MAX_RETRIES);
                /* fall through on else */
-       case CNF_RCVD:
+       case PLINK_CNF_RCVD:
                /* confirm timer */
                if (!reason)
                        reason = cpu_to_le16(MESH_CONFIRM_TIMEOUT);
-               sta->plink_state = HOLDING;
-               if (!mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)))
-                       __sta_info_get(sta);
+               sta->plink_state = PLINK_HOLDING;
+               mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata));
                spin_unlock_bh(&sta->plink_lock);
                mesh_plink_frame_tx(dev, PLINK_CLOSE, sta->addr, llid, plid,
                                    reason);
                break;
-       case HOLDING:
+       case PLINK_HOLDING:
                /* holding timer */
-               if (del_timer(&sta->plink_timer))
-                       sta_info_put(sta);
+               del_timer(&sta->plink_timer);
                mesh_plink_fsm_restart(sta);
                spin_unlock_bh(&sta->plink_lock);
                break;
@@ -319,8 +325,6 @@ static void mesh_plink_timer(unsigned long data)
                spin_unlock_bh(&sta->plink_lock);
                break;
        }
-
-       sta_info_put(sta);
 }
 
 static inline void mesh_plink_timer_set(struct sta_info *sta, int timeout)
@@ -329,14 +333,13 @@ static inline void mesh_plink_timer_set(struct sta_info *sta, int timeout)
        sta->plink_timer.data = (unsigned long) sta;
        sta->plink_timer.function = mesh_plink_timer;
        sta->plink_timeout = timeout;
-       __sta_info_get(sta);
        add_timer(&sta->plink_timer);
 }
 
 int mesh_plink_open(struct sta_info *sta)
 {
        __le16 llid;
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
+       struct ieee80211_sub_if_data *sdata = sta->sdata;
 #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
        DECLARE_MAC_BUF(mac);
 #endif
@@ -344,18 +347,18 @@ int mesh_plink_open(struct sta_info *sta)
        spin_lock_bh(&sta->plink_lock);
        get_random_bytes(&llid, 2);
        sta->llid = llid;
-       if (sta->plink_state != LISTEN) {
+       if (sta->plink_state != PLINK_LISTEN) {
                spin_unlock_bh(&sta->plink_lock);
-               sta_info_put(sta);
                return -EBUSY;
        }
-       sta->plink_state = OPN_SNT;
+       sta->plink_state = PLINK_OPN_SNT;
        mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata));
        spin_unlock_bh(&sta->plink_lock);
        mpl_dbg("Mesh plink: starting establishment with %s\n",
                print_mac(mac, sta->addr));
 
-       return mesh_plink_frame_tx(sta->dev, PLINK_OPEN, sta->addr, llid, 0, 0);
+       return mesh_plink_frame_tx(sdata->dev, PLINK_OPEN,
+                                  sta->addr, llid, 0, 0);
 }
 
 void mesh_plink_block(struct sta_info *sta)
@@ -365,15 +368,15 @@ void mesh_plink_block(struct sta_info *sta)
 #endif
 
        spin_lock_bh(&sta->plink_lock);
-       mesh_plink_deactivate(sta);
-       sta->plink_state = BLOCKED;
+       __mesh_plink_deactivate(sta);
+       sta->plink_state = PLINK_BLOCKED;
        spin_unlock_bh(&sta->plink_lock);
 }
 
 int mesh_plink_close(struct sta_info *sta)
 {
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
-       int llid, plid, reason;
+       struct ieee80211_sub_if_data *sdata = sta->sdata;
+       __le16 llid, plid, reason;
 #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
        DECLARE_MAC_BUF(mac);
 #endif
@@ -384,32 +387,32 @@ int mesh_plink_close(struct sta_info *sta)
        sta->reason = cpu_to_le16(MESH_LINK_CANCELLED);
        reason = sta->reason;
 
-       if (sta->plink_state == LISTEN || sta->plink_state == BLOCKED) {
+       if (sta->plink_state == PLINK_LISTEN ||
+           sta->plink_state == PLINK_BLOCKED) {
                mesh_plink_fsm_restart(sta);
                spin_unlock_bh(&sta->plink_lock);
-               sta_info_put(sta);
                return 0;
-       } else if (sta->plink_state == ESTAB) {
-               mesh_plink_deactivate(sta);
+       } else if (sta->plink_state == PLINK_ESTAB) {
+               __mesh_plink_deactivate(sta);
                /* The timer should not be running */
-               if (!mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)))
-                       __sta_info_get(sta);
+               mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata));
        } else if (!mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)))
                sta->ignore_plink_timer = true;
 
-       sta->plink_state = HOLDING;
+       sta->plink_state = PLINK_HOLDING;
        llid = sta->llid;
        plid = sta->plid;
        spin_unlock_bh(&sta->plink_lock);
-       mesh_plink_frame_tx(sta->dev, PLINK_CLOSE, sta->addr, llid, plid,
-                           reason);
+       mesh_plink_frame_tx(sta->sdata->dev, PLINK_CLOSE, sta->addr, llid,
+                           plid, reason);
        return 0;
 }
 
 void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                         size_t len, struct ieee80211_rx_status *rx_status)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_local *local = sdata->local;
        struct ieee802_11_elems elems;
        struct sta_info *sta;
        enum plink_event event;
@@ -421,7 +424,6 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
 #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
        DECLARE_MAC_BUF(mac);
 #endif
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        if (is_multicast_ether_addr(mgmt->da)) {
                mpl_dbg("Mesh plink: ignore frame from multicast address");
@@ -460,14 +462,17 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
        if (ftype == PLINK_CONFIRM || (ftype == PLINK_CLOSE && ie_len == 7))
                memcpy(&llid, PLINK_GET_PLID(elems.peer_link), 2);
 
+       rcu_read_lock();
+
        sta = sta_info_get(local, mgmt->sa);
        if (!sta && ftype != PLINK_OPEN) {
                mpl_dbg("Mesh plink: cls or cnf from unknown peer\n");
+               rcu_read_unlock();
                return;
        }
 
-       if (sta && sta->plink_state == BLOCKED) {
-               sta_info_put(sta);
+       if (sta && sta->plink_state == PLINK_BLOCKED) {
+               rcu_read_unlock();
                return;
        }
 
@@ -491,13 +496,19 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                u64 rates;
                if (!mesh_plink_free_count(sdata)) {
                        mpl_dbg("Mesh plink error: no more free plinks\n");
+                       rcu_read_unlock();
                        return;
                }
 
                rates = ieee80211_sta_get_rates(local, &elems, rx_status->band);
-               sta = mesh_plink_add(mgmt->sa, rates, dev);
-               if (IS_ERR(sta)) {
+               sta = mesh_plink_alloc(sdata, mgmt->sa, rates);
+               if (!sta) {
                        mpl_dbg("Mesh plink error: plink table full\n");
+                       rcu_read_unlock();
+                       return;
+               }
+               if (sta_info_insert(sta)) {
+                       rcu_read_unlock();
                        return;
                }
                event = OPN_ACPT;
@@ -507,20 +518,20 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                switch (ftype) {
                case PLINK_OPEN:
                        if (!mesh_plink_free_count(sdata) ||
-                                       (sta->plid && sta->plid != plid))
+                           (sta->plid && sta->plid != plid))
                                event = OPN_IGNR;
                        else
                                event = OPN_ACPT;
                        break;
                case PLINK_CONFIRM:
                        if (!mesh_plink_free_count(sdata) ||
-                               (sta->llid != llid || sta->plid != plid))
+                           (sta->llid != llid || sta->plid != plid))
                                event = CNF_IGNR;
                        else
                                event = CNF_ACPT;
                        break;
                case PLINK_CLOSE:
-                       if (sta->plink_state == ESTAB)
+                       if (sta->plink_state == PLINK_ESTAB)
                                /* Do not check for llid or plid. This does not
                                 * follow the standard but since multiple plinks
                                 * per sta are not supported, it is necessary in
@@ -541,26 +552,26 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                default:
                        mpl_dbg("Mesh plink: unknown frame subtype\n");
                        spin_unlock_bh(&sta->plink_lock);
-                       sta_info_put(sta);
+                       rcu_read_unlock();
                        return;
                }
        }
 
        mpl_dbg("Mesh plink (peer, state, llid, plid, event): %s %d %d %d %d\n",
                        print_mac(mac, mgmt->sa), sta->plink_state,
-                       __le16_to_cpu(sta->llid), __le16_to_cpu(sta->plid),
+                       le16_to_cpu(sta->llid), le16_to_cpu(sta->plid),
                        event);
        reason = 0;
        switch (sta->plink_state) {
                /* spin_unlock as soon as state is updated at each case */
-       case LISTEN:
+       case PLINK_LISTEN:
                switch (event) {
                case CLS_ACPT:
                        mesh_plink_fsm_restart(sta);
                        spin_unlock_bh(&sta->plink_lock);
                        break;
                case OPN_ACPT:
-                       sta->plink_state = OPN_RCVD;
+                       sta->plink_state = PLINK_OPN_RCVD;
                        sta->plid = plid;
                        get_random_bytes(&llid, 2);
                        sta->llid = llid;
@@ -577,7 +588,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                }
                break;
 
-       case OPN_SNT:
+       case PLINK_OPN_SNT:
                switch (event) {
                case OPN_RJCT:
                case CNF_RJCT:
@@ -586,7 +597,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                        if (!reason)
                                reason = cpu_to_le16(MESH_CLOSE_RCVD);
                        sta->reason = reason;
-                       sta->plink_state = HOLDING;
+                       sta->plink_state = PLINK_HOLDING;
                        if (!mod_plink_timer(sta,
                                             dot11MeshHoldingTimeout(sdata)))
                                sta->ignore_plink_timer = true;
@@ -598,7 +609,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                        break;
                case OPN_ACPT:
                        /* retry timer is left untouched */
-                       sta->plink_state = OPN_RCVD;
+                       sta->plink_state = PLINK_OPN_RCVD;
                        sta->plid = plid;
                        llid = sta->llid;
                        spin_unlock_bh(&sta->plink_lock);
@@ -606,7 +617,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                                            plid, 0);
                        break;
                case CNF_ACPT:
-                       sta->plink_state = CNF_RCVD;
+                       sta->plink_state = PLINK_CNF_RCVD;
                        if (!mod_plink_timer(sta,
                                             dot11MeshConfirmTimeout(sdata)))
                                sta->ignore_plink_timer = true;
@@ -619,7 +630,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                }
                break;
 
-       case OPN_RCVD:
+       case PLINK_OPN_RCVD:
                switch (event) {
                case OPN_RJCT:
                case CNF_RJCT:
@@ -628,7 +639,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                        if (!reason)
                                reason = cpu_to_le16(MESH_CLOSE_RCVD);
                        sta->reason = reason;
-                       sta->plink_state = HOLDING;
+                       sta->plink_state = PLINK_HOLDING;
                        if (!mod_plink_timer(sta,
                                             dot11MeshHoldingTimeout(sdata)))
                                sta->ignore_plink_timer = true;
@@ -645,9 +656,8 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                                            plid, 0);
                        break;
                case CNF_ACPT:
-                       if (del_timer(&sta->plink_timer))
-                               sta_info_put(sta);
-                       sta->plink_state = ESTAB;
+                       del_timer(&sta->plink_timer);
+                       sta->plink_state = PLINK_ESTAB;
                        mesh_plink_inc_estab_count(sdata);
                        spin_unlock_bh(&sta->plink_lock);
                        mpl_dbg("Mesh plink with %s ESTABLISHED\n",
@@ -659,7 +669,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                }
                break;
 
-       case CNF_RCVD:
+       case PLINK_CNF_RCVD:
                switch (event) {
                case OPN_RJCT:
                case CNF_RJCT:
@@ -668,7 +678,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                        if (!reason)
                                reason = cpu_to_le16(MESH_CLOSE_RCVD);
                        sta->reason = reason;
-                       sta->plink_state = HOLDING;
+                       sta->plink_state = PLINK_HOLDING;
                        if (!mod_plink_timer(sta,
                                             dot11MeshHoldingTimeout(sdata)))
                                sta->ignore_plink_timer = true;
@@ -677,10 +687,10 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                        spin_unlock_bh(&sta->plink_lock);
                        mesh_plink_frame_tx(dev, PLINK_CLOSE, sta->addr, llid,
                                            plid, reason);
+                       break;
                case OPN_ACPT:
-                       if (del_timer(&sta->plink_timer))
-                               sta_info_put(sta);
-                       sta->plink_state = ESTAB;
+                       del_timer(&sta->plink_timer);
+                       sta->plink_state = PLINK_ESTAB;
                        mesh_plink_inc_estab_count(sdata);
                        spin_unlock_bh(&sta->plink_lock);
                        mpl_dbg("Mesh plink with %s ESTABLISHED\n",
@@ -694,17 +704,15 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                }
                break;
 
-       case ESTAB:
+       case PLINK_ESTAB:
                switch (event) {
                case CLS_ACPT:
                        reason = cpu_to_le16(MESH_CLOSE_RCVD);
                        sta->reason = reason;
-                       mesh_plink_deactivate(sta);
-                       sta->plink_state = HOLDING;
+                       __mesh_plink_deactivate(sta);
+                       sta->plink_state = PLINK_HOLDING;
                        llid = sta->llid;
-                       if (!mod_plink_timer(sta,
-                                       dot11MeshHoldingTimeout(sdata)))
-                               __sta_info_get(sta);
+                       mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata));
                        spin_unlock_bh(&sta->plink_lock);
                        mesh_plink_frame_tx(dev, PLINK_CLOSE, sta->addr, llid,
                                            plid, reason);
@@ -720,13 +728,11 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                        break;
                }
                break;
-       case HOLDING:
+       case PLINK_HOLDING:
                switch (event) {
                case CLS_ACPT:
-                       if (del_timer(&sta->plink_timer)) {
+                       if (del_timer(&sta->plink_timer))
                                sta->ignore_plink_timer = 1;
-                               sta_info_put(sta);
-                       }
                        mesh_plink_fsm_restart(sta);
                        spin_unlock_bh(&sta->plink_lock);
                        break;
@@ -745,11 +751,12 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
                }
                break;
        default:
-               /* should not get here, BLOCKED is dealt with at the beggining
-                * of the function
+               /* should not get here, PLINK_BLOCKED is dealt with at the
+                * beggining of the function
                 */
                spin_unlock_bh(&sta->plink_lock);
                break;
        }
-       sta_info_put(sta);
+
+       rcu_read_unlock();
 }