Commit 9e72ebd686a7f39facdfff639386055f1ad7dc88

Authored by Johannes Berg
Committed by John W. Linville
1 parent 53c068566d

mac80211: remove channel use statistics

The useless channel use statistics are quite a lot of code, currently
use integer divisions in the packet fast path, are rather inaccurate
since they do not account for retries and finally nobody even cares.
Hence, remove them completely.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 6 changed files with 12 additions and 169 deletions Side-by-side Diff

net/mac80211/debugfs_netdev.c
... ... @@ -155,7 +155,6 @@
155 155 __IEEE80211_IF_WFILE(name)
156 156  
157 157 /* common attributes */
158   -IEEE80211_IF_FILE(channel_use, channel_use, DEC);
159 158 IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
160 159  
161 160 /* STA/IBSS attributes */
... ... @@ -248,7 +247,6 @@
248 247  
249 248 static void add_sta_files(struct ieee80211_sub_if_data *sdata)
250 249 {
251   - DEBUGFS_ADD(channel_use, sta);
252 250 DEBUGFS_ADD(drop_unencrypted, sta);
253 251 DEBUGFS_ADD(state, sta);
254 252 DEBUGFS_ADD(bssid, sta);
... ... @@ -269,7 +267,6 @@
269 267  
270 268 static void add_ap_files(struct ieee80211_sub_if_data *sdata)
271 269 {
272   - DEBUGFS_ADD(channel_use, ap);
273 270 DEBUGFS_ADD(drop_unencrypted, ap);
274 271 DEBUGFS_ADD(num_sta_ps, ap);
275 272 DEBUGFS_ADD(dtim_count, ap);
276 273  
... ... @@ -281,14 +278,12 @@
281 278  
282 279 static void add_wds_files(struct ieee80211_sub_if_data *sdata)
283 280 {
284   - DEBUGFS_ADD(channel_use, wds);
285 281 DEBUGFS_ADD(drop_unencrypted, wds);
286 282 DEBUGFS_ADD(peer, wds);
287 283 }
288 284  
289 285 static void add_vlan_files(struct ieee80211_sub_if_data *sdata)
290 286 {
291   - DEBUGFS_ADD(channel_use, vlan);
292 287 DEBUGFS_ADD(drop_unencrypted, vlan);
293 288 }
294 289  
... ... @@ -376,7 +371,6 @@
376 371  
377 372 static void del_sta_files(struct ieee80211_sub_if_data *sdata)
378 373 {
379   - DEBUGFS_DEL(channel_use, sta);
380 374 DEBUGFS_DEL(drop_unencrypted, sta);
381 375 DEBUGFS_DEL(state, sta);
382 376 DEBUGFS_DEL(bssid, sta);
... ... @@ -397,7 +391,6 @@
397 391  
398 392 static void del_ap_files(struct ieee80211_sub_if_data *sdata)
399 393 {
400   - DEBUGFS_DEL(channel_use, ap);
401 394 DEBUGFS_DEL(drop_unencrypted, ap);
402 395 DEBUGFS_DEL(num_sta_ps, ap);
403 396 DEBUGFS_DEL(dtim_count, ap);
404 397  
... ... @@ -409,14 +402,12 @@
409 402  
410 403 static void del_wds_files(struct ieee80211_sub_if_data *sdata)
411 404 {
412   - DEBUGFS_DEL(channel_use, wds);
413 405 DEBUGFS_DEL(drop_unencrypted, wds);
414 406 DEBUGFS_DEL(peer, wds);
415 407 }
416 408  
417 409 static void del_vlan_files(struct ieee80211_sub_if_data *sdata)
418 410 {
419   - DEBUGFS_DEL(channel_use, vlan);
420 411 DEBUGFS_DEL(drop_unencrypted, vlan);
421 412 }
422 413  
net/mac80211/debugfs_sta.c
... ... @@ -66,7 +66,6 @@
66 66 STA_FILE(last_signal, last_signal, D);
67 67 STA_FILE(last_qual, last_qual, D);
68 68 STA_FILE(last_noise, last_noise, D);
69   -STA_FILE(channel_use, channel_use, D);
70 69 STA_FILE(wep_weak_iv_count, wep_weak_iv_count, LU);
71 70  
72 71 static ssize_t sta_flags_read(struct file *file, char __user *userbuf,
net/mac80211/ieee80211_i.h
... ... @@ -201,7 +201,6 @@
201 201 unsigned int flags;
202 202 int sent_ps_buffered;
203 203 int queue;
204   - int load;
205 204 u32 tkip_iv32;
206 205 u16 tkip_iv16;
207 206 };
208 207  
... ... @@ -448,14 +447,11 @@
448 447 struct ieee80211_if_sta sta;
449 448 u32 mntr_flags;
450 449 } u;
451   - int channel_use;
452   - int channel_use_raw;
453 450  
454 451 #ifdef CONFIG_MAC80211_DEBUGFS
455 452 struct dentry *debugfsdir;
456 453 union {
457 454 struct {
458   - struct dentry *channel_use;
459 455 struct dentry *drop_unencrypted;
460 456 struct dentry *state;
461 457 struct dentry *bssid;
... ... @@ -474,7 +470,6 @@
474 470 struct dentry *num_beacons_sta;
475 471 } sta;
476 472 struct {
477   - struct dentry *channel_use;
478 473 struct dentry *drop_unencrypted;
479 474 struct dentry *num_sta_ps;
480 475 struct dentry *dtim_count;
481 476  
... ... @@ -484,12 +479,10 @@
484 479 struct dentry *num_buffered_multicast;
485 480 } ap;
486 481 struct {
487   - struct dentry *channel_use;
488 482 struct dentry *drop_unencrypted;
489 483 struct dentry *peer;
490 484 } wds;
491 485 struct {
492   - struct dentry *channel_use;
493 486 struct dentry *drop_unencrypted;
494 487 } vlan;
495 488 struct {
... ... @@ -661,9 +654,6 @@
661 654 assoc_led_name[32], radio_led_name[32];
662 655 #endif
663 656  
664   - u32 channel_use;
665   - u32 channel_use_raw;
666   -
667 657 #ifdef CONFIG_MAC80211_DEBUGFS
668 658 struct work_struct sta_debugfs_add;
669 659 #endif
... ... @@ -861,28 +851,6 @@
861 851  
862 852 /* ieee80211_ioctl.c */
863 853 extern const struct iw_handler_def ieee80211_iw_handler_def;
864   -
865   -
866   -/* Least common multiple of the used rates (in 100 kbps). This is used to
867   - * calculate rate_inv values for each rate so that only integers are needed. */
868   -#define CHAN_UTIL_RATE_LCM 95040
869   -/* 1 usec is 1/8 * (95040/10) = 1188 */
870   -#define CHAN_UTIL_PER_USEC 1188
871   -/* Amount of bits to shift the result right to scale the total utilization
872   - * to values that will not wrap around 32-bit integers. */
873   -#define CHAN_UTIL_SHIFT 9
874   -/* Theoretical maximum of channel utilization counter in 10 ms (stat_time=1):
875   - * (CHAN_UTIL_PER_USEC * 10000) >> CHAN_UTIL_SHIFT = 23203. So dividing the
876   - * raw value with about 23 should give utilization in 10th of a percentage
877   - * (1/1000). However, utilization is only estimated and not all intervals
878   - * between frames etc. are calculated. 18 seems to give numbers that are closer
879   - * to the real maximum. */
880   -#define CHAN_UTIL_PER_10MS 18
881   -#define CHAN_UTIL_HDR_LONG (202 * CHAN_UTIL_PER_USEC)
882   -#define CHAN_UTIL_HDR_SHORT (40 * CHAN_UTIL_PER_USEC)
883   -
884   -
885   -/* ieee80211_ioctl.c */
886 854 int ieee80211_set_freq(struct ieee80211_local *local, int freq);
887 855 /* ieee80211_sta.c */
888 856 void ieee80211_sta_timer(unsigned long data);
... ... @@ -387,51 +387,9 @@
387 387 }
388 388  
389 389  
390   -static 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 390 /* rx handlers */
424 391  
425 392 static ieee80211_rx_result
426   -ieee80211_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   -
434   -static ieee80211_rx_result
435 393 ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)
436 394 {
437 395 struct ieee80211_local *local = rx->local;
... ... @@ -1780,7 +1738,6 @@
1780 1738 typedef ieee80211_rx_result (*ieee80211_rx_handler)(struct ieee80211_rx_data *);
1781 1739 static ieee80211_rx_handler ieee80211_rx_handlers[] =
1782 1740 {
1783   - ieee80211_rx_h_if_stats,
1784 1741 ieee80211_rx_h_passive_scan,
1785 1742 ieee80211_rx_h_check,
1786 1743 ieee80211_rx_h_decrypt,
... ... @@ -1939,7 +1896,6 @@
1939 1896 static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1940 1897 struct sk_buff *skb,
1941 1898 struct ieee80211_rx_status *status,
1942   - u32 load,
1943 1899 struct ieee80211_rate *rate)
1944 1900 {
1945 1901 struct ieee80211_local *local = hw_to_local(hw);
... ... @@ -1958,7 +1914,6 @@
1958 1914 rx.local = local;
1959 1915  
1960 1916 rx.status = status;
1961   - rx.load = load;
1962 1917 rx.rate = rate;
1963 1918 rx.fc = le16_to_cpu(hdr->frame_control);
1964 1919 type = rx.fc & IEEE80211_FCTL_FTYPE;
... ... @@ -2067,7 +2022,6 @@
2067 2022 struct ieee80211_rx_status status;
2068 2023 u16 head_seq_num, buf_size;
2069 2024 int index;
2070   - u32 pkt_load;
2071 2025 struct ieee80211_supported_band *sband;
2072 2026 struct ieee80211_rate *rate;
2073 2027  
2074 2028  
... ... @@ -2102,12 +2056,9 @@
2102 2056 sizeof(status));
2103 2057 sband = local->hw.wiphy->bands[status.band];
2104 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 2059 __ieee80211_rx_handle_packet(hw,
2109 2060 tid_agg_rx->reorder_buf[index],
2110   - &status, pkt_load, rate);
  2061 + &status, rate);
2111 2062 tid_agg_rx->stored_mpdu_num--;
2112 2063 tid_agg_rx->reorder_buf[index] = NULL;
2113 2064 }
2114 2065  
... ... @@ -2149,11 +2100,8 @@
2149 2100 sizeof(status));
2150 2101 sband = local->hw.wiphy->bands[status.band];
2151 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 2103 __ieee80211_rx_handle_packet(hw, tid_agg_rx->reorder_buf[index],
2156   - &status, pkt_load, rate);
  2104 + &status, rate);
2157 2105 tid_agg_rx->stored_mpdu_num--;
2158 2106 tid_agg_rx->reorder_buf[index] = NULL;
2159 2107 tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num);
... ... @@ -2232,7 +2180,6 @@
2232 2180 struct ieee80211_rx_status *status)
2233 2181 {
2234 2182 struct ieee80211_local *local = hw_to_local(hw);
2235   - u32 pkt_load;
2236 2183 struct ieee80211_rate *rate = NULL;
2237 2184 struct ieee80211_supported_band *sband;
2238 2185  
2239 2186  
... ... @@ -2272,11 +2219,8 @@
2272 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 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 2225 rcu_read_unlock();
2282 2226 }
net/mac80211/sta_info.h
... ... @@ -245,10 +245,6 @@
245 245 unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
246 246 #endif
247 247  
248   - /* Debug counters, no locking doesn't matter */
249   - int channel_use;
250   - int channel_use_raw;
251   -
252 248 /*
253 249 * Aggregation information, locked with lock.
254 250 */
... ... @@ -761,73 +761,18 @@
761 761 static ieee80211_tx_result
762 762 ieee80211_tx_h_stats(struct ieee80211_tx_data *tx)
763 763 {
764   - struct ieee80211_local *local = tx->local;
765   - struct sk_buff *skb = tx->skb;
766   - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
767   - u32 load = 0, hdrtime;
768   - struct ieee80211_rate *rate;
769   - struct ieee80211_supported_band *sband;
770   - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  764 + int i;
771 765  
772   - sband = tx->local->hw.wiphy->bands[tx->channel->band];
773   - rate = &sband->bitrates[tx->rate_idx];
  766 + if (!tx->sta)
  767 + return TX_CONTINUE;
774 768  
775   - /* TODO: this could be part of tx_status handling, so that the number
776   - * of retries would be known; TX rate should in that case be stored
777   - * somewhere with the packet */
778   -
779   - /* Estimate total channel use caused by this frame */
780   -
781   - /* 1 bit at 1 Mbit/s takes 1 usec; in channel_use values,
782   - * 1 usec = 1/8 * (1080 / 10) = 13.5 */
783   -
784   - if (tx->channel->band == IEEE80211_BAND_5GHZ ||
785   - (tx->channel->band == IEEE80211_BAND_2GHZ &&
786   - rate->flags & IEEE80211_RATE_ERP_G))
787   - hdrtime = CHAN_UTIL_HDR_SHORT;
788   - else
789   - hdrtime = CHAN_UTIL_HDR_LONG;
790   -
791   - load = hdrtime;
792   - if (!is_multicast_ether_addr(hdr->addr1))
793   - load += hdrtime;
794   -
795   - if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)
796   - load += 2 * hdrtime;
797   - else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)
798   - load += hdrtime;
799   -
800   - /* TODO: optimise again */
801   - load += skb->len * CHAN_UTIL_RATE_LCM / rate->bitrate;
802   -
  769 + tx->sta->tx_packets++;
  770 + tx->sta->tx_fragments++;
  771 + tx->sta->tx_bytes += tx->skb->len;
803 772 if (tx->extra_frag) {
804   - int i;
805   - for (i = 0; i < tx->num_extra_frag; i++) {
806   - load += 2 * hdrtime;
807   - load += tx->extra_frag[i]->len *
808   - rate->bitrate;
809   - }
810   - }
811   -
812   - /* Divide channel_use by 8 to avoid wrapping around the counter */
813   - load >>= CHAN_UTIL_SHIFT;
814   - local->channel_use_raw += load;
815   - if (tx->sta)
816   - tx->sta->channel_use_raw += load;
817   - tx->sdata->channel_use_raw += load;
818   -
819   - if (tx->sta) {
820   - tx->sta->tx_packets++;
821   - tx->sta->tx_fragments++;
822   - tx->sta->tx_bytes += tx->skb->len;
823   - if (tx->extra_frag) {
824   - int i;
825   - tx->sta->tx_fragments += tx->num_extra_frag;
826   - for (i = 0; i < tx->num_extra_frag; i++) {
827   - tx->sta->tx_bytes +=
828   - tx->extra_frag[i]->len;
829   - }
830   - }
  773 + tx->sta->tx_fragments += tx->num_extra_frag;
  774 + for (i = 0; i < tx->num_extra_frag; i++)
  775 + tx->sta->tx_bytes += tx->extra_frag[i]->len;
831 776 }
832 777  
833 778 return TX_CONTINUE;