From 54d8b34ae46f21d51ab2507273edb7cc261f3cf4 Mon Sep 17 00:00:00 2001 From: adrian Date: Thu, 30 Mar 2017 02:34:21 +0000 Subject: [PATCH] [mbufq] add a concat method. Reviewed by: gnn, ae, glebius Approved by: ae, glebius Differential Revision: https://reviews.freebsd.org/D10158 --- sys/sys/mbuf.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index ecc5c2a9aab2..0dce057c3e66 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1320,5 +1320,18 @@ mbufq_prepend(struct mbufq *mq, struct mbuf *m) STAILQ_INSERT_HEAD(&mq->mq_head, m, m_stailqpkt); mq->mq_len++; } + +/* + * Note: this doesn't enforce the maximum list size for dst. + */ +static inline void +mbufq_concat(struct mbufq *mq_dst, struct mbufq *mq_src) +{ + + mq_dst->mq_len += mq_src->mq_len; + STAILQ_CONCAT(&mq_dst->mq_head, &mq_src->mq_head); + mq_src->mq_len = 0; +} + #endif /* _KERNEL */ #endif /* !_SYS_MBUF_H_ */