aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/kern_wg.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/kern_wg.c b/src/kern_wg.c
index 697249e..671b8b1 100644
--- a/src/kern_wg.c
+++ b/src/kern_wg.c
@@ -308,6 +308,8 @@ mpq_enqueue(struct mpq *mpq, struct mbuf *m)
CLR(m->m_flags, M_LINK0);
mtx_enter(&mpq->mpq_mtx);
ml_enqueue(&mpq->mpq_list, m);
+ if (mpq->mpq_cursor == NULL)
+ mpq->mpq_cursor = m;
mtx_leave(&mpq->mpq_mtx);
}
@@ -324,11 +326,9 @@ struct mbuf
{
struct mbuf *m;
mtx_enter(&mpq->mpq_mtx);
- if (mpq->mpq_cursor == NULL)
- mpq->mpq_cursor = MBUF_LIST_FIRST(&mpq->mpq_list);
- else
- mpq->mpq_cursor = MBUF_LIST_NEXT(mpq->mpq_cursor);
m = mpq->mpq_cursor;
+ if (mpq->mpq_cursor != NULL)
+ mpq->mpq_cursor = MBUF_LIST_NEXT(mpq->mpq_cursor);
mtx_leave(&mpq->mpq_mtx);
return m;
}