From owner-svn-src-head@FreeBSD.ORG Tue Jan 17 12:14:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 397441065672; Tue, 17 Jan 2012 12:14:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2835A8FC16; Tue, 17 Jan 2012 12:14:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0HCER0N089960; Tue, 17 Jan 2012 12:14:27 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0HCEQm8089958; Tue, 17 Jan 2012 12:14:26 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201171214.q0HCEQm8089958@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 17 Jan 2012 12:14:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230265 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2012 12:14:27 -0000 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;