Felix Fietkau <nbd@xxxxxxxx> writes: > On 2019-09-27 10:35, Toke Høiland-Jørgensen wrote: >> Felix Fietkau <nbd@xxxxxxxx> writes: >>> + switch (status->encoding) { >>> + case RX_ENC_LEGACY: >>> + if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ)) >>> + return 0; >>> + >>> + sband = dev->hw->wiphy->bands[status->band]; >>> + if (!sband || status->rate_idx > sband->n_bitrates) >>> + return 0; >>> + >>> + rate = &sband->bitrates[status->rate_idx]; >>> + >>> + return mt76_calc_legacy_rate_duration(rate, sp, len); >>> + case RX_ENC_VHT: >>> + streams = status->nss; >>> + idx = status->rate_idx; >>> + group = VHT_GROUP_IDX(streams, sgi, bw); >>> + break; >>> + case RX_ENC_HT: >>> + streams = ((status->rate_idx >> 3) & 3) + 1; >>> + idx = status->rate_idx & 7; >>> + group = HT_GROUP_IDX(streams, sgi, bw); >>> + break; >>> + default: >>> + WARN_ON_ONCE(1); >>> + return 0; >>> + } >>> + >>> + if (WARN_ON_ONCE(streams > 4)) >>> + return 0; >>> + >>> + duration = airtime_mcs_groups[group].duration[idx]; >>> + duration <<= airtime_mcs_groups[group].shift; >>> + duration *= len; >>> + duration /= AVG_PKT_SIZE; >>> + duration /= 1024; >> >> On an earlier patch of mine you expressed concern over divisions in the >> fast path. Does this mean this is no longer a concern? Or is the >> compiler doing fancy things with the constant division here? :) > I made the constants power-of-2, so that the compiler can turn them into > bit shifts. I verified the disassembly: no divisions left in the code. I see. Neat :) There's still a regular division in the legacy rate calc further up, though, right? But I guess that doesn't happen so often? -Toke