From: Dan Carpenter <error27@gmail.com>
To: Felix Fietkau <nbd@nbd.name>
Cc: linux-wireless@vger.kernel.org
Subject: [bug report] wifi: mac80211: factor out part of ieee80211_calc_expected_tx_airtime
Date: Sat, 8 Aug 2026 22:42:12 +0300 [thread overview]
Message-ID: <aneGlCMVnqRhlf6p@stanley.mountain> (raw)
Hello Felix Fietkau,
Commit 094dc1619cb0 ("wifi: mac80211: factor out part of
ieee80211_calc_expected_tx_airtime") from Jul 24, 2026 (linux-next),
leads to the following Smatch static checker warning:
net/mac80211/airtime.c:798 ieee80211_rate_expected_tx_airtime()
error: uninitialized symbol 'overhead'.
net/mac80211/airtime.c
756 u32 ieee80211_rate_expected_tx_airtime(struct ieee80211_hw *hw,
757 struct ieee80211_tx_rate *tx_rate,
758 struct rate_info *ri,
759 enum nl80211_band band,
760 bool ampdu, int len)
761 {
762 struct ieee80211_rx_status stat;
763 u32 duration, overhead;
764 u8 agg_shift;
765
766 if (ieee80211_fill_rx_status(&stat, hw, tx_rate, ri, band, len))
767 return 0;
768
769 if (stat.encoding == RX_ENC_LEGACY || !ampdu)
770 return ieee80211_calc_rx_airtime(hw, &stat, len) * 1024;
771
772 duration = ieee80211_get_rate_duration(hw, &stat, &overhead);
All but one of the return paths which don't initialize "overhead" have
a WARN_ON_ONCE(), but it would be nice to initialize overhead...
773
774 /*
775 * Assume that HT/VHT transmission on any AC except VO will
776 * use aggregation. Since we don't have reliable reporting
777 * of aggregation length, assume an average size based on the
778 * tx rate.
779 * This will not be very accurate, but much better than simply
780 * assuming un-aggregated tx in all cases.
781 */
782 if (duration > 400 * 1024) /* <= VHT20 MCS2 1S */
783 agg_shift = 1;
784 else if (duration > 250 * 1024) /* <= VHT20 MCS3 1S or MCS1 2S */
785 agg_shift = 2;
786 else if (duration > 150 * 1024) /* <= VHT20 MCS5 1S or MCS2 2S */
787 agg_shift = 3;
788 else if (duration > 70 * 1024) /* <= VHT20 MCS5 2S */
789 agg_shift = 4;
790 else if (stat.encoding != RX_ENC_HE ||
791 duration > 20 * 1024) /* <= HE40 MCS6 2S */
792 agg_shift = 5;
793 else
794 agg_shift = 6;
795
796 duration *= len;
797 duration /= AVG_PKT_SIZE;
--> 798 duration += (overhead * 1024 >> agg_shift);
799
800 return duration;
801 }
This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter
reply other threads:[~2026-08-08 19:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aneGlCMVnqRhlf6p@stanley.mountain \
--to=error27@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=nbd@nbd.name \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox