From 80473865e0123b197dbb676dcede26a219d5d769 Mon Sep 17 00:00:00 2001
From: dave taht <dave@taht.net>
Date: Wed, 3 Aug 2016 08:20:22 -0700
Subject: [PATCH] mac80211: Use more standard codel and fq_codel defaults

Having the quantum parameter at a single packet saves 5+ runs through the
inner loop of fq_codel, and makes the fast/slow concept work for all
flows.

The codel target should be thought of as "are you willing to tolerate
more than X delay for more than interval Y ms", and the target should
be thought of as more of a percentage of the interval, where 5% is
the point of maximum "power".

Additionally:

It is better to reduce the maximum size of the txop when there are
many stations queueing up, and to try to hold the delay low, but
this patch doesn't do that.
---
 include/net/fq_impl.h | 2 +-
 net/mac80211/tx.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/net/fq_impl.h b/include/net/fq_impl.h
index 163f3ed..9afb1b6 100644
--- a/include/net/fq_impl.h
+++ b/include/net/fq_impl.h
@@ -249,7 +249,7 @@ static int fq_init(struct fq *fq, int flows_cnt)
 	spin_lock_init(&fq->lock);
 	fq->flows_cnt = max_t(u32, flows_cnt, 1);
 	fq->perturbation = prandom_u32();
-	fq->quantum = 300;
+	fq->quantum = 1514;
 	fq->limit = 8192;
 
 	fq->flows = kcalloc(fq->flows_cnt, sizeof(fq->flows[0]), GFP_KERNEL);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 91461c4..eb8b1c9 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1443,7 +1443,7 @@ int ieee80211_txq_setup_flows(struct ieee80211_local *local)
 	codel_params_init(&local->cparams);
 	codel_stats_init(&local->cstats);
 	local->cparams.interval = MS2TIME(100);
-	local->cparams.target = MS2TIME(20);
+	local->cparams.target = MS2TIME(5);
 	local->cparams.ecn = true;
 
 	local->cvars = kcalloc(fq->flows_cnt, sizeof(local->cvars[0]),
-- 
2.7.4

