aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-05-21 11:33:42 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-21 21:48:17 -0400
commit9e72ebd686a7f39facdfff639386055f1ad7dc88 (patch)
tree96ad46f1948d76217b3422ca5d822b1c265d39d7 /net/mac80211
parent53c068566dde708cb28a4dfc06ae3d7fd7434397 (diff)
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>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/debugfs_netdev.c9
-rw-r--r--net/mac80211/debugfs_sta.c1
-rw-r--r--net/mac80211/ieee80211_i.h32
-rw-r--r--net/mac80211/rx.c62
-rw-r--r--net/mac80211/sta_info.h4
-rw-r--r--net/mac80211/tx.c73
6 files changed, 12 insertions, 169 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 3ae5493d728b..b2089b2da48a 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -155,7 +155,6 @@ static const struct file_operations name##_ops = { \
155 __IEEE80211_IF_WFILE(name) 155 __IEEE80211_IF_WFILE(name)
156 156
157/* common attributes */ 157/* common attributes */
158IEEE80211_IF_FILE(channel_use, channel_use, DEC);
159IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); 158IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
160 159
161/* STA/IBSS attributes */ 160/* STA/IBSS attributes */
@@ -248,7 +247,6 @@ IEEE80211_IF_WFILE(min_discovery_timeout,
248 247
249static void add_sta_files(struct ieee80211_sub_if_data *sdata) 248static void add_sta_files(struct ieee80211_sub_if_data *sdata)
250{ 249{
251 DEBUGFS_ADD(channel_use, sta);
252 DEBUGFS_ADD(drop_unencrypted, sta); 250 DEBUGFS_ADD(drop_unencrypted, sta);
253 DEBUGFS_ADD(state, sta); 251 DEBUGFS_ADD(state, sta);
254 DEBUGFS_ADD(bssid, sta); 252 DEBUGFS_ADD(bssid, sta);
@@ -269,7 +267,6 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata)
269 267
270static void add_ap_files(struct ieee80211_sub_if_data *sdata) 268static void add_ap_files(struct ieee80211_sub_if_data *sdata)
271{ 269{
272 DEBUGFS_ADD(channel_use, ap);
273 DEBUGFS_ADD(drop_unencrypted, ap); 270 DEBUGFS_ADD(drop_unencrypted, ap);
274 DEBUGFS_ADD(num_sta_ps, ap); 271 DEBUGFS_ADD(num_sta_ps, ap);
275 DEBUGFS_ADD(dtim_count, ap); 272 DEBUGFS_ADD(dtim_count, ap);
@@ -281,14 +278,12 @@ static void add_ap_files(struct ieee80211_sub_if_data *sdata)
281 278
282static void add_wds_files(struct ieee80211_sub_if_data *sdata) 279static void add_wds_files(struct ieee80211_sub_if_data *sdata)
283{ 280{
284 DEBUGFS_ADD(channel_use, wds);
285 DEBUGFS_ADD(drop_unencrypted, wds); 281 DEBUGFS_ADD(drop_unencrypted, wds);
286 DEBUGFS_ADD(peer, wds); 282 DEBUGFS_ADD(peer, wds);
287} 283}
288 284
289static void add_vlan_files(struct ieee80211_sub_if_data *sdata) 285static void add_vlan_files(struct ieee80211_sub_if_data *sdata)
290{ 286{
291 DEBUGFS_ADD(channel_use, vlan);
292 DEBUGFS_ADD(drop_unencrypted, vlan); 287 DEBUGFS_ADD(drop_unencrypted, vlan);
293} 288}
294 289
@@ -376,7 +371,6 @@ static void add_files(struct ieee80211_sub_if_data *sdata)
376 371
377static void del_sta_files(struct ieee80211_sub_if_data *sdata) 372static void del_sta_files(struct ieee80211_sub_if_data *sdata)
378{ 373{
379 DEBUGFS_DEL(channel_use, sta);
380 DEBUGFS_DEL(drop_unencrypted, sta); 374 DEBUGFS_DEL(drop_unencrypted, sta);
381 DEBUGFS_DEL(state, sta); 375 DEBUGFS_DEL(state, sta);
382 DEBUGFS_DEL(bssid, sta); 376 DEBUGFS_DEL(bssid, sta);
@@ -397,7 +391,6 @@ static void del_sta_files(struct ieee80211_sub_if_data *sdata)
397 391
398static void del_ap_files(struct ieee80211_sub_if_data *sdata) 392static void del_ap_files(struct ieee80211_sub_if_data *sdata)
399{ 393{
400 DEBUGFS_DEL(channel_use, ap);
401 DEBUGFS_DEL(drop_unencrypted, ap); 394 DEBUGFS_DEL(drop_unencrypted, ap);
402 DEBUGFS_DEL(num_sta_ps, ap); 395 DEBUGFS_DEL(num_sta_ps, ap);
403 DEBUGFS_DEL(dtim_count, ap); 396 DEBUGFS_DEL(dtim_count, ap);
@@ -409,14 +402,12 @@ static void del_ap_files(struct ieee80211_sub_if_data *sdata)
409 402
410static void del_wds_files(struct ieee80211_sub_if_data *sdata) 403static void del_wds_files(struct ieee80211_sub_if_data *sdata)
411{ 404{
412 DEBUGFS_DEL(channel_use, wds);
413 DEBUGFS_DEL(drop_unencrypted, wds); 405 DEBUGFS_DEL(drop_unencrypted, wds);
414 DEBUGFS_DEL(peer, wds); 406 DEBUGFS_DEL(peer, wds);
415} 407}
416 408
417static void del_vlan_files(struct ieee80211_sub_if_data *sdata) 409static void del_vlan_files(struct ieee80211_sub_if_data *sdata)
418{ 410{
419 DEBUGFS_DEL(channel_use, vlan);
420 DEBUGFS_DEL(drop_unencrypted, vlan); 411 DEBUGFS_DEL(drop_unencrypted, vlan);
421} 412}
422 413
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index a2cc0284c9d0..79a062782d52 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -66,7 +66,6 @@ STA_FILE(tx_retry_count, tx_retry_count, LU);
66STA_FILE(last_signal, last_signal, D); 66STA_FILE(last_signal, last_signal, D);
67STA_FILE(last_qual, last_qual, D); 67STA_FILE(last_qual, last_qual, D);
68STA_FILE(last_noise, last_noise, D); 68STA_FILE(last_noise, last_noise, D);
69STA_FILE(channel_use, channel_use, D);
70STA_FILE(wep_weak_iv_count, wep_weak_iv_count, LU); 69STA_FILE(wep_weak_iv_count, wep_weak_iv_count, LU);
71 70
72static ssize_t sta_flags_read(struct file *file, char __user *userbuf, 71static ssize_t sta_flags_read(struct file *file, char __user *userbuf,
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 7d614cdcefcb..3f8601cafffb 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -201,7 +201,6 @@ struct ieee80211_rx_data {
201 unsigned int flags; 201 unsigned int flags;
202 int sent_ps_buffered; 202 int sent_ps_buffered;
203 int queue; 203 int queue;
204 int load;
205 u32 tkip_iv32; 204 u32 tkip_iv32;
206 u16 tkip_iv16; 205 u16 tkip_iv16;
207}; 206};
@@ -448,14 +447,11 @@ struct ieee80211_sub_if_data {
448 struct ieee80211_if_sta sta; 447 struct ieee80211_if_sta sta;
449 u32 mntr_flags; 448 u32 mntr_flags;
450 } u; 449 } u;
451 int channel_use;
452 int channel_use_raw;
453 450
454#ifdef CONFIG_MAC80211_DEBUGFS 451#ifdef CONFIG_MAC80211_DEBUGFS
455 struct dentry *debugfsdir; 452 struct dentry *debugfsdir;
456 union { 453 union {
457 struct { 454 struct {
458 struct dentry *channel_use;
459 struct dentry *drop_unencrypted; 455 struct dentry *drop_unencrypted;
460 struct dentry *state; 456 struct dentry *state;
461 struct dentry *bssid; 457 struct dentry *bssid;
@@ -474,7 +470,6 @@ struct ieee80211_sub_if_data {
474 struct dentry *num_beacons_sta; 470 struct dentry *num_beacons_sta;
475 } sta; 471 } sta;
476 struct { 472 struct {
477 struct dentry *channel_use;
478 struct dentry *drop_unencrypted; 473 struct dentry *drop_unencrypted;
479 struct dentry *num_sta_ps; 474 struct dentry *num_sta_ps;
480 struct dentry *dtim_count; 475 struct dentry *dtim_count;
@@ -484,12 +479,10 @@ struct ieee80211_sub_if_data {
484 struct dentry *num_buffered_multicast; 479 struct dentry *num_buffered_multicast;
485 } ap; 480 } ap;
486 struct { 481 struct {
487 struct dentry *channel_use;
488 struct dentry *drop_unencrypted; 482 struct dentry *drop_unencrypted;
489 struct dentry *peer; 483 struct dentry *peer;
490 } wds; 484 } wds;
491 struct { 485 struct {
492 struct dentry *channel_use;
493 struct dentry *drop_unencrypted; 486 struct dentry *drop_unencrypted;
494 } vlan; 487 } vlan;
495 struct { 488 struct {
@@ -661,9 +654,6 @@ struct ieee80211_local {
661 assoc_led_name[32], radio_led_name[32]; 654 assoc_led_name[32], radio_led_name[32];
662#endif 655#endif
663 656
664 u32 channel_use;
665 u32 channel_use_raw;
666
667#ifdef CONFIG_MAC80211_DEBUGFS 657#ifdef CONFIG_MAC80211_DEBUGFS
668 struct work_struct sta_debugfs_add; 658 struct work_struct sta_debugfs_add;
669#endif 659#endif
@@ -861,28 +851,6 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
861 851
862/* ieee80211_ioctl.c */ 852/* ieee80211_ioctl.c */
863extern const struct iw_handler_def ieee80211_iw_handler_def; 853extern 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 */
886int ieee80211_set_freq(struct ieee80211_local *local, int freq); 854int ieee80211_set_freq(struct ieee80211_local *local, int freq);
887/* ieee80211_sta.c */ 855/* ieee80211_sta.c */
888void ieee80211_sta_timer(unsigned long data); 856void ieee80211_sta_timer(unsigned long data);
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}
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index f592290e42b9..95753f860acf 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -245,10 +245,6 @@ struct sta_info {
245 unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES]; 245 unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
246#endif 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 * Aggregation information, locked with lock. 249 * Aggregation information, locked with lock.
254 */ 250 */
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 9273651d3d7c..baa1be0671e5 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -761,73 +761,18 @@ ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)
761static ieee80211_tx_result 761static ieee80211_tx_result
762ieee80211_tx_h_stats(struct ieee80211_tx_data *tx) 762ieee80211_tx_h_stats(struct ieee80211_tx_data *tx)
763{ 763{
764 struct ieee80211_local *local = tx->local; 764 int i;
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);
771
772 sband = tx->local->hw.wiphy->bands[tx->channel->band];
773 rate = &sband->bitrates[tx->rate_idx];
774
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 765
800 /* TODO: optimise again */ 766 if (!tx->sta)
801 load += skb->len * CHAN_UTIL_RATE_LCM / rate->bitrate; 767 return TX_CONTINUE;
802 768
769 tx->sta->tx_packets++;
770 tx->sta->tx_fragments++;
771 tx->sta->tx_bytes += tx->skb->len;
803 if (tx->extra_frag) { 772 if (tx->extra_frag) {
804 int i; 773 tx->sta->tx_fragments += tx->num_extra_frag;
805 for (i = 0; i < tx->num_extra_frag; i++) { 774 for (i = 0; i < tx->num_extra_frag; i++)
806 load += 2 * hdrtime; 775 tx->sta->tx_bytes += tx->extra_frag[i]->len;
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 }
831 } 776 }
832 777
833 return TX_CONTINUE; 778 return TX_CONTINUE;