All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] wifi: mac80211: factor out part of ieee80211_calc_expected_tx_airtime
@ 2026-08-08 19:42 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2026-08-08 19:42 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-08 19:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-08 19:42 [bug report] wifi: mac80211: factor out part of ieee80211_calc_expected_tx_airtime Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.