diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2017-07-24 01:23:47 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2017-07-24 01:23:47 +0000 |
commit | 00083e9adb9c9b239a302ddd8c16f0c24837997a (patch) | |
tree | 3904c4b7060e131261cba58ac48a6a3782a152d5 | |
parent | 107de4d4ca1d4f75c726a0e717701a08bec523a6 (diff) |
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.
-rw-r--r-- | sys/net/fq_codel.c | 9 |
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; |