aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
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/tx.c
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/tx.c')
-rw-r--r--net/mac80211/tx.c73
1 files changed, 9 insertions, 64 deletions
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;