Generic queue's KPI to manipulate mbuf's queue

Arnaud Lacombe lacombar at gmail.com
Tue Jul 24 18:18:29 UTC 2012


Hi,

AFAIK, there is no proper KPI for managing mbuf queue. All users have
to re-implements the queue logic from scratch, which is less than
optimal. From a preeminent FreeBSD developer at BSDCan 2009: "we do
not need a new list implementation". There has been a few attempt of
providing a queue API, namely <dev/cxgb/sys/mbufq.h>, but that is
nothing more than an ad-hoc solution to something which _has_to_be_
generic. For the sake of adding more mess in the tree, this
implementation has been duplicated in <dev/xen/netfront/mbufq.h>...

Now, I understand, or at least merely witness without power, the
reluctance of kernel hackers to have 'struct mbuf` evolves, especially
wrt. their desire to keep binary compatibility of KPI[0]. Now, none of
the current ad-hoc API matched my needs, and I really did NOT want to
re-implement a new list implementation for missing basic operation,
such as deleting an element of the list, so I came with the attached
patch. The main idea is to be able to use already existing code from
<sys/queue.h> for mbuf queuing management. It is not the best which
can be done. I am not a huge fan of keeping `m_nextpkt' and
introducing a `m_nextelm', I would have preferred to use TAILQs, and I
do not like the dwelling in SLIST internal implementation details.
However, this change is relatively lightweight, and change neither ABI
or API.

Any comment appreciated.

 - Arnaud

[0]: taking care of having a stable kernel ABI and *not* a stable
userland ABI is beyond my understanding, but this is not the subject
of this mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mbuf_slist.diff
Type: application/octet-stream
Size: 847 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20120724/323fb707/mbuf_slist.obj


More information about the freebsd-net mailing list