Lines Matching +full:rates +full:- +full:cck
1 // SPDX-License-Identifier: ISC
4 * Copyright (C) 2021-2022 Intel Corporation
16 /* Number of kilo-symbols (symbols * 1024) for a packet with (bps) bits per
17 * symbol. We use k-symbols to avoid rounding in the _TIME macros below.
42 /* Transmission time (1024 usec) for a packet containing (ksyms) * k-symbols */
64 * Define group sort order: HT40 -> SGI -> #streams
87 _streams - 1
92 _MAX(0, 16 - __builtin_clz(duration))
121 (_streams) - 1)
166 (_streams) - 1)
383 bool cck, int len) in ieee80211_calc_legacy_rate_duration() argument
387 if (cck) { in ieee80211_calc_legacy_rate_duration()
407 bool sgi = status->enc_flags & RX_ENC_FLAG_SHORT_GI; in ieee80211_get_rate_duration()
412 switch (status->bw) { in ieee80211_get_rate_duration()
430 switch (status->encoding) { in ieee80211_get_rate_duration()
432 streams = status->nss; in ieee80211_get_rate_duration()
433 idx = status->rate_idx; in ieee80211_get_rate_duration()
437 streams = ((status->rate_idx >> 3) & 3) + 1; in ieee80211_get_rate_duration()
438 idx = status->rate_idx & 7; in ieee80211_get_rate_duration()
442 streams = status->nss; in ieee80211_get_rate_duration()
443 idx = status->rate_idx; in ieee80211_get_rate_duration()
444 group = HE_GROUP_IDX(streams, status->he_gi, bw); in ieee80211_get_rate_duration()
451 if (WARN_ON_ONCE((status->encoding != RX_ENC_HE && streams > 4) || in ieee80211_get_rate_duration()
452 (status->encoding == RX_ENC_HE && streams > 8))) in ieee80211_get_rate_duration()
473 if (status->encoding == RX_ENC_LEGACY) { in ieee80211_calc_rx_airtime()
475 bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE; in ieee80211_calc_rx_airtime()
476 bool cck; in ieee80211_calc_rx_airtime() local
478 /* on 60GHz or sub-1GHz band, there are no legacy rates */ in ieee80211_calc_rx_airtime()
479 if (WARN_ON_ONCE(status->band == NL80211_BAND_60GHZ || in ieee80211_calc_rx_airtime()
480 status->band == NL80211_BAND_S1GHZ)) in ieee80211_calc_rx_airtime()
483 sband = hw->wiphy->bands[status->band]; in ieee80211_calc_rx_airtime()
484 if (!sband || status->rate_idx >= sband->n_bitrates) in ieee80211_calc_rx_airtime()
487 rate = &sband->bitrates[status->rate_idx]; in ieee80211_calc_rx_airtime()
488 cck = rate->flags & IEEE80211_RATE_MANDATORY_B; in ieee80211_calc_rx_airtime()
490 return ieee80211_calc_legacy_rate_duration(rate->bitrate, sp, in ieee80211_calc_rx_airtime()
491 cck, len); in ieee80211_calc_rx_airtime()
510 struct ieee80211_supported_band *sband = hw->wiphy->bands[band]; in ieee80211_fill_rate_info()
516 stat->bw = ri->bw; in ieee80211_fill_rate_info()
517 stat->nss = ri->nss; in ieee80211_fill_rate_info()
518 stat->rate_idx = ri->mcs; in ieee80211_fill_rate_info()
520 if (ri->flags & RATE_INFO_FLAGS_HE_MCS) in ieee80211_fill_rate_info()
521 stat->encoding = RX_ENC_HE; in ieee80211_fill_rate_info()
522 else if (ri->flags & RATE_INFO_FLAGS_VHT_MCS) in ieee80211_fill_rate_info()
523 stat->encoding = RX_ENC_VHT; in ieee80211_fill_rate_info()
524 else if (ri->flags & RATE_INFO_FLAGS_MCS) in ieee80211_fill_rate_info()
525 stat->encoding = RX_ENC_HT; in ieee80211_fill_rate_info()
527 stat->encoding = RX_ENC_LEGACY; in ieee80211_fill_rate_info()
529 if (ri->flags & RATE_INFO_FLAGS_SHORT_GI) in ieee80211_fill_rate_info()
530 stat->enc_flags |= RX_ENC_FLAG_SHORT_GI; in ieee80211_fill_rate_info()
532 stat->he_gi = ri->he_gi; in ieee80211_fill_rate_info()
534 if (stat->encoding != RX_ENC_LEGACY) in ieee80211_fill_rate_info()
537 stat->rate_idx = 0; in ieee80211_fill_rate_info()
538 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_fill_rate_info()
539 if (ri->legacy != sband->bitrates[i].bitrate) in ieee80211_fill_rate_info()
542 stat->rate_idx = i; in ieee80211_fill_rate_info()
555 stat->band = band; in ieee80211_fill_rx_status()
560 if (rate->idx < 0 || !rate->count) in ieee80211_fill_rx_status()
561 return -1; in ieee80211_fill_rx_status()
563 if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH) in ieee80211_fill_rx_status()
564 stat->bw = RATE_INFO_BW_160; in ieee80211_fill_rx_status()
565 else if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) in ieee80211_fill_rx_status()
566 stat->bw = RATE_INFO_BW_80; in ieee80211_fill_rx_status()
567 else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) in ieee80211_fill_rx_status()
568 stat->bw = RATE_INFO_BW_40; in ieee80211_fill_rx_status()
570 stat->bw = RATE_INFO_BW_20; in ieee80211_fill_rx_status()
572 stat->enc_flags = 0; in ieee80211_fill_rx_status()
573 if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) in ieee80211_fill_rx_status()
574 stat->enc_flags |= RX_ENC_FLAG_SHORTPRE; in ieee80211_fill_rx_status()
575 if (rate->flags & IEEE80211_TX_RC_SHORT_GI) in ieee80211_fill_rx_status()
576 stat->enc_flags |= RX_ENC_FLAG_SHORT_GI; in ieee80211_fill_rx_status()
578 stat->rate_idx = rate->idx; in ieee80211_fill_rx_status()
579 if (rate->flags & IEEE80211_TX_RC_VHT_MCS) { in ieee80211_fill_rx_status()
580 stat->encoding = RX_ENC_VHT; in ieee80211_fill_rx_status()
581 stat->rate_idx = ieee80211_rate_get_vht_mcs(rate); in ieee80211_fill_rx_status()
582 stat->nss = ieee80211_rate_get_vht_nss(rate); in ieee80211_fill_rx_status()
583 } else if (rate->flags & IEEE80211_TX_RC_MCS) { in ieee80211_fill_rx_status()
584 stat->encoding = RX_ENC_HT; in ieee80211_fill_rx_status()
586 stat->encoding = RX_ENC_LEGACY; in ieee80211_fill_rx_status()
612 for (i = 0; i < ARRAY_SIZE(info->status.rates); i++) { in ieee80211_calc_tx_airtime()
613 struct ieee80211_tx_rate *rate = &info->status.rates[i]; in ieee80211_calc_tx_airtime()
617 info->band, len); in ieee80211_calc_tx_airtime()
621 duration += cur_duration * rate->count; in ieee80211_calc_tx_airtime()
636 bool cck, short_pream; in ieee80211_calc_expected_tx_airtime() local
643 conf = rcu_dereference(vif->bss_conf.chanctx_conf); in ieee80211_calc_expected_tx_airtime()
645 band = conf->def.chan->band; in ieee80211_calc_expected_tx_airtime()
646 shift = ieee80211_chandef_get_shift(&conf->def); in ieee80211_calc_expected_tx_airtime()
653 struct ieee80211_tx_rate *tx_rate = &sta->deflink.tx_stats.last_rate; in ieee80211_calc_expected_tx_airtime()
654 struct rate_info *ri = &sta->deflink.tx_stats.last_rate_info; in ieee80211_calc_expected_tx_airtime()
671 * assuming un-aggregated tx in all cases. in ieee80211_calc_expected_tx_airtime()
698 /* No station to get latest rate from, so calculate the worst-case in ieee80211_calc_expected_tx_airtime()
701 sband = hw->wiphy->bands[band]; in ieee80211_calc_expected_tx_airtime()
703 basic_rates = vif->bss_conf.basic_rates; in ieee80211_calc_expected_tx_airtime()
704 short_pream = vif->bss_conf.use_short_preamble; in ieee80211_calc_expected_tx_airtime()
706 rateidx = basic_rates ? ffs(basic_rates) - 1 : 0; in ieee80211_calc_expected_tx_airtime()
707 rate = sband->bitrates[rateidx].bitrate << shift; in ieee80211_calc_expected_tx_airtime()
708 cck = sband->bitrates[rateidx].flags & IEEE80211_RATE_MANDATORY_B; in ieee80211_calc_expected_tx_airtime()
710 return ieee80211_calc_legacy_rate_duration(rate, short_pream, cck, len); in ieee80211_calc_expected_tx_airtime()