summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormikeb <mikeb@openbsd.org>2017-07-24 01:23:46 +0000
committermikeb <mikeb@openbsd.org>2017-07-24 01:23:46 +0000
commitb22f13b1b97c3f07caa1eaaf0e2045c9e4ae82ac (patch)
treefc7867773d9d3aa43c388e31b2e2d1967f9360a1 /sys
parentAllow IPQoS=none in ssh/sshd to not set an explicit ToS/DSCP value (diff)
downloadwireguard-openbsd-b22f13b1b97c3f07caa1eaaf0e2045c9e4ae82ac.tar.xz
wireguard-openbsd-b22f13b1b97c3f07caa1eaaf0e2045c9e4ae82ac.zip
Fixup free list handling in fqcodel_deq_begin
We're growing an mbuf free list while iterating over flow queues and need to adjust our internal statistics on every iteration by using a portion of the free list corresponding to the current iteration.
Diffstat (limited to 'sys')
-rw-r--r--sys/net/fq_codel.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/net/fq_codel.c b/sys/net/fq_codel.c
index 07b36c92fb0..6aef71efc43 100644
--- a/sys/net/fq_codel.c
+++ b/sys/net/fq_codel.c
@@ -641,6 +641,7 @@ struct mbuf *
fqcodel_deq_begin(struct fqcodel *fqc, void **cookiep,
struct mbuf_list *free_ml)
{
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct flowq *fq;
struct flow *flow;
struct mbuf *m;
@@ -653,11 +654,13 @@ fqcodel_deq_begin(struct fqcodel *fqc, void **cookiep,
for (flow = first_flow(fqc, &fq); flow != NULL;
flow = next_flow(fqc, flow, &fq)) {
- m = codel_dequeue(&flow->cd, &fqc->cparams, now, free_ml,
+ m = codel_dequeue(&flow->cd, &fqc->cparams, now, &ml,
&fqc->drop_cnt.packets, &fqc->drop_cnt.bytes);
- KASSERT(fqc->qlength >= ml_len(free_ml));
- fqc->qlength -= ml_len(free_ml);
+ KASSERT(fqc->qlength >= ml_len(&ml));
+ fqc->qlength -= ml_len(&ml);
+
+ ml_enlist(free_ml, &ml);
if (m != NULL) {
flow->deficit -= m->m_pkthdr.len;