Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 May 2016 19:13:39 +0000 (UTC)
From:      Andriy Voskoboinyk <avos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300911 - head/sys/net80211
Message-ID:  <201605281913.u4SJDdtx053451@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avos
Date: Sat May 28 19:13:39 2016
New Revision: 300911
URL: https://svnweb.freebsd.org/changeset/base/300911

Log:
  net80211: replace m_getcl/m_gethdr pair with m_get2 in ieee80211_fragment()
  
  - Switch to m_get2() for mbuf allocation instead of manual mbuf size
  determination.
  - Reuse MIN() macro for mbuf size selection.

Modified:
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_output.c
==============================================================================
--- head/sys/net80211/ieee80211_output.c	Sat May 28 18:49:17 2016	(r300910)
+++ head/sys/net80211/ieee80211_output.c	Sat May 28 19:13:39 2016	(r300911)
@@ -1679,16 +1679,8 @@ ieee80211_fragment(struct ieee80211vap *
 	remainder = m0->m_pkthdr.len - off;
 	prev = m0;
 	do {
-		fragsize = totalhdrsize + remainder;
-		if (fragsize > mtu)
-			fragsize = mtu;
-		/* XXX fragsize can be >2048! */
-		KASSERT(fragsize < MCLBYTES,
-			("fragment size %u too big!", fragsize));
-		if (fragsize > MHLEN)
-			m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
-		else
-			m = m_gethdr(M_NOWAIT, MT_DATA);
+		fragsize = MIN(totalhdrsize + remainder, mtu);
+		m = m_get2(fragsize, M_NOWAIT, MT_DATA, M_PKTHDR);
 		if (m == NULL)
 			goto bad;
 		/* leave room to prepend any cipher header */



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