From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Kan Yan <kyan@google.com>, johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
make-wifi-fast@lists.bufferbloat.net, nbd@nbd.name,
yiboz@codeaurora.org, john@phrozen.org, lorenzo@kernel.org,
rmanohar@codeaurora.org, kevinhayes@google.com,
Kan Yan <kyan@google.com>
Subject: Re: [v8 PATCH 2/2] mac80211: Implement Airtime-based Queue Limit (AQL)
Date: Fri, 15 Nov 2019 13:56:04 +0100 [thread overview]
Message-ID: <87k181mh7f.fsf@toke.dk> (raw)
In-Reply-To: <20191115014846.126007-3-kyan@google.com>
Kan Yan <kyan@google.com> writes:
> In order for the Fq_CoDel algorithm integrated in mac80211 layer to operate
> effectively to control excessive queueing latency, the CoDel algorithm
> requires an accurate measure of how long packets stays in the queue, AKA
> sojourn time. The sojourn time measured at the mac80211 layer doesn't
> include queueing latency in the lower layer (firmware/hardware) and CoDel
> expects lower layer to have a short queue. However, most 802.11ac chipsets
> offload tasks such TX aggregation to firmware or hardware, thus have a deep
> lower layer queue.
>
> Without a mechanism to control the lower layer queue size, packets only
> stay in mac80211 layer transiently before being sent to firmware queue.
> As a result, the sojourn time measured by CoDel in the mac80211 layer is
> almost always lower than the CoDel latency target, hence CoDel does little
> to control the latency, even when the lower layer queue causes excessive
> latency.
>
> The Byte Queue Limits (BQL) mechanism is commonly used to address the
> similar issue with wired network interface. However, this method cannot be
> applied directly to the wireless network interface. "Bytes" is not a
> suitable measure of queue depth in the wireless network, as the data rate
> can vary dramatically from station to station in the same network, from a
> few Mbps to over Gbps.
>
> This patch implements an Airtime-based Queue Limit (AQL) to make CoDel work
> effectively with wireless drivers that utilized firmware/hardware
> offloading. AQL allows each txq to release just enough packets to the lower
> layer to form 1-2 large aggregations to keep hardware fully utilized and
> retains the rest of the frames in mac80211 layer to be controlled by the
> CoDel algorithm.
>
> Signed-off-by: Kan Yan <kyan@google.com>
> [ Toke: Keep API to set pending airtime internal, fix nits in commit msg ]
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---
[...]
> + if (sta) {
> + atomic_sub(tx_airtime, &sta->airtime[ac].aql_tx_pending);
> + tx_pending = atomic_read(&sta->airtime[ac].aql_tx_pending);
This is still racy, since you're splitting it over two calls; you'll
need to use atomic_sub_return() instead.
I figure we've converged now to the point where it actually makes sense
to collect everything back into a single series; so I can just fix this
and re-send the full series.
> + if (WARN_ONCE(tx_pending < 0,
> + "STA %pM AC %d txq pending airtime underflow: %u, %u",
> + sta->addr, ac, tx_pending, tx_airtime))
> + atomic_cmpxchg(&sta->airtime[ac].aql_tx_pending,
> + tx_pending, 0);
This could still fail if there's a concurrent modification (and you're
not checking the return of the cmpxchg). But at least it won't clobber
any updated value, so I guess that is acceptable since we're in "should
never happen" territory here :)
-Toke
next prev parent reply other threads:[~2019-11-15 12:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-15 1:48 [PATCH v8 0/2] Implement Airtime-based Queue Limit (AQL) Kan Yan
2019-11-15 1:48 ` [v8 PATCH 1/2] mac80211: Import airtime calculation code from mt76 Kan Yan
2019-11-15 1:48 ` [v8 PATCH 2/2] mac80211: Implement Airtime-based Queue Limit (AQL) Kan Yan
2019-11-15 12:56 ` Toke Høiland-Jørgensen [this message]
2019-11-16 2:21 ` Kan Yan
2019-11-15 2:04 ` [PATCH v8 0/2] " Kan Yan
2019-11-15 2:07 ` [Make-wifi-fast] " Dave Taht
[not found] ` <CA+iem5s4ZY239Q4=Gwy3WrmVhcdhesirXph6XQoOP5w-nuWcYw@mail.gmail.com>
2019-11-18 21:08 ` Dave Taht
2019-11-20 0:40 ` Kan Yan
2019-11-20 10:14 ` Toke Høiland-Jørgensen
2019-11-21 2:05 ` Kan Yan
2019-11-21 10:05 ` Toke Høiland-Jørgensen
[not found] ` <CA+iem5tNz2jjEOVmbh3aPTXLLZfkRjZ60-+bon1vDEJ8D4hQJw@mail.gmail.com>
2019-11-22 10:45 ` Toke Høiland-Jørgensen
2019-11-26 5:04 ` Kan Yan
2019-11-26 9:19 ` Toke Høiland-Jørgensen
2019-11-27 2:13 ` Dave Taht
2019-12-03 19:02 ` Kan Yan
2019-12-04 4:47 ` Kalle Valo
[not found] ` <0101016ecf3bc899-6e391bba-96ed-4495-a7be-1aa8dd8f1bf2-000000@us-west-2.amazonses.com>
2019-12-04 8:07 ` Johannes Berg
2019-12-04 14:34 ` Toke Høiland-Jørgensen
2019-12-06 19:53 ` Dave Taht
2019-12-06 22:04 ` Kan Yan
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=87k181mh7f.fsf@toke.dk \
--to=toke@redhat.com \
--cc=johannes@sipsolutions.net \
--cc=john@phrozen.org \
--cc=kevinhayes@google.com \
--cc=kyan@google.com \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=make-wifi-fast@lists.bufferbloat.net \
--cc=nbd@nbd.name \
--cc=rmanohar@codeaurora.org \
--cc=yiboz@codeaurora.org \
/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 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.