Lines Matching +full:in +full:- +full:band +full:- +full:status
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.
21 /* Transmission time (in 1024 * usec) for a packet containing (ksyms) * 1024
37 /* These should match the values in enum nl80211_he_gi */
42 /* Transmission time (1024 usec) for a packet containing (ksyms) * k-symbols */
58 /* gi in HE/EHT is identical. It matches enum nl80211_eht_gi as well */
75 * Define group sort order: HT40 -> SGI -> #streams
107 _streams - 1
112 _MAX(0, 16 - __builtin_clz(duration))
141 (_streams) - 1)
186 (_streams) - 1)
234 (_streams) - 1)
507 struct ieee80211_rx_status *status, in ieee80211_get_rate_duration() argument
510 bool sgi = status->enc_flags & RX_ENC_FLAG_SHORT_GI; in ieee80211_get_rate_duration()
515 switch (status->bw) { in ieee80211_get_rate_duration()
536 switch (status->encoding) { in ieee80211_get_rate_duration()
538 streams = status->nss; in ieee80211_get_rate_duration()
539 idx = status->rate_idx; in ieee80211_get_rate_duration()
543 streams = ((status->rate_idx >> 3) & 3) + 1; in ieee80211_get_rate_duration()
544 idx = status->rate_idx & 7; in ieee80211_get_rate_duration()
548 streams = status->nss; in ieee80211_get_rate_duration()
549 idx = status->rate_idx; in ieee80211_get_rate_duration()
550 group = HE_GROUP_IDX(streams, status->he_gi, bw); in ieee80211_get_rate_duration()
553 streams = status->nss; in ieee80211_get_rate_duration()
554 idx = status->rate_idx; in ieee80211_get_rate_duration()
555 group = EHT_GROUP_IDX(streams, status->eht.gi, bw); in ieee80211_get_rate_duration()
562 switch (status->encoding) { in ieee80211_get_rate_duration()
586 struct ieee80211_rx_status *status, in ieee80211_calc_rx_airtime() argument
592 if (status->encoding == RX_ENC_LEGACY) { in ieee80211_calc_rx_airtime()
594 bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE; in ieee80211_calc_rx_airtime()
597 /* on 60GHz or sub-1GHz band, there are no legacy rates */ in ieee80211_calc_rx_airtime()
598 if (WARN_ON_ONCE(status->band == NL80211_BAND_60GHZ || in ieee80211_calc_rx_airtime()
599 status->band == NL80211_BAND_S1GHZ)) in ieee80211_calc_rx_airtime()
602 sband = hw->wiphy->bands[status->band]; in ieee80211_calc_rx_airtime()
603 if (!sband || status->rate_idx >= sband->n_bitrates) in ieee80211_calc_rx_airtime()
606 rate = &sband->bitrates[status->rate_idx]; in ieee80211_calc_rx_airtime()
607 cck = rate->flags & IEEE80211_RATE_MANDATORY_B; in ieee80211_calc_rx_airtime()
609 return ieee80211_calc_legacy_rate_duration(rate->bitrate, sp, in ieee80211_calc_rx_airtime()
613 duration = ieee80211_get_rate_duration(hw, status, &overhead); in ieee80211_calc_rx_airtime()
626 struct ieee80211_rx_status *stat, u8 band, in ieee80211_fill_rate_info() argument
629 struct ieee80211_supported_band *sband = hw->wiphy->bands[band]; in ieee80211_fill_rate_info()
635 stat->bw = ri->bw; in ieee80211_fill_rate_info()
636 stat->nss = ri->nss; in ieee80211_fill_rate_info()
637 stat->rate_idx = ri->mcs; in ieee80211_fill_rate_info()
639 if (ri->flags & RATE_INFO_FLAGS_EHT_MCS) in ieee80211_fill_rate_info()
640 stat->encoding = RX_ENC_EHT; in ieee80211_fill_rate_info()
641 else if (ri->flags & RATE_INFO_FLAGS_HE_MCS) in ieee80211_fill_rate_info()
642 stat->encoding = RX_ENC_HE; in ieee80211_fill_rate_info()
643 else if (ri->flags & RATE_INFO_FLAGS_VHT_MCS) in ieee80211_fill_rate_info()
644 stat->encoding = RX_ENC_VHT; in ieee80211_fill_rate_info()
645 else if (ri->flags & RATE_INFO_FLAGS_MCS) in ieee80211_fill_rate_info()
646 stat->encoding = RX_ENC_HT; in ieee80211_fill_rate_info()
648 stat->encoding = RX_ENC_LEGACY; in ieee80211_fill_rate_info()
650 if (ri->flags & RATE_INFO_FLAGS_SHORT_GI) in ieee80211_fill_rate_info()
651 stat->enc_flags |= RX_ENC_FLAG_SHORT_GI; in ieee80211_fill_rate_info()
653 switch (stat->encoding) { in ieee80211_fill_rate_info()
655 stat->eht.gi = ri->eht_gi; in ieee80211_fill_rate_info()
658 stat->he_gi = ri->he_gi; in ieee80211_fill_rate_info()
662 if (stat->encoding != RX_ENC_LEGACY) in ieee80211_fill_rate_info()
665 stat->rate_idx = 0; in ieee80211_fill_rate_info()
666 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_fill_rate_info()
667 if (ri->legacy != sband->bitrates[i].bitrate) in ieee80211_fill_rate_info()
670 stat->rate_idx = i; in ieee80211_fill_rate_info()
680 struct rate_info *ri, u8 band, int len) in ieee80211_fill_rx_status() argument
683 stat->band = band; in ieee80211_fill_rx_status()
685 if (ieee80211_fill_rate_info(hw, stat, band, ri)) in ieee80211_fill_rx_status()
689 return -1; in ieee80211_fill_rx_status()
691 if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH) in ieee80211_fill_rx_status()
692 stat->bw = RATE_INFO_BW_160; in ieee80211_fill_rx_status()
693 else if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) in ieee80211_fill_rx_status()
694 stat->bw = RATE_INFO_BW_80; in ieee80211_fill_rx_status()
695 else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) in ieee80211_fill_rx_status()
696 stat->bw = RATE_INFO_BW_40; in ieee80211_fill_rx_status()
698 stat->bw = RATE_INFO_BW_20; in ieee80211_fill_rx_status()
700 stat->enc_flags = 0; in ieee80211_fill_rx_status()
701 if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) in ieee80211_fill_rx_status()
702 stat->enc_flags |= RX_ENC_FLAG_SHORTPRE; in ieee80211_fill_rx_status()
703 if (rate->flags & IEEE80211_TX_RC_SHORT_GI) in ieee80211_fill_rx_status()
704 stat->enc_flags |= RX_ENC_FLAG_SHORT_GI; in ieee80211_fill_rx_status()
706 stat->rate_idx = rate->idx; in ieee80211_fill_rx_status()
707 if (rate->flags & IEEE80211_TX_RC_VHT_MCS) { in ieee80211_fill_rx_status()
708 stat->encoding = RX_ENC_VHT; in ieee80211_fill_rx_status()
709 stat->rate_idx = ieee80211_rate_get_vht_mcs(rate); in ieee80211_fill_rx_status()
710 stat->nss = ieee80211_rate_get_vht_nss(rate); in ieee80211_fill_rx_status()
711 } else if (rate->flags & IEEE80211_TX_RC_MCS) { in ieee80211_fill_rx_status()
712 stat->encoding = RX_ENC_HT; in ieee80211_fill_rx_status()
714 stat->encoding = RX_ENC_LEGACY; in ieee80211_fill_rx_status()
723 u8 band, int len) in ieee80211_calc_tx_airtime_rate() argument
727 if (ieee80211_fill_rx_status(&stat, hw, rate, ri, band, len)) in ieee80211_calc_tx_airtime_rate()
740 for (i = 0; i < ARRAY_SIZE(info->status.rates); i++) { in ieee80211_calc_tx_airtime()
741 struct ieee80211_tx_rate *rate = &info->status.rates[i]; in ieee80211_calc_tx_airtime()
745 info->band, len); in ieee80211_calc_tx_airtime()
749 duration += cur_duration * rate->count; in ieee80211_calc_tx_airtime()
766 u8 band = 0; in ieee80211_calc_expected_tx_airtime() local
771 conf = rcu_dereference(vif->bss_conf.chanctx_conf); in ieee80211_calc_expected_tx_airtime()
773 band = conf->def.chan->band; in ieee80211_calc_expected_tx_airtime()
779 struct ieee80211_tx_rate *tx_rate = &sta->deflink.tx_stats.last_rate; in ieee80211_calc_expected_tx_airtime()
780 struct rate_info *ri = &sta->deflink.tx_stats.last_rate_info; in ieee80211_calc_expected_tx_airtime()
784 if (ieee80211_fill_rx_status(&stat, hw, tx_rate, ri, band, len)) in ieee80211_calc_expected_tx_airtime()
797 * assuming un-aggregated tx in all cases. in ieee80211_calc_expected_tx_airtime()
824 /* No station to get latest rate from, so calculate the worst-case in ieee80211_calc_expected_tx_airtime()
827 sband = hw->wiphy->bands[band]; in ieee80211_calc_expected_tx_airtime()
829 basic_rates = vif->bss_conf.basic_rates; in ieee80211_calc_expected_tx_airtime()
830 short_pream = vif->bss_conf.use_short_preamble; in ieee80211_calc_expected_tx_airtime()
832 rateidx = basic_rates ? ffs(basic_rates) - 1 : 0; in ieee80211_calc_expected_tx_airtime()
833 rate = sband->bitrates[rateidx].bitrate; in ieee80211_calc_expected_tx_airtime()
834 cck = sband->bitrates[rateidx].flags & IEEE80211_RATE_MANDATORY_B; in ieee80211_calc_expected_tx_airtime()