diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2008-11-25 21:43:58 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2008-11-25 21:43:58 +0000 |
commit | d69871e8580da6ee2c3f62ac8cea87938e65dedc (patch) | |
tree | 8a81b4cb39645cdba8edecc1eb0226ecf4f04160 /sys/dev/pci/if_wpi.c | |
parent | b15ff47f94d82c81611a7806f710066b190b8ecb (diff) |
use shiny new m_defrag() and nitems() instead of rolling our own.
Diffstat (limited to 'sys/dev/pci/if_wpi.c')
-rw-r--r-- | sys/dev/pci/if_wpi.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c index 3cdbf8af0ed..730ae5d9ab3 100644 --- a/sys/dev/pci/if_wpi.c +++ b/sys/dev/pci/if_wpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wpi.c,v 1.74 2008/11/25 17:06:26 damien Exp $ */ +/* $OpenBSD: if_wpi.c,v 1.75 2008/11/25 21:43:57 damien Exp $ */ /*- * Copyright (c) 2006-2008 @@ -1675,7 +1675,6 @@ wpi_tx(struct wpi_softc *sc, struct mbuf *m, struct ieee80211_node *ni) struct ieee80211_frame *wh; struct ieee80211_key *k = NULL; enum ieee80211_edca_ac ac; - struct mbuf *m1; uint32_t flags; uint16_t qos; u_int hdrlen; @@ -1851,24 +1850,10 @@ wpi_tx(struct wpi_softc *sc, struct mbuf *m, struct ieee80211_node *ni) } if (error != 0) { /* Too many DMA segments, linearize mbuf. */ - MGETHDR(m1, M_DONTWAIT, MT_DATA); - if (m1 == NULL) { + if (m_defrag(m, M_DONTWAIT) != 0) { m_freem(m); return ENOMEM; } - if (m->m_pkthdr.len > MHLEN) { - MCLGET(m1, M_DONTWAIT); - if (!(m1->m_flags & M_EXT)) { - m_freem(m); - m_freem(m1); - return ENOMEM; - } - } - m_copydata(m, 0, m->m_pkthdr.len, mtod(m1, caddr_t)); - m1->m_len = m1->m_pkthdr.len = m->m_pkthdr.len; - m_freem(m); - m = m1; - error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m, BUS_DMA_NOWAIT); if (error != 0) { |