diff options
author | Michal Kazior <michal.kazior@tieto.com> | 2016-04-27 06:59:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-28 17:03:38 -0400 |
commit | b43e7199a9061562e28c72192a1d07e00ec4e97f (patch) | |
tree | 420b211911111c7603cfcff2f9ace377e32afa42 | |
parent | b43586576e54609f7970096478cf4113de18a4db (diff) |
fq: split out backlog update logic
mac80211 (which will be the first user of the
fq.h) recently started to support software A-MSDU
aggregation. It glues skbuffs together into a
single one so the backlog accounting needs to be
more fine-grained.
To avoid backlog sorting logic duplication split
it up for re-use.
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/fq_impl.h | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/include/net/fq_impl.h b/include/net/fq_impl.h index 02eab7c51adb..163f3ed0f05a 100644 --- a/include/net/fq_impl.h +++ b/include/net/fq_impl.h | |||
@@ -120,6 +120,24 @@ static struct fq_flow *fq_flow_classify(struct fq *fq, | |||
120 | return flow; | 120 | return flow; |
121 | } | 121 | } |
122 | 122 | ||
123 | static void fq_recalc_backlog(struct fq *fq, | ||
124 | struct fq_tin *tin, | ||
125 | struct fq_flow *flow) | ||
126 | { | ||
127 | struct fq_flow *i; | ||
128 | |||
129 | if (list_empty(&flow->backlogchain)) | ||
130 | list_add_tail(&flow->backlogchain, &fq->backlogs); | ||
131 | |||
132 | i = flow; | ||
133 | list_for_each_entry_continue_reverse(i, &fq->backlogs, | ||
134 | backlogchain) | ||
135 | if (i->backlog > flow->backlog) | ||
136 | break; | ||
137 | |||
138 | list_move(&flow->backlogchain, &i->backlogchain); | ||
139 | } | ||
140 | |||
123 | static void fq_tin_enqueue(struct fq *fq, | 141 | static void fq_tin_enqueue(struct fq *fq, |
124 | struct fq_tin *tin, | 142 | struct fq_tin *tin, |
125 | struct sk_buff *skb, | 143 | struct sk_buff *skb, |
@@ -127,7 +145,6 @@ static void fq_tin_enqueue(struct fq *fq, | |||
127 | fq_flow_get_default_t get_default_func) | 145 | fq_flow_get_default_t get_default_func) |
128 | { | 146 | { |
129 | struct fq_flow *flow; | 147 | struct fq_flow *flow; |
130 | struct fq_flow *i; | ||
131 | 148 | ||
132 | lockdep_assert_held(&fq->lock); | 149 | lockdep_assert_held(&fq->lock); |
133 | 150 | ||
@@ -139,16 +156,7 @@ static void fq_tin_enqueue(struct fq *fq, | |||
139 | tin->backlog_packets++; | 156 | tin->backlog_packets++; |
140 | fq->backlog++; | 157 | fq->backlog++; |
141 | 158 | ||
142 | if (list_empty(&flow->backlogchain)) | 159 | fq_recalc_backlog(fq, tin, flow); |
143 | list_add_tail(&flow->backlogchain, &fq->backlogs); | ||
144 | |||
145 | i = flow; | ||
146 | list_for_each_entry_continue_reverse(i, &fq->backlogs, | ||
147 | backlogchain) | ||
148 | if (i->backlog > flow->backlog) | ||
149 | break; | ||
150 | |||
151 | list_move(&flow->backlogchain, &i->backlogchain); | ||
152 | 160 | ||
153 | if (list_empty(&flow->flowchain)) { | 161 | if (list_empty(&flow->flowchain)) { |
154 | flow->deficit = fq->quantum; | 162 | flow->deficit = fq->quantum; |