svn commit: r230265 - head/sys/contrib/pf/net

Gleb Smirnoff glebius at FreeBSD.org
Tue Jan 17 17:53:25 UTC 2012


On Tue, Jan 17, 2012 at 05:48:10PM +0100, Ermal Lu?i wrote:
E> Maybe it does not hurt in general to keep the V_
E> Some work was done to add it, no?!

The V_ has been left under __FreeBSD__.

E> On Tue, Jan 17, 2012 at 1:14 PM, Gleb Smirnoff <glebius at freebsd.org> wrote:
E> 
E> > Author: glebius
E> > Date: Tue Jan 17 12:14:26 2012
E> > New Revision: 230265
E> > URL: http://svn.freebsd.org/changeset/base/230265
E> >
E> > Log:
E> >  Allocate our mbuf with m_get2().
E> >
E> > Modified:
E> >  head/sys/contrib/pf/net/if_pfsync.c
E> >
E> > Modified: head/sys/contrib/pf/net/if_pfsync.c
E> >
E> > ==============================================================================
E> > --- head/sys/contrib/pf/net/if_pfsync.c Tue Jan 17 12:13:36 2012
E> >  (r230264)
E> > +++ head/sys/contrib/pf/net/if_pfsync.c Tue Jan 17 12:14:26 2012
E> >  (r230265)
E> > @@ -2121,9 +2121,6 @@ pfsync_sendout(void)
E> >  #ifdef notyet
E> >        struct tdb *t;
E> >  #endif
E> > -#ifdef __FreeBSD__
E> > -       size_t pktlen;
E> > -#endif
E> >        int offset;
E> >        int q, count = 0;
E> >
E> > @@ -2145,44 +2142,33 @@ pfsync_sendout(void)
E> >                return;
E> >        }
E> >
E> > -       MGETHDR(m, M_DONTWAIT, MT_DATA);
E> > -       if (m == NULL) {
E> >  #ifdef __FreeBSD__
E> > +       m = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR, max_linkhdr + sc->sc_len);
E> > +       if (m == NULL) {
E> >                sc->sc_ifp->if_oerrors++;
E> > +               V_pfsyncstats.pfsyncs_onomem++;
E> > +               return;
E> > +       }
E> >  #else
E> > +       MGETHDR(m, M_DONTWAIT, MT_DATA);
E> > +       if (m == NULL) {
E> >                sc->sc_if.if_oerrors++;
E> > -#endif
E> > -               V_pfsyncstats.pfsyncs_onomem++;
E> > +               pfsyncstats.pfsyncs_onomem++;
E> >                pfsync_drop(sc);
E> >                return;
E> >        }
E> >
E> > -#ifdef __FreeBSD__
E> > -       pktlen = max_linkhdr + sc->sc_len;
E> > -       if (pktlen > MHLEN) {
E> > -               /* Find the right pool to allocate from. */
E> > -               /* XXX: This is ugly. */
E> > -               m_cljget(m, M_DONTWAIT, pktlen <= MCLBYTES ? MCLBYTES :
E> > -#if MJUMPAGESIZE != MCLBYTES
E> > -                       pktlen <= MJUMPAGESIZE ? MJUMPAGESIZE :
E> > -#endif
E> > -                       pktlen <= MJUM9BYTES ? MJUM9BYTES : MJUM16BYTES);
E> > -#else
E> >        if (max_linkhdr + sc->sc_len > MHLEN) {
E> >                MCLGETI(m, M_DONTWAIT, NULL, max_linkhdr + sc->sc_len);
E> > -#endif
E> >                if (!ISSET(m->m_flags, M_EXT)) {
E> >                        m_free(m);
E> > -#ifdef __FreeBSD__
E> > -                       sc->sc_ifp->if_oerrors++;
E> > -#else
E> >                        sc->sc_if.if_oerrors++;
E> > -#endif
E> > -                       V_pfsyncstats.pfsyncs_onomem++;
E> > +                       pfsyncstats.pfsyncs_onomem++;
E> >                        pfsync_drop(sc);
E> >                        return;
E> >                }
E> >        }
E> > +#endif
E> >        m->m_data += max_linkhdr;
E> >        m->m_len = m->m_pkthdr.len = sc->sc_len;
E> >
E> >
E> 
E> 
E> -- 
E> Ermal

-- 
Totus tuus, Glebius.


More information about the svn-src-head mailing list