Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jan 2012 17:48:10 +0100
From:      =?ISO-8859-1?Q?Ermal_Lu=E7i?= <eri@freebsd.org>
To:        Gleb Smirnoff <glebius@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r230265 - head/sys/contrib/pf/net
Message-ID:  <CAPBZQG2ChE13p-0ZTrqAKp80evJSG%2B%2Bc5=i9zEautC0YJugmtw@mail.gmail.com>
In-Reply-To: <201201171214.q0HCEQm8089958@svn.freebsd.org>
References:  <201201171214.q0HCEQm8089958@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Maybe it does not hurt in general to keep the V_

Some work was done to add it, no?!

On Tue, Jan 17, 2012 at 1:14 PM, Gleb Smirnoff <glebius@freebsd.org> wrote:

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


-- 
Ermal



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPBZQG2ChE13p-0ZTrqAKp80evJSG%2B%2Bc5=i9zEautC0YJugmtw>