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

Toke Høiland-Jørgensen toke at redhat.com
Wed Nov 13 09:02:13 EST 2019

Kan Yan <kyan at google.com> writes:

> Thanks for the review. I will pick up your new patches and give it a
> try tomorrow.
>> Why is this setting sta and device limits to the same value?
> local->aql_txq_limit_low is not the per device limit, but the default
> txq_limit for all STAs. Individual stations can be configured with
> non-default value via debugfs entry
> "netdev:interface_name_x/stations/mac_addr_x/airtime". "aql_threshold"
> is the device limit for switching between the lower and higher per
> station queue limit.

Oh, right, I see. But in that case, should writing the default really
stomp on all the per-station values? If I set the value of a station, I
wouldn't expect it to change just because I changed the default value

>> Also, are you sure we won't risk write tearing when writing 32-bit
>> values without locking on some architectures?
> Does mac80211 ever runs in any 16-bit architectures? Even in an
> architecture that write to 32-bit value is not atomic, I don't think
> there is any side-effect for queue limit get wrong transiently in rare
> occasions. Besides, the practical value of those queue limits should
> always fit into 16 bits.

I'm not sure about the platform characteristics of all the weird tiny
MIPS boxes that run OpenWrt; which is why I'm vary of making any
assumptions that it is safe :)

But yeah, I suppose you're right that since we're just setting the
limit, it is not going to be a huge concern here...

>> I don't think this is right; another thread could do atomic_inc()
>> between the atomic_read() and atomic_set() here, in which case this
>> would clobber the other value.
>> I think to get this right the logic would need to be something like
>> this:
>> retry:
>>   old = atomic_read(&sta->airtime[ac].aql_tx_pending);
>>   if (warn_once(tx_airtime > old))
>>      new = 0;
>>   else
>>      new = old - tx_airtime;
>>   if (atomic_cmpxchg(&sta->airtime[ac].aql_tx_pending, old, new) != old)
>>      goto retry;
>> (or use an equivalent do/while).
> That's indeed not right. However, if a potential aql_tx_pending
> underflow case is detected here (It should never happen), reset it to
> 0 maybe not the best remedy anyway. I think it is better  just
> WARN_ONCE() and skip updating aql_tx_pending all together, so the
> retry or loop can be avoided here. What do you think?

If we don't reset the value to zero may end up with a device that is
unable to transmit. Better to reset it I think, even if this is never
supposed to happen...


More information about the Make-wifi-fast mailing list