OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org> | 2 * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org> |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or modify | 4 * This program is free software; you can redistribute it and/or modify |
5 * it under the terms of the GNU General Public License version 2 as | 5 * it under the terms of the GNU General Public License version 2 as |
6 * published by the Free Software Foundation. | 6 * published by the Free Software Foundation. |
7 */ | 7 */ |
8 #include <linux/netdevice.h> | 8 #include <linux/netdevice.h> |
9 #include <linux/types.h> | 9 #include <linux/types.h> |
10 #include <linux/skbuff.h> | 10 #include <linux/skbuff.h> |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 int i = 0; | 390 int i = 0; |
391 | 391 |
392 if (!msp->is_ht) | 392 if (!msp->is_ht) |
393 return mac80211_minstrel.tx_status(priv, sband, sta, &msp->legac
y, skb); | 393 return mac80211_minstrel.tx_status(priv, sband, sta, &msp->legac
y, skb); |
394 | 394 |
395 /* This packet was aggregated but doesn't carry status info */ | 395 /* This packet was aggregated but doesn't carry status info */ |
396 if ((info->flags & IEEE80211_TX_CTL_AMPDU) && | 396 if ((info->flags & IEEE80211_TX_CTL_AMPDU) && |
397 !(info->flags & IEEE80211_TX_STAT_AMPDU)) | 397 !(info->flags & IEEE80211_TX_STAT_AMPDU)) |
398 return; | 398 return; |
399 | 399 |
400 » if (!info->status.ampdu_len) { | 400 » if (!(info->flags & IEEE80211_TX_STAT_AMPDU)) { |
401 » » info->status.ampdu_ack_len = 1; | 401 » » info->status.ampdu_ack_len = |
| 402 » » » (info->flags & IEEE80211_TX_STAT_ACK ? 1 : 0); |
402 info->status.ampdu_len = 1; | 403 info->status.ampdu_len = 1; |
403 } | 404 } |
404 | 405 |
405 mi->ampdu_packets++; | 406 mi->ampdu_packets++; |
406 mi->ampdu_len += info->status.ampdu_len; | 407 mi->ampdu_len += info->status.ampdu_len; |
407 | 408 |
408 if (!mi->sample_wait && !mi->sample_tries && mi->sample_count > 0) { | 409 if (!mi->sample_wait && !mi->sample_tries && mi->sample_count > 0) { |
409 mi->sample_wait = 4 + 2 * MINSTREL_TRUNC(mi->avg_ampdu_len); | 410 mi->sample_wait = 4 + 2 * MINSTREL_TRUNC(mi->avg_ampdu_len); |
410 mi->sample_tries = 3; | 411 mi->sample_tries = 3; |
411 mi->sample_count--; | 412 mi->sample_count--; |
412 } | 413 } |
413 | 414 |
414 if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) { | 415 if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) { |
415 mi->sample_packets += info->status.ampdu_len; | 416 mi->sample_packets += info->status.ampdu_len; |
416 minstrel_next_sample_idx(mi); | 417 minstrel_next_sample_idx(mi); |
417 } | 418 } |
418 | 419 |
419 for (i = 0; !last; i++) { | 420 for (i = 0; !last; i++) { |
420 last = (i == IEEE80211_TX_MAX_RATES - 1) || | 421 last = (i == IEEE80211_TX_MAX_RATES - 1) || |
421 !minstrel_ht_txstat_valid(&ar[i + 1]); | 422 !minstrel_ht_txstat_valid(&ar[i + 1]); |
422 | 423 |
423 if (!minstrel_ht_txstat_valid(&ar[i])) | 424 if (!minstrel_ht_txstat_valid(&ar[i])) |
424 break; | 425 break; |
425 | 426 |
426 group = minstrel_ht_get_group_idx(&ar[i]); | 427 group = minstrel_ht_get_group_idx(&ar[i]); |
427 rate = &mi->groups[group].rates[ar[i].idx % 8]; | 428 rate = &mi->groups[group].rates[ar[i].idx % 8]; |
428 | 429 |
429 » » if (last && (info->flags & IEEE80211_TX_STAT_ACK)) | 430 » » if (last) |
430 rate->success += info->status.ampdu_ack_len; | 431 rate->success += info->status.ampdu_ack_len; |
431 | 432 |
432 rate->attempts += ar[i].count * info->status.ampdu_len; | 433 rate->attempts += ar[i].count * info->status.ampdu_len; |
433 } | 434 } |
434 | 435 |
435 /* | 436 /* |
436 * check for sudden death of spatial multiplexing, | 437 * check for sudden death of spatial multiplexing, |
437 * downgrade to a lower number of streams if necessary. | 438 * downgrade to a lower number of streams if necessary. |
438 */ | 439 */ |
439 rate = minstrel_get_ratestats(mi, mi->max_tp_rate); | 440 rate = minstrel_get_ratestats(mi, mi->max_tp_rate); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 { | 819 { |
819 init_sample_table(); | 820 init_sample_table(); |
820 return ieee80211_rate_control_register(&mac80211_minstrel_ht); | 821 return ieee80211_rate_control_register(&mac80211_minstrel_ht); |
821 } | 822 } |
822 | 823 |
823 void | 824 void |
824 rc80211_minstrel_ht_exit(void) | 825 rc80211_minstrel_ht_exit(void) |
825 { | 826 { |
826 ieee80211_rate_control_unregister(&mac80211_minstrel_ht); | 827 ieee80211_rate_control_unregister(&mac80211_minstrel_ht); |
827 } | 828 } |
OLD | NEW |