Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jan 2015 00:33:03 +0300
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        Andrew Thompson <thompsa@FreeBSD.org>
Cc:        svn-src-projects@freebsd.org, "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: svn commit: r277071 - projects/ifnet/sys/sys
Message-ID:  <20150112213303.GR15484@FreeBSD.org>
In-Reply-To: <CAFAOGNTeDjuXY6_vHT1yQGueQRALD4hYbUZfPmH-CGQVWT0Qtw@mail.gmail.com>
References:  <201501121353.t0CDreu1022405@svn.freebsd.org> <CAFAOGNTeDjuXY6_vHT1yQGueQRALD4hYbUZfPmH-CGQVWT0Qtw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150112213303.GR15484>