All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Kazior <michal.kazior@tieto.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	Dave Taht <dave.taht@gmail.com>,
	make-wifi-fast@lists.bufferbloat.net,
	codel@lists.bufferbloat.net
Subject: Re: [PATCHv2 1/2] mac80211: implement fair queuing per txq
Date: Wed, 6 Apr 2016 07:35:47 +0200	[thread overview]
Message-ID: <CA+BoTQmkGhyPGRuT8GJOfdYyGGckZZA0JMZF+G3uk8KGAwLKvg@mail.gmail.com> (raw)
In-Reply-To: <1459864656.18188.60.camel@sipsolutions.net>

On 5 April 2016 at 15:57, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Thu, 2016-03-31 at 12:28 +0200, Michal Kazior wrote:
>
>> +++ b/net/mac80211/codel.h
>> +++ b/net/mac80211/codel_i.h
>
> Do we really need all this code in .h files? It seems very odd to me to
> have all the algorithm implementation there rather than a C file, you
> should (can?) only include codel.h into a single C file anyway.

I just wanted to follow the suggested/implied usage of codel code and
keep modifications to a minimum. I could very well just assimilate it
if you wish.


>>  struct txq_info {
>> -     struct sk_buff_head queue;
>> +     struct txq_flow flow;
>> +     struct list_head new_flows;
>> +     struct list_head old_flows;
>
> This is confusing, can you please document that? Why are there two
> lists of flows, *and* an embedded flow? Is the embedded flow on any of
> the lists?

The new/old flows is follows the same principle as net/sched/sch_fq_codel.c

The embedded flow is for possible collisions, explained below.

Nevertheless I'll add more comments on what-is-what-and-why.


>> +     u32 backlog_bytes;
>> +     u32 backlog_packets;
>> +     u32 drop_codel;
>
> Would it make some sense to at least conceptually layer this a bit?
> I.e. rather than calling this "drop_codel" call it "drop_congestion" or
> something like that?

Sure, I'll change it.


>> +/**
>> + * struct txq_flow - per traffic flow queue
>> + *
>> + * This structure is used to distinguish and queue different traffic flows
>> + * separately for fair queueing/AQM purposes.
>> + *
>> + * @txqi: txq_info structure it is associated at given time
>
> Do we actually have to keep that? It's on a list per txqi, no?

It's used to track ownership.

Packets can be destined to different stations/txqs. At enqueue time I
do a partial hash of a packet to get an "index" which I then use to
address a txq_flow from per-radio list (out of 4096 of them). You can
end up with a situtation like this:
 - packet A hashing to X destined to txq P which is VI
 - packet B hashing to X destined to txq Q which is BK

You can't use the same txq_flow for both A and B because you want to
maintain packets per txqs more than you want to maintain them per flow
(you don't want to queue BK traffic onto VI or vice versa as an
artifact, do you? ;). When a txq_flow doesn't have a txqi it is bound.
Later, if a collision happens (i.e. resulting txq_flow has non-NULL
txqi) the "embedded" per-txq flow is used:

  struct txq_info {
 -     struct sk_buff_head queue;
 +     struct txq_flow flow; // <--- this

When txq_flow becomes empty its txqi is reset.

The embedded flow is otherwise treated like any other flow, i.e. it
can be linked to old_flows and new_flows.


>> + * @flowchain: can be linked to other flows for RR purposes
>
> RR?

Round-robin. Assuming it's correct to call fq_codel an RR scheme?



>> +void ieee80211_teardown_flows(struct ieee80211_local *local)
>> +{
>> +     struct ieee80211_fq *fq = &local->fq;
>> +     struct ieee80211_sub_if_data *sdata;
>> +     struct sta_info *sta;
>> +     int i;
>> +
>> +     if (!local->ops->wake_tx_queue)
>> +             return;
>> +
>> +     list_for_each_entry_rcu(sta, &local->sta_list, list)
>> +             for (i = 0; i < IEEE80211_NUM_TIDS; i++)
>> +                     ieee80211_purge_txq(local,
>> +                                         to_txq_info(sta->sta.txq[i]));
>> +
>> +     list_for_each_entry_rcu(sdata, &local->interfaces, list)
>> +             ieee80211_purge_txq(local, to_txq_info(sdata->vif.txq));
>
> Using RCU iteration here seems rather strange, since it's a teardown
> flow? That doesn't seem necessary, since it's control path and must be
> holding appropriate locks anyway to make sure nothing is added to the
> lists.

You're probably right. I'll look into changing it.


>
>> +     skb = codel_dequeue(flow,
>> +                         &flow->backlog,
>> +                         0,
>> +                         &flow->cvars,
>> +                         &fq->cparams,
>> +                         codel_get_time(),
>> +                         false);
>
> What happened here? :)

I'm not a huge fan of wrapping functions with a lot of (ugly-looking)
arguments. I can make it a different ugly if you want :)


>> +     if (!skb) {
>> +             if ((head == &txqi->new_flows) &&
>> +                 !list_empty(&txqi->old_flows)) {
>> +                     list_move_tail(&flow->flowchain, &txqi->old_flows);
>> +             } else {
>> +                     list_del_init(&flow->flowchain);
>> +                     flow->txqi = NULL;
>> +             }
>> +             goto begin;
>> +     }
>
> Ouch. Any way you can make that easier to follow?

This follows net/sched/sch_fq_codel.h. I can put up a comment to
explain what it's supposed to do?


Michał

  parent reply	other threads:[~2016-04-06  5:35 UTC|newest]

Thread overview: 121+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 10:17 [RFCv2 0/3] mac80211: implement fq codel Michal Kazior
2016-03-16 10:17 ` Michal Kazior
2016-03-16 10:17 ` [RFCv2 1/3] mac80211: implement fq_codel for software queuing Michal Kazior
2016-03-16 10:17   ` Michal Kazior
2016-03-16 10:17   ` Michal Kazior
2016-03-22  1:35   ` [Make-wifi-fast] " David Lang
2016-03-22  1:35     ` David Lang
2016-03-22  1:35     ` David Lang
2016-03-22  6:51     ` Michal Kazior
2016-03-22  6:51       ` Michal Kazior
2016-03-22  6:51       ` Michal Kazior
2016-03-16 10:17 ` [RFCv2 2/3] ath10k: report per-station tx/rate rates to mac80211 Michal Kazior
2016-03-16 10:17   ` Michal Kazior
2016-03-16 10:17   ` Michal Kazior
2016-03-24  7:19   ` Mohammed Shafi Shajakhan
2016-03-24  7:19     ` Mohammed Shafi Shajakhan
2016-03-24  7:19     ` Mohammed Shafi Shajakhan
2016-03-24  7:49     ` Michal Kazior
2016-03-24  7:49       ` Michal Kazior
2016-03-24  7:49       ` Michal Kazior
2016-03-24 12:23       ` Mohammed Shafi Shajakhan
2016-03-24 12:23         ` Mohammed Shafi Shajakhan
2016-03-24 12:31         ` Michal Kazior
2016-03-24 12:31           ` Michal Kazior
2016-03-24 12:31           ` Michal Kazior
2016-03-16 10:17 ` [RFCv2 3/3] ath10k: use ieee80211_tx_schedule() Michal Kazior
2016-03-16 10:17   ` Michal Kazior
2016-03-16 10:17   ` Michal Kazior
2016-03-16 10:26 ` [RFCv2 0/3] mac80211: implement fq codel Michal Kazior
2016-03-16 10:26   ` Michal Kazior
2016-03-16 15:37   ` Dave Taht
2016-03-16 15:37     ` Dave Taht
2016-03-16 15:37     ` Dave Taht
2016-03-16 18:36     ` Dave Taht
2016-03-16 18:36       ` Dave Taht
2016-03-16 18:36       ` Dave Taht
2016-03-16 18:55       ` Bob Copeland
2016-03-16 18:55         ` Bob Copeland
2016-03-16 18:55         ` Bob Copeland
2016-03-16 19:48         ` Jasmine Strong
2016-03-17  8:55           ` Michal Kazior
2016-03-17  8:55             ` Michal Kazior
2016-03-17  8:55             ` Michal Kazior
2016-03-17 11:12             ` Bob Copeland
2016-03-17 11:12               ` Bob Copeland
2016-03-17 17:00             ` Dave Taht
2016-03-17 17:00               ` Dave Taht
2016-03-17 17:00               ` Dave Taht
2016-03-17 17:24               ` [Codel] " Rick Jones
2016-03-17 17:24                 ` Rick Jones
2016-03-17 17:24                 ` Rick Jones
2016-03-21 11:57               ` Michal Kazior
2016-03-21 11:57                 ` Michal Kazior
2016-03-17  9:43       ` Michal Kazior
2016-03-17  9:43         ` Michal Kazior
2016-03-17  9:43         ` Michal Kazior
2016-03-17  9:03     ` Michal Kazior
2016-03-17  9:03       ` Michal Kazior
2016-03-17  9:03       ` Michal Kazior
2016-03-25  9:27 ` [PATCH 0/2] mac80211: implement fq_codel Michal Kazior
2016-03-25  9:27   ` [PATCH 1/2] mac80211: implement fair queuing per txq Michal Kazior
2016-04-08  4:37     ` Avery Pennarun
2016-04-11  7:25       ` Michal Kazior
2016-03-25  9:27   ` [PATCH 2/2] mac80211: expose some txq/fq internals and knobs via debugfs Michal Kazior
2016-03-31 10:28   ` [PATCHv2 0/2] mac80211: implement fq_codel Michal Kazior
2016-03-31 10:28     ` [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
2016-04-06  7:21           ` Johannes Berg
2016-04-06 17:39             ` Dave Taht
2016-04-07  8:53               ` Johannes Berg
2016-04-06  5:35         ` Michal Kazior [this message]
2016-04-06  6:03           ` [Make-wifi-fast] " 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     ` [PATCHv2 2/2] mac80211: expose some txq/fq internals and knobs via debugfs Michal Kazior
2016-04-14 12:18     ` [PATCHv3 0/5] mac80211: implement fq_codel Michal Kazior
2016-04-14 12:18       ` [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       ` [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               ` [Codel] " Eric Dumazet
2016-04-18 13:36                 ` Michal Kazior
2016-04-19  9:10                   ` Johannes Berg
2016-04-14 12:18       ` [PATCHv3 3/5] mac80211: add debug knobs for fair queuing Michal Kazior
2016-04-14 12:18       ` [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       ` [PATCHv3 5/5] mac80211: add debug knobs for codel Michal Kazior
2016-05-05 11:00       ` [PATCHv4 0/5] mac80211: implement fq_codel Michal Kazior
2016-05-05 11:00         ` [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         ` [PATCHv4 2/5] mac80211: implement fair queueing per txq Michal Kazior
2016-05-05 11:00         ` [PATCHv4 3/5] mac80211: add debug knobs for fair queuing Michal Kazior
2016-06-09  9:48           ` Johannes Berg
2016-05-05 11:00         ` [PATCHv4 4/5] mac80211: implement codel on fair queuing flows Michal Kazior
2016-05-05 15:30           ` Dave Taht
2016-05-05 11:00         ` [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         ` [PATCHv5 0/5] mac80211: implement fq_codel Michal Kazior
2016-05-19  8:37           ` [PATCHv5 1/5] mac80211: skip netdev queue control with software queuing Michal Kazior
2016-05-19  8:37           ` [PATCHv5 2/5] mac80211: implement fair queueing per txq Michal Kazior
2016-05-19  8:37           ` [PATCHv5 3/5] mac80211: add debug knobs for fair queuing Michal Kazior
2016-05-19  8:37           ` [PATCHv5 4/5] mac80211: implement codel on fair queuing flows Michal Kazior
2016-05-19  8:37           ` [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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+BoTQmkGhyPGRuT8GJOfdYyGGckZZA0JMZF+G3uk8KGAwLKvg@mail.gmail.com \
    --to=michal.kazior@tieto.com \
    --cc=codel@lists.bufferbloat.net \
    --cc=dave.taht@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=make-wifi-fast@lists.bufferbloat.net \
    /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.