Add mbuf enqueue/dequeue functions

This commit is contained in:
Nils O. Selåsdal
2015-05-05 00:06:28 +02:00
parent e922e60849
commit 5e2b1e2d0d
3 changed files with 71 additions and 2 deletions
+18
View File
@@ -203,3 +203,21 @@ int uc_mbuf_extend_tailroom(struct MBuf *mbuf, uint32_t len)
return 0;
}
void uc_mbuf_enqueue(struct MBuf *mbuf, struct TailQ *head)
{
uc_tailq_insert_tail(head, &mbuf->entry);
}
struct MBuf *uc_mbuf_dequeue(struct TailQ *head)
{
struct TailQ *q;
if (uc_tailq_empty(head)) {
return NULL;
}
q = UC_TAILQ_FIRST(head);
uc_tailq_remove(q);
return UC_TAILQ_CONTAINER(q, struct MBuf, entry);
}