]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
[MAC80211]: fix bug for per-sta stats
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 27 Jul 2007 13:43:22 +0000 (15:43 +0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:47:32 +0000 (16:47 -0700)
pre_rx handlers can't really touch sta since for IBSS it might not be
assigned yet, it can create sta info structs on-the-fly.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/rx.c

index 21d401523d13cf0a4d200ebe4f83889c7f8977fe..f255579dc5647920b269644134086a33556d1b6e 100644 (file)
@@ -28,6 +28,8 @@
 /* pre-rx handlers
  *
  * these don't have dev/sdata fields in the rx data
+ * The sta value should also not be used because it may
+ * be NULL even though a STA (in IBSS mode) will be added.
  */
 
 static ieee80211_txrx_result
@@ -50,12 +52,11 @@ ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx)
                        tid = 0; /* 802.1d - Best Effort */
                }
        }
-#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
+
        I802_DEBUG_INC(rx->local->wme_rx_queue[tid]);
-       if (rx->sta) {
+       /* only a debug counter, sta might not be assigned properly yet */
+       if (rx->sta)
                I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]);
-       }
-#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
 
        rx->u.rx.queue = tid;
        /* Set skb->priority to 1d tag if highest order bit of TID is not set.
@@ -110,8 +111,6 @@ ieee80211_rx_h_load_stats(struct ieee80211_txrx_data *rx)
        /* Divide channel_use by 8 to avoid wrapping around the counter */
        load >>= CHAN_UTIL_SHIFT;
        local->channel_use_raw += load;
-       if (rx->sta)
-               rx->sta->channel_use_raw += load;
        rx->u.rx.load = load;
 
        return TXRX_CONTINUE;
@@ -129,6 +128,8 @@ ieee80211_rx_handler ieee80211_rx_pre_handlers[] =
 static ieee80211_txrx_result
 ieee80211_rx_h_if_stats(struct ieee80211_txrx_data *rx)
 {
+       if (rx->sta)
+               rx->sta->channel_use_raw += rx->u.rx.load;
        rx->sdata->channel_use_raw += rx->u.rx.load;
        return TXRX_CONTINUE;
 }