[Make-wifi-fast] [PATCH v3 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)

Kan Yan kyan at google.com
Thu Oct 10 22:24:07 EDT 2019

> > +/* The per TXQ firmware queue limit in airtime */
> I was pretty sure I mentioned it *somewhere*, but I think just calling
> this "device" or something would be more general. If you don't mind, I
> can edit that also (unless you have other reasons to resubmit?)

done. I will upload a new version to fix coding style issues according
to your comment. Please do help
revise comment as you see fit.

> > + * ieee80211_txq_aql_check - check if a txq can send frame to device
> I wonder if this really should even be have "aql" in the name? It's also
> going to return NULL if there's nothing on the TXQ, for example, right?

Renamed to  ieee80211_txq_airtime_check()
This function is not for finding next eligible txq, but return a
boolean to indicate if a given txq can send more packets to device. It
is also called from ath10k:
static bool ath10k_mac_tx_can_push(struct ieee80211_hw *hw,
                                   struct ieee80211_txq *txq)
        if (!ieee80211_txq_airtime_check(hw, txq))
                return false;

> if (WARN_ONCE(..., "...", ...))
> saves you the braces and the extra condition


> But then again, we don't really care *that* much about overflow or
> underflow in this code path - it's not going to be security critical.
> But it seems that your code there actually can cause UB? That would be
> nice to avoid.
> Actually, that condition can never be true, right? Wait, ok, this one
> can because integer promotion?

 I don't think that condition could happen. The WARN_ONCE() was added
per your earlier comment. The older version don't have underflow check
and reset pending_airtime part and I didn't find any issues.

> Except aql_total_pending_airtime is still defined as s32 and that causes
> different behaviour?
> All this confuses me ... is it possible to write this more clearly?

I revised it to something similar to the original version, which
ieee80211_sta_update_pending_airtime() takes extra parameter to
indicate whether it is for a tx completion event.
void ieee80211_sta_update_pending_airtime(struct ieee80211_sta *pubsta, u8 tid,
                                          u32 tx_airtime, bool tx_completed)
This help get rid of the problem that airtime need be signed. Also
added the inline function of
ieee80211_sta_register/release_pending_airtime() as you suggested.

On Thu, Oct 10, 2019 at 1:12 PM Toke Høiland-Jørgensen <toke at redhat.com> wrote:
> Johannes Berg <johannes at sipsolutions.net> writes:
> > Hi,
> >
> > A couple of points...
> >
> > First, I'd like Toke to review & ack this if possible :-)
> Sure, I'll look at it. I'm away the rest of this week, but should
> hopefully get some more time next week. It may be that it will take the
> form of another submission that integrates this with the previous patch
> I sent that put more of the calculation into mac80211 itself...
> -Toke

More information about the Make-wifi-fast mailing list