Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jan 2014 02:47:20 +0000 (UTC)
From:      Kevin Lo <kevlo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r260501 - head/sys/dev/usb/wlan
Message-ID:  <201401100247.s0A2lK9q066888@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevlo
Date: Fri Jan 10 02:47:20 2014
New Revision: 260501
URL: http://svnweb.freebsd.org/changeset/base/260501

Log:
  Use m_getcl() instead of MGETHDR/MCLGET macros.
  
  Suggested by:	glebius

Modified:
  head/sys/dev/usb/wlan/if_rsu.c

Modified: head/sys/dev/usb/wlan/if_rsu.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rsu.c	Fri Jan 10 01:44:34 2014	(r260500)
+++ head/sys/dev/usb/wlan/if_rsu.c	Fri Jan 10 02:47:20 2014	(r260501)
@@ -1145,16 +1145,9 @@ rsu_event_survey(struct rsu_softc *sc, u
 	pktlen = sizeof(*wh) + le32toh(bss->ieslen);
 	if (__predict_false(pktlen > MCLBYTES))
 		return;
-	MGETHDR(m, M_NOWAIT, MT_DATA);
+	m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
 	if (__predict_false(m == NULL))
 		return;
-	if (pktlen > MHLEN) {
-		MCLGET(m, M_NOWAIT);
-		if (!(m->m_flags & M_EXT)) {
-			m_free(m);
-			return;
-		}
-	}
 	wh = mtod(m, struct ieee80211_frame *);
 	wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_MGT |
 	    IEEE80211_FC0_SUBTYPE_BEACON;
@@ -1358,19 +1351,11 @@ rsu_rx_frame(struct rsu_softc *sc, uint8
 	DPRINTFN(5, "Rx frame len=%d rate=%d infosz=%d rssi=%d\n",
 	    pktlen, rate, infosz, *rssi);
 
-	MGETHDR(m, M_NOWAIT, MT_DATA);
+	m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
 	if (__predict_false(m == NULL)) {
 		ifp->if_ierrors++;
 		return NULL;
 	}
-	if (pktlen > MHLEN) {
-		MCLGET(m, M_NOWAIT);
-		if (__predict_false(!(m->m_flags & M_EXT))) {
-			ifp->if_ierrors++;
-			m_freem(m);
-			return NULL;
-		}
-	}
 	/* Finalize mbuf. */
 	m->m_pkthdr.rcvif = ifp;
 	/* Hardware does Rx TCP checksum offload. */



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