From a91454538e106286c36186fb1faa1aa6f56eccd5 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Sun, 30 Dec 2007 17:37:58 +0000 Subject: Only do pullups when necessary, m_pullup() always prepends an mbuf which is very bad if it is not necessary as it causes scrary mbuf fragmentation. tested and OK mglocker@ --- sys/dev/ic/pgt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sys/dev/ic') diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c index f5652536c8c..357d0b7098a 100644 --- a/sys/dev/ic/pgt.c +++ b/sys/dev/ic/pgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pgt.c,v 1.45 2007/09/18 00:46:41 krw Exp $ */ +/* $OpenBSD: pgt.c,v 1.46 2007/12/30 17:37:57 claudio Exp $ */ /* * Copyright (c) 2006 Claudio Jeker @@ -837,10 +837,13 @@ pgt_ieee80211_encap(struct pgt_softc *sc, struct ether_header *eh, } M_PREPEND(m, sizeof(*frame) + sizeof(*snap), M_DONTWAIT); - if (m != NULL) - m = m_pullup(m, sizeof(*frame) + sizeof(*snap)); if (m == NULL) return (m); + if (m->m_len < sizeof(*frame) + sizeof(*snap)) { + m = m_pullup(m, sizeof(*frame) + sizeof(*snap)); + if (m == NULL) + return (m); + } frame = mtod(m, struct ieee80211_frame *); snap = (struct llc *)&frame[1]; if (ni != NULL) { -- cgit v1.2.3