summaryrefslogtreecommitdiffstats
path: root/src/mpq.h
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@mail.noconroy.net>2019-09-22 23:29:40 +0200
committerMatt Dunwoodie <ncon@mail.noconroy.net>2019-09-22 23:29:40 +0200
commitb5ba2568f9800eacb9bc0bef1d53bf9b1efcacb8 (patch)
tree212ffdb10ef22925af143eaa036eaded05de626f /src/mpq.h
parentMove antireplay to it's own header (diff)
downloadwireguard-openbsd-b5ba2568f9800eacb9bc0bef1d53bf9b1efcacb8.tar.xz
wireguard-openbsd-b5ba2568f9800eacb9bc0bef1d53bf9b1efcacb8.zip
Move functions from header files into dedicated file
The header files were nice while experimenting, but they are not ideal. Currently we have all the custom data structures in kerk/kern_wg.c, which would ideally not be named after wireguard, But for the time being, at least they're organised.
Diffstat (limited to 'src/mpq.h')
-rw-r--r--src/mpq.h75
1 files changed, 0 insertions, 75 deletions
diff --git a/src/mpq.h b/src/mpq.h
index 1629ccc92f3..146dedade5b 100644
--- a/src/mpq.h
+++ b/src/mpq.h
@@ -53,79 +53,4 @@ void fn_name(void *_mpq) { \
} \
} \
-void
-mpq_init(struct mpq *mpq, int ipl)
-{
- mpq->mpq_cursor = NULL;
- mpq->mpq_serializer = NULL;
- mtx_init(&mpq->mpq_mtx, ipl);
- ml_init(&mpq->mpq_list);
-}
-
-int
-mpq_serialize_try_enter(struct mpq *mpq)
-{
- int error = 1;
- mtx_enter(&mpq->mpq_mtx);
- if (mpq->mpq_serializer == NULL) {
- mpq->mpq_serializer = curcpu();
- error = 0;
- }
- mtx_leave(&mpq->mpq_mtx);
- return error;
-}
-
-void
-mpq_serialize_leave(struct mpq *mpq)
-{
- mtx_enter(&mpq->mpq_mtx);
- mpq->mpq_serializer = NULL;
- mtx_leave(&mpq->mpq_mtx);
-}
-
-void
-mpq_enqueue(struct mpq *mpq, struct mbuf *m)
-{
- /* TODO time based dropping of packets */
- CLR(m->m_flags, M_LINK0);
- mtx_enter(&mpq->mpq_mtx);
- ml_enqueue(&mpq->mpq_list, m);
- mtx_leave(&mpq->mpq_mtx);
-}
-
-void
-mpq_enlist(struct mpq *mpq, struct mbuf_list *list)
-{
- mtx_enter(&mpq->mpq_mtx);
- ml_enlist(&mpq->mpq_list, list);
- mtx_leave(&mpq->mpq_mtx);
-}
-
-struct mbuf
-*mpq_dethread(struct mpq *mpq)
-{
- 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;
- mtx_leave(&mpq->mpq_mtx);
- return m;
-}
-
-struct mbuf
-*mpq_dequeue(struct mpq *mpq)
-{
- struct mbuf *m;
- mtx_enter(&mpq->mpq_mtx);
- m = MBUF_LIST_FIRST(&mpq->mpq_list);
- if (m != NULL && ISSET(m->m_flags, M_LINK0))
- m = ml_dequeue(&mpq->mpq_list);
- else
- m = NULL;
- mtx_leave(&mpq->mpq_mtx);
- return m;
-}
#endif /* _MPQ_H_ */