Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jun 2018 10:51:25 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r335473 - stable/11/sys/netinet/libalias
Message-ID:  <201806211051.w5LApP35033349@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Thu Jun 21 10:51:25 2018
New Revision: 335473
URL: https://svnweb.freebsd.org/changeset/base/335473

Log:
  MFC r335133:
    In m_megapullup() use m_getjcl() to allocate 9k or 16k mbuf when requested.
  
    It is better to try allocate a big mbuf, than just silently drop a big
    packet. A better solution could be reworking of libalias modules to be
    able use m_copydata()/m_copyback() instead of requiring the single
    contiguous buffer.
  
    PR:		229006

Modified:
  stable/11/sys/netinet/libalias/alias.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/libalias/alias.c
==============================================================================
--- stable/11/sys/netinet/libalias/alias.c	Thu Jun 21 09:45:03 2018	(r335472)
+++ stable/11/sys/netinet/libalias/alias.c	Thu Jun 21 10:51:25 2018	(r335473)
@@ -1749,7 +1749,8 @@ LibAliasUnLoadAllModule(void)
  * the input packet, on failure NULL. The input packet is always consumed.
  */
 struct mbuf *
-m_megapullup(struct mbuf *m, int len) {
+m_megapullup(struct mbuf *m, int len)
+{
 	struct mbuf *mcl;
 
 	if (len > m->m_pkthdr.len)
@@ -1758,7 +1759,14 @@ m_megapullup(struct mbuf *m, int len) {
 	if (m->m_next == NULL && M_WRITABLE(m))
 		return (m);
 
-	mcl = m_get2(len, M_NOWAIT, MT_DATA, M_PKTHDR);
+	if (len <= MJUMPAGESIZE)
+		mcl = m_get2(len, M_NOWAIT, MT_DATA, M_PKTHDR);
+	else if (len <= MJUM9BYTES)
+		mcl = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MJUM9BYTES);
+	else if (len <= MJUM16BYTES)
+		mcl = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MJUM16BYTES);
+	else
+		goto bad;
 	if (mcl == NULL)
 		goto bad;
 	m_align(mcl, len);



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