From: Dave Taht <dave.taht@gmail.com>
To: Michal Kazior <michal.kazior@tieto.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
Johannes Berg <johannes@sipsolutions.net>,
make-wifi-fast@lists.bufferbloat.net,
"codel@lists.bufferbloat.net" <codel@lists.bufferbloat.net>,
Avery Pennarun <apenwarr@gmail.com>
Subject: Re: [Make-wifi-fast] [PATCHv4 4/5] mac80211: implement codel on fair queuing flows
Date: Thu, 5 May 2016 08:30:32 -0700 [thread overview]
Message-ID: <CAA93jw6eLwiykgbxdJjy0-bRjAQEgR-E6kpM3EDKnyFcBhu+5w@mail.gmail.com> (raw)
In-Reply-To: <1462446039-1070-5-git-send-email-michal.kazior@tieto.com>
On Thu, May 5, 2016 at 4:00 AM, Michal Kazior <michal.kazior@tieto.com> wrote:
> There is no other limit other than a global
> packet count limit when using software queuing.
> This means a single flow queue can grow insanely
> long. This is particularly bad for TCP congestion
> algorithms which requires a little more
> sophisticated frame dropping scheme than a mere
> headdrop on limit overflow.
>
> Hence apply (a slighly modified, to fit the knobs)
> CoDel5 on flow queues. This improves TCP
> convergence and stability when combined with
> wireless driver which keeps its own tx queue/fifo
> at a minimum fill level for given link conditions.
>
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
> ---
>
> Notes:
> v4:
> * removed internal codel.h and re-used in-kernel one
>
> include/net/mac80211.h | 14 +++++-
> net/mac80211/ieee80211_i.h | 5 +++
> net/mac80211/tx.c | 109 ++++++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 126 insertions(+), 2 deletions(-)
>
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index ffb90dfe0d70..cc534f1b0f8e 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -21,6 +21,7 @@
> #include <linux/skbuff.h>
> #include <linux/ieee80211.h>
> #include <net/cfg80211.h>
> +#include <net/codel.h>
> #include <asm/unaligned.h>
>
> /**
> @@ -895,7 +896,18 @@ struct ieee80211_tx_info {
> unsigned long jiffies;
> };
> /* NB: vif can be NULL for injected frames */
> - struct ieee80211_vif *vif;
> + union {
> + /* NB: vif can be NULL for injected frames */
> + struct ieee80211_vif *vif;
> +
> + /* When packets are enqueued on txq it's easy
> + * to re-construct the vif pointer. There's no
> + * more space in tx_info so it can be used to
> + * store the necessary enqueue time for packet
> + * sojourn time computation.
> + */
> + codel_time_t enqueue_time;
> + };
Can't the skb->timestamp be used instead? (or does that still stomp on tcp)
(my longstanding dream of course has been to always timestamp coming
off the rx ring, and to not have to do it on entrance to the codel
enqueue routine here. It adds measuring total system processing time
to the queue measurement, allows for offloaded timestamping, etc, but
did involve changing all of linux to use it)
> struct ieee80211_key_conf *hw_key;
> u32 flags;
> /* 4 bytes free */
> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
> index 6f8375f1df88..54edfb6fc1d1 100644
> --- a/net/mac80211/ieee80211_i.h
> +++ b/net/mac80211/ieee80211_i.h
> @@ -812,10 +812,12 @@ enum txq_info_flags {
> * @tin: contains packets split into multiple flows
> * @def_flow: used as a fallback flow when a packet destined to @tin hashes to
> * a fq_flow which is already owned by a different tin
> + * @def_cvars: codel vars for @def_flow
> */
> struct txq_info {
> struct fq_tin tin;
> struct fq_flow def_flow;
> + struct codel_vars def_cvars;
> unsigned long flags;
>
> /* keep last! */
> @@ -1108,6 +1110,9 @@ struct ieee80211_local {
> struct ieee80211_hw hw;
>
> struct fq fq;
> + struct codel_vars *cvars;
> + struct codel_params cparams;
> + struct codel_stats cstats;
>
> const struct ieee80211_ops *ops;
>
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index 47936b939591..013b382f6888 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -25,6 +25,8 @@
> #include <net/ieee80211_radiotap.h>
> #include <net/cfg80211.h>
> #include <net/mac80211.h>
> +#include <net/codel.h>
> +#include <net/codel_impl.h>
> #include <asm/unaligned.h>
> #include <net/fq_impl.h>
>
> @@ -1269,11 +1271,92 @@ static struct txq_info *ieee80211_get_txq(struct ieee80211_local *local,
> return NULL;
> }
>
> +static void ieee80211_set_skb_enqueue_time(struct sk_buff *skb)
> +{
> + IEEE80211_SKB_CB(skb)->control.enqueue_time = codel_get_time();
> +}
> +
> +static void ieee80211_set_skb_vif(struct sk_buff *skb, struct txq_info *txqi)
> +{
> + IEEE80211_SKB_CB(skb)->control.vif = txqi->txq.vif;
> +}
> +
> +static u32 codel_skb_len_func(const struct sk_buff *skb)
> +{
> + return skb->len;
> +}
> +
> +static codel_time_t codel_skb_time_func(const struct sk_buff *skb)
> +{
> + const struct ieee80211_tx_info *info;
> +
> + info = (const struct ieee80211_tx_info *)skb->cb;
> + return info->control.enqueue_time;
> +}
> +
> +static struct sk_buff *codel_dequeue_func(struct codel_vars *cvars,
> + void *ctx)
> +{
> + struct ieee80211_local *local;
> + struct txq_info *txqi;
> + struct fq *fq;
> + struct fq_flow *flow;
> +
> + txqi = ctx;
> + local = vif_to_sdata(txqi->txq.vif)->local;
> + fq = &local->fq;
> +
> + if (cvars == &txqi->def_cvars)
> + flow = &txqi->def_flow;
> + else
> + flow = &fq->flows[cvars - local->cvars];
> +
> + return fq_flow_dequeue(fq, flow);
> +}
> +
> +static void codel_drop_func(struct sk_buff *skb,
> + void *ctx)
> +{
> + struct ieee80211_local *local;
> + struct ieee80211_hw *hw;
> + struct txq_info *txqi;
> +
> + txqi = ctx;
> + local = vif_to_sdata(txqi->txq.vif)->local;
> + hw = &local->hw;
> +
> + ieee80211_free_txskb(hw, skb);
> +}
> +
> static struct sk_buff *fq_tin_dequeue_func(struct fq *fq,
> struct fq_tin *tin,
> struct fq_flow *flow)
> {
> - return fq_flow_dequeue(fq, flow);
> + struct ieee80211_local *local;
> + struct txq_info *txqi;
> + struct codel_vars *cvars;
> + struct codel_params *cparams;
> + struct codel_stats *cstats;
> +
> + local = container_of(fq, struct ieee80211_local, fq);
> + txqi = container_of(tin, struct txq_info, tin);
> + cparams = &local->cparams;
> + cstats = &local->cstats;
> +
> + if (flow == &txqi->def_flow)
> + cvars = &txqi->def_cvars;
> + else
> + cvars = &local->cvars[flow - fq->flows];
> +
> + return codel_dequeue(txqi,
> + &flow->backlog,
> + cparams,
> + cvars,
> + cstats,
> + codel_skb_len_func,
> + codel_skb_time_func,
> + codel_drop_func,
> + codel_dequeue_func);
> }
>
> static void fq_skb_free_func(struct fq *fq,
> @@ -1305,6 +1388,7 @@ static void ieee80211_txq_enqueue(struct ieee80211_local *local,
> struct fq *fq = &local->fq;
> struct fq_tin *tin = &txqi->tin;
>
> + ieee80211_set_skb_enqueue_time(skb);
> fq_tin_enqueue(fq, tin, skb,
> fq_skb_free_func,
> fq_flow_get_default_func);
> @@ -1316,6 +1400,7 @@ void ieee80211_txq_init(struct ieee80211_sub_if_data *sdata,
> {
> fq_tin_init(&txqi->tin);
> fq_flow_init(&txqi->def_flow);
> + codel_vars_init(&txqi->def_cvars);
>
> txqi->txq.vif = &sdata->vif;
>
> @@ -1344,6 +1429,7 @@ int ieee80211_txq_setup_flows(struct ieee80211_local *local)
> {
> struct fq *fq = &local->fq;
> int ret;
> + int i;
>
> if (!local->ops->wake_tx_queue)
> return 0;
> @@ -1352,6 +1438,22 @@ int ieee80211_txq_setup_flows(struct ieee80211_local *local)
> if (ret)
> return ret;
>
> + codel_params_init(&local->cparams);
> + codel_stats_init(&local->cstats);
> + local->cparams.interval = MS2TIME(100);
> + local->cparams.target = MS2TIME(20);
> + local->cparams.ecn = true;
> +
> + local->cvars = kcalloc(fq->flows_cnt, sizeof(local->cvars[0]),
> + GFP_KERNEL);
> + if (!local->cvars) {
> + fq_reset(fq, fq_skb_free_func);
> + return -ENOMEM;
> + }
> +
> + for (i = 0; i < fq->flows_cnt; i++)
> + codel_vars_init(&local->cvars[i]);
> +
> return 0;
> }
>
> @@ -1362,6 +1464,9 @@ void ieee80211_txq_teardown_flows(struct ieee80211_local *local)
> if (!local->ops->wake_tx_queue)
> return;
>
> + kfree(local->cvars);
> + local->cvars = NULL;
> +
> fq_reset(fq, fq_skb_free_func);
> }
>
> @@ -1384,6 +1489,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
> if (!skb)
> goto out;
>
> + ieee80211_set_skb_vif(skb, txqi);
> +
> hdr = (struct ieee80211_hdr *)skb->data;
> if (txq->sta && ieee80211_is_data_qos(hdr->frame_control)) {
> struct sta_info *sta = container_of(txq->sta, struct sta_info,
> --
> 2.1.4
>
--
Dave Täht
Let's go make home routers and wifi faster! With better software!
http://blog.cerowrt.org
next prev parent reply other threads:[~2016-05-05 15:30 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 10:17 [Make-wifi-fast] [RFCv2 0/3] mac80211: implement fq codel Michal Kazior
2016-03-16 10:17 ` [Make-wifi-fast] [RFCv2 1/3] mac80211: implement fq_codel for software queuing Michal Kazior
2016-03-22 1:35 ` David Lang
2016-03-22 6:51 ` Michal Kazior
2016-03-16 10:17 ` [Make-wifi-fast] [RFCv2 2/3] ath10k: report per-station tx/rate rates to mac80211 Michal Kazior
2016-03-24 7:19 ` Mohammed Shafi Shajakhan
2016-03-24 7:49 ` Michal Kazior
2016-03-24 12:23 ` Mohammed Shafi Shajakhan
2016-03-24 12:31 ` Michal Kazior
2016-03-16 10:17 ` [Make-wifi-fast] [RFCv2 3/3] ath10k: use ieee80211_tx_schedule() Michal Kazior
2016-03-16 10:26 ` [Make-wifi-fast] [RFCv2 0/3] mac80211: implement fq codel Michal Kazior
2016-03-16 15:37 ` Dave Taht
2016-03-16 18:36 ` Dave Taht
2016-03-16 18:55 ` Bob Copeland
2016-03-16 19:48 ` Jasmine Strong
2016-03-17 8:55 ` Michal Kazior
2016-03-17 11:12 ` Bob Copeland
2016-03-17 17:00 ` Dave Taht
2016-03-17 17:24 ` [Make-wifi-fast] [Codel] " Rick Jones
2016-03-21 11:57 ` [Make-wifi-fast] " Michal Kazior
2016-03-17 9:43 ` Michal Kazior
2016-03-17 9:03 ` Michal Kazior
2016-03-25 9:27 ` [Make-wifi-fast] [PATCH 0/2] mac80211: implement fq_codel Michal Kazior
2016-03-25 9:27 ` [Make-wifi-fast] [PATCH 1/2] mac80211: implement fair queuing per txq Michal Kazior
[not found] ` <CAHqTa-0yEFYAFpSKyko1ET33GsN==_D8TpBeq6AtwLj4XMTW0A@mail.gmail.com>
2016-04-11 7:25 ` Michal Kazior
2016-03-25 9:27 ` [Make-wifi-fast] [PATCH 2/2] mac80211: expose some txq/fq internals and knobs via debugfs Michal Kazior
2016-03-31 10:28 ` [Make-wifi-fast] [PATCHv2 0/2] mac80211: implement fq_codel Michal Kazior
2016-03-31 10:28 ` [Make-wifi-fast] [PATCHv2 1/2] mac80211: implement fair queuing per txq Michal Kazior
2016-04-05 13:57 ` Johannes Berg
2016-04-05 14:32 ` Dave Taht
[not found] ` <1459927276.17504.6.camel@sipsolutions.net>
2016-04-06 17:39 ` Dave Taht
2016-04-07 8:53 ` Johannes Berg
2016-04-06 5:35 ` Michal Kazior
2016-04-06 6:03 ` Jonathan Morton
2016-04-06 7:16 ` Michal Kazior
2016-04-06 16:46 ` Jonathan Morton
2016-04-06 7:19 ` Johannes Berg
2016-03-31 10:28 ` [Make-wifi-fast] [PATCHv2 2/2] mac80211: expose some txq/fq internals and knobs via debugfs Michal Kazior
2016-04-14 12:18 ` [Make-wifi-fast] [PATCHv3 0/5] mac80211: implement fq_codel Michal Kazior
2016-04-14 12:18 ` [Make-wifi-fast] [PATCHv3 1/5] mac80211: skip netdev queue control with software queuing Michal Kazior
2016-04-16 22:21 ` Johannes Berg
2016-04-18 5:39 ` Michal Kazior
2016-04-14 12:18 ` [Make-wifi-fast] [PATCHv3 2/5] mac80211: implement fair queueing per txq Michal Kazior
2016-04-16 22:23 ` Johannes Berg
2016-04-16 22:25 ` Johannes Berg
2016-04-18 5:16 ` Michal Kazior
2016-04-18 12:31 ` [Make-wifi-fast] [Codel] " Eric Dumazet
2016-04-18 13:36 ` Michal Kazior
2016-04-19 9:10 ` Johannes Berg
2016-04-14 12:18 ` [Make-wifi-fast] [PATCHv3 3/5] mac80211: add debug knobs for fair queuing Michal Kazior
2016-04-14 12:18 ` [Make-wifi-fast] [PATCHv3 4/5] mac80211: implement codel on fair queuing flows Michal Kazior
2016-04-16 22:29 ` Johannes Berg
2016-04-18 5:31 ` Michal Kazior
2016-04-18 12:38 ` Michal Kazior
2016-04-19 9:06 ` Johannes Berg
2016-04-19 9:31 ` Michal Kazior
2016-04-19 9:57 ` Johannes Berg
2016-04-14 12:18 ` [Make-wifi-fast] [PATCHv3 5/5] mac80211: add debug knobs for codel Michal Kazior
2016-05-05 11:00 ` [Make-wifi-fast] [PATCHv4 0/5] mac80211: implement fq_codel Michal Kazior
2016-05-05 11:00 ` [Make-wifi-fast] [PATCHv4 1/5] mac80211: skip netdev queue control with software queuing Michal Kazior
2016-05-09 12:28 ` Michal Kazior
2016-05-05 11:00 ` [Make-wifi-fast] [PATCHv4 2/5] mac80211: implement fair queueing per txq Michal Kazior
2016-05-05 11:00 ` [Make-wifi-fast] [PATCHv4 3/5] mac80211: add debug knobs for fair queuing Michal Kazior
2016-06-09 9:48 ` Johannes Berg
2016-05-05 11:00 ` [Make-wifi-fast] [PATCHv4 4/5] mac80211: implement codel on fair queuing flows Michal Kazior
2016-05-05 15:30 ` Dave Taht [this message]
2016-05-05 11:00 ` [Make-wifi-fast] [PATCHv4 5/5] mac80211: add debug knobs for codel Michal Kazior
2016-05-05 15:21 ` Dave Taht
2016-05-06 5:27 ` Michal Kazior
2016-05-06 5:51 ` Dave Taht
2016-05-06 6:33 ` Michal Kazior
2016-05-06 7:23 ` Dave Taht
2016-05-19 8:37 ` [Make-wifi-fast] [PATCHv5 0/5] mac80211: implement fq_codel Michal Kazior
2016-05-19 8:37 ` [Make-wifi-fast] [PATCHv5 1/5] mac80211: skip netdev queue control with software queuing Michal Kazior
2016-05-19 8:37 ` [Make-wifi-fast] [PATCHv5 2/5] mac80211: implement fair queueing per txq Michal Kazior
2016-05-19 8:37 ` [Make-wifi-fast] [PATCHv5 3/5] mac80211: add debug knobs for fair queuing Michal Kazior
2016-05-19 8:37 ` [Make-wifi-fast] [PATCHv5 4/5] mac80211: implement codel on fair queuing flows Michal Kazior
2016-05-19 8:37 ` [Make-wifi-fast] [PATCHv5 5/5] mac80211: add debug knobs for codel Michal Kazior
2016-06-09 9:47 ` Johannes Berg
2016-05-31 12:12 ` [Make-wifi-fast] [PATCHv5 0/5] mac80211: implement fq_codel Toke Høiland-Jørgensen
2016-05-31 12:31 ` Michal Kazior
2016-06-09 9:49 ` Johannes Berg
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
List information: https://lists.bufferbloat.net/postorius/lists/make-wifi-fast.lists.bufferbloat.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAA93jw6eLwiykgbxdJjy0-bRjAQEgR-E6kpM3EDKnyFcBhu+5w@mail.gmail.com \
--to=dave.taht@gmail.com \
--cc=apenwarr@gmail.com \
--cc=codel@lists.bufferbloat.net \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=make-wifi-fast@lists.bufferbloat.net \
--cc=michal.kazior@tieto.com \
/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