diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2008-12-21 18:19:59 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2008-12-21 18:19:59 +0000 |
commit | 7731f3f93e4d9f387f756d9c9093394fd7636524 (patch) | |
tree | b9b4a3e5770d66a19dd94b319555b31eab383e9f /sys/dev/ic/rt2560.c | |
parent | a35971bc8438b357afff7f1214830daf00063b6a (diff) |
Undo m_defrag().
m_defrag() does not work. It seems to assume that if the length of
the mbuf passed as parameter is less than MHLEN, then it is an mbuf
header and not a cluster (or something like that.)
It thus fails miserably in the bcopy path.
I don't have the time to investigate further into this.
Thanks to Okan Demirmen for reporting the issue on a ral(4) RT2560.
The RT2560 chipset does not support TX scatter and thus m_defrag()
was called much more often than in other drivers using m_defrag()
where it was less noticeable.
Diffstat (limited to 'sys/dev/ic/rt2560.c')
-rw-r--r-- | sys/dev/ic/rt2560.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index 4981fc06a59..e24147275e5 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2560.c,v 1.40 2008/11/25 21:43:57 damien Exp $ */ +/* $OpenBSD: rt2560.c,v 1.41 2008/12/21 18:19:58 damien Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1699,6 +1699,7 @@ rt2560_tx_data(struct rt2560_softc *sc, struct mbuf *m0, struct rt2560_tx_data *data; struct ieee80211_frame *wh; struct ieee80211_key *k; + struct mbuf *m1; uint16_t dur; uint32_t flags = 0; int pktlen, rate, needcts = 0, needrts = 0, error; @@ -1827,10 +1828,24 @@ rt2560_tx_data(struct rt2560_softc *sc, struct mbuf *m0, } if (error != 0) { /* too many fragments, linearize */ - if (m_defrag(m0, M_DONTWAIT) != 0) { + MGETHDR(m1, MT_DATA, M_DONTWAIT); + if (m1 == NULL) { m_freem(m0); - return ENOMEM; + return ENOBUFS; + } + if (m0->m_pkthdr.len > MHLEN) { + MCLGET(m1, M_DONTWAIT); + if (!(m1->m_flags & M_EXT)) { + m_freem(m0); + m_freem(m1); + return ENOBUFS; + } } + m_copydata(m0, 0, m0->m_pkthdr.len, mtod(m1, caddr_t)); + m1->m_pkthdr.len = m1->m_len = m0->m_pkthdr.len; + m_freem(m0); + m0 = m1; + error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m0, BUS_DMA_NOWAIT); if (error != 0) { |