svn commit: r277071 - projects/ifnet/sys/sys

Gleb Smirnoff glebius at FreeBSD.org
Mon Jan 12 21:33:09 UTC 2015


On Tue, Jan 13, 2015 at 10:25:05AM +1300, Andrew Thompson wrote:
A> > Author: glebius
A> > Date: Mon Jan 12 13:53:40 2015
A> > New Revision: 277071
A> > URL: https://svnweb.freebsd.org/changeset/base/277071
A> >
A> > Log:
A> >   Provide struct mbufq, a STAILQ of mbufs, with counter for packets
A> >   and maximum limit set.  The structure is supposed to have external
A> >   locking.  The aim of new structure is to substitute struct ifqueue
A> >   in several places in the kernel, where struct ifqueue is used
A> >   outside of ifnet code itself.
A> >
A> > Modified:
A> >   projects/ifnet/sys/sys/mbuf.h
A> >
A> > Modified: projects/ifnet/sys/sys/mbuf.h
A> >
A> > ==============================================================================
A> >
A> > +static inline int
A> > +mbufq_enqueue(struct mbufq *mq, struct mbuf *m)
A> > +{
A> > +
A> > +       if (mbufq_full(mq))
A> > +               return (ENOBUFS);
A> > +       STAILQ_INSERT_TAIL(&mq->mq_head, m, m_stailqpkt);
A> > +       mq->mq_len++;
A> > +       return (0);
A> > +}
A> >
A> >
A> 
A> > +static inline void
A> > +mbufq_prepend(struct mbufq *mq, struct mbuf *m)
A> > +{
A> > +
A> > +       STAILQ_INSERT_HEAD(&mq->mq_head, m, m_stailqpkt);
A> > +       mq->mq_len++;
A> > +}
A> >
A> 
A> Should this have a full check like mbufq_enqueue?

Nope, the function is used to put back a recently dequeued mbuf that
failed to apply to somewhere else, and is too important to be dropped.

-- 
Totus tuus, Glebius.


More information about the svn-src-projects mailing list