aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r--net/mac80211/rx.c62
1 files changed, 3 insertions, 59 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index cf0de3b0fe24..9400a9766a77 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -387,51 +387,9 @@ static void ieee80211_verify_ip_alignment(struct ieee80211_rx_data *rx)
387} 387}
388 388
389 389
390static u32 ieee80211_rx_load_stats(struct ieee80211_local *local,
391 struct sk_buff *skb,
392 struct ieee80211_rx_status *status,
393 struct ieee80211_rate *rate)
394{
395 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
396 u32 load = 0, hdrtime;
397
398 /* Estimate total channel use caused by this frame */
399
400 /* 1 bit at 1 Mbit/s takes 1 usec; in channel_use values,
401 * 1 usec = 1/8 * (1080 / 10) = 13.5 */
402
403 if (status->band == IEEE80211_BAND_5GHZ ||
404 (status->band == IEEE80211_BAND_5GHZ &&
405 rate->flags & IEEE80211_RATE_ERP_G))
406 hdrtime = CHAN_UTIL_HDR_SHORT;
407 else
408 hdrtime = CHAN_UTIL_HDR_LONG;
409
410 load = hdrtime;
411 if (!is_multicast_ether_addr(hdr->addr1))
412 load += hdrtime;
413
414 /* TODO: optimise again */
415 load += skb->len * CHAN_UTIL_RATE_LCM / rate->bitrate;
416
417 /* Divide channel_use by 8 to avoid wrapping around the counter */
418 load >>= CHAN_UTIL_SHIFT;
419
420 return load;
421}
422
423/* rx handlers */ 390/* rx handlers */
424 391
425static ieee80211_rx_result 392static ieee80211_rx_result
426ieee80211_rx_h_if_stats(struct ieee80211_rx_data *rx)
427{
428 if (rx->sta)
429 rx->sta->channel_use_raw += rx->load;
430 rx->sdata->channel_use_raw += rx->load;
431 return RX_CONTINUE;
432}
433
434static ieee80211_rx_result
435ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx) 393ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)
436{ 394{
437 struct ieee80211_local *local = rx->local; 395 struct ieee80211_local *local = rx->local;
@@ -1780,7 +1738,6 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx)
1780typedef ieee80211_rx_result (*ieee80211_rx_handler)(struct ieee80211_rx_data *); 1738typedef ieee80211_rx_result (*ieee80211_rx_handler)(struct ieee80211_rx_data *);
1781static ieee80211_rx_handler ieee80211_rx_handlers[] = 1739static ieee80211_rx_handler ieee80211_rx_handlers[] =
1782{ 1740{
1783 ieee80211_rx_h_if_stats,
1784 ieee80211_rx_h_passive_scan, 1741 ieee80211_rx_h_passive_scan,
1785 ieee80211_rx_h_check, 1742 ieee80211_rx_h_check,
1786 ieee80211_rx_h_decrypt, 1743 ieee80211_rx_h_decrypt,
@@ -1939,7 +1896,6 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1939static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, 1896static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1940 struct sk_buff *skb, 1897 struct sk_buff *skb,
1941 struct ieee80211_rx_status *status, 1898 struct ieee80211_rx_status *status,
1942 u32 load,
1943 struct ieee80211_rate *rate) 1899 struct ieee80211_rate *rate)
1944{ 1900{
1945 struct ieee80211_local *local = hw_to_local(hw); 1901 struct ieee80211_local *local = hw_to_local(hw);
@@ -1958,7 +1914,6 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1958 rx.local = local; 1914 rx.local = local;
1959 1915
1960 rx.status = status; 1916 rx.status = status;
1961 rx.load = load;
1962 rx.rate = rate; 1917 rx.rate = rate;
1963 rx.fc = le16_to_cpu(hdr->frame_control); 1918 rx.fc = le16_to_cpu(hdr->frame_control);
1964 type = rx.fc & IEEE80211_FCTL_FTYPE; 1919 type = rx.fc & IEEE80211_FCTL_FTYPE;
@@ -2067,7 +2022,6 @@ u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
2067 struct ieee80211_rx_status status; 2022 struct ieee80211_rx_status status;
2068 u16 head_seq_num, buf_size; 2023 u16 head_seq_num, buf_size;
2069 int index; 2024 int index;
2070 u32 pkt_load;
2071 struct ieee80211_supported_band *sband; 2025 struct ieee80211_supported_band *sband;
2072 struct ieee80211_rate *rate; 2026 struct ieee80211_rate *rate;
2073 2027
@@ -2102,12 +2056,9 @@ u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
2102 sizeof(status)); 2056 sizeof(status));
2103 sband = local->hw.wiphy->bands[status.band]; 2057 sband = local->hw.wiphy->bands[status.band];
2104 rate = &sband->bitrates[status.rate_idx]; 2058 rate = &sband->bitrates[status.rate_idx];
2105 pkt_load = ieee80211_rx_load_stats(local,
2106 tid_agg_rx->reorder_buf[index],
2107 &status, rate);
2108 __ieee80211_rx_handle_packet(hw, 2059 __ieee80211_rx_handle_packet(hw,
2109 tid_agg_rx->reorder_buf[index], 2060 tid_agg_rx->reorder_buf[index],
2110 &status, pkt_load, rate); 2061 &status, rate);
2111 tid_agg_rx->stored_mpdu_num--; 2062 tid_agg_rx->stored_mpdu_num--;
2112 tid_agg_rx->reorder_buf[index] = NULL; 2063 tid_agg_rx->reorder_buf[index] = NULL;
2113 } 2064 }
@@ -2149,11 +2100,8 @@ u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
2149 sizeof(status)); 2100 sizeof(status));
2150 sband = local->hw.wiphy->bands[status.band]; 2101 sband = local->hw.wiphy->bands[status.band];
2151 rate = &sband->bitrates[status.rate_idx]; 2102 rate = &sband->bitrates[status.rate_idx];
2152 pkt_load = ieee80211_rx_load_stats(local,
2153 tid_agg_rx->reorder_buf[index],
2154 &status, rate);
2155 __ieee80211_rx_handle_packet(hw, tid_agg_rx->reorder_buf[index], 2103 __ieee80211_rx_handle_packet(hw, tid_agg_rx->reorder_buf[index],
2156 &status, pkt_load, rate); 2104 &status, rate);
2157 tid_agg_rx->stored_mpdu_num--; 2105 tid_agg_rx->stored_mpdu_num--;
2158 tid_agg_rx->reorder_buf[index] = NULL; 2106 tid_agg_rx->reorder_buf[index] = NULL;
2159 tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num); 2107 tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num);
@@ -2232,7 +2180,6 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
2232 struct ieee80211_rx_status *status) 2180 struct ieee80211_rx_status *status)
2233{ 2181{
2234 struct ieee80211_local *local = hw_to_local(hw); 2182 struct ieee80211_local *local = hw_to_local(hw);
2235 u32 pkt_load;
2236 struct ieee80211_rate *rate = NULL; 2183 struct ieee80211_rate *rate = NULL;
2237 struct ieee80211_supported_band *sband; 2184 struct ieee80211_supported_band *sband;
2238 2185
@@ -2272,11 +2219,8 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
2272 return; 2219 return;
2273 } 2220 }
2274 2221
2275 pkt_load = ieee80211_rx_load_stats(local, skb, status, rate);
2276 local->channel_use_raw += pkt_load;
2277
2278 if (!ieee80211_rx_reorder_ampdu(local, skb)) 2222 if (!ieee80211_rx_reorder_ampdu(local, skb))
2279 __ieee80211_rx_handle_packet(hw, skb, status, pkt_load, rate); 2223 __ieee80211_rx_handle_packet(hw, skb, status, rate);
2280 2224
2281 rcu_read_unlock(); 2225 rcu_read_unlock();
2282} 2226}