diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-09-13 14:42:53 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-09-13 14:42:53 +0000 |
commit | 72c9514b3fe03e2af58b7386b4ea1b1b8d03bb73 (patch) | |
tree | ddd67747f9e94367b396ade568c730dfa795adb5 /sys/dev/ic/acx.c | |
parent | 4eef650080d9b8f29430c67e8bfb02019d822601 (diff) |
M_DUP_PKTHDR() define -> m_dup_pkthdr() function to properly deal
with m_tag_copy_chain() failures.
Use m_defrag() to eliminate hand rolled defragging of mbufs and
some uses of M_DUP_PKTHDR().
Original diff from thib@, claudio@'s feedback integrated by me.
Tests kevlo@ claudio@, "reads ok" blambert@
ok thib@ claudio@, "m_defrag() bits ok" kettenis@
Diffstat (limited to 'sys/dev/ic/acx.c')
-rw-r--r-- | sys/dev/ic/acx.c | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/sys/dev/ic/acx.c b/sys/dev/ic/acx.c index 693923cbfa3..2f9fe36b098 100644 --- a/sys/dev/ic/acx.c +++ b/sys/dev/ic/acx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acx.c,v 1.94 2009/07/28 11:39:52 blambert Exp $ */ +/* $OpenBSD: acx.c,v 1.95 2009/09/13 14:42:52 krw Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -2222,38 +2222,10 @@ acx_encap(struct acx_softc *sc, struct acx_txbuf *txbuf, struct mbuf *m, if (error) { /* error == EFBIG */ /* too many fragments, linearize */ - struct mbuf *mnew; - - error = 0; - - MGETHDR(mnew, M_DONTWAIT, MT_DATA); - if (mnew == NULL) { - m_freem(m); - error = ENOBUFS; + if (m_defrag(m, M_DONTWAIT)) { printf("%s: can't defrag tx mbuf\n", ifp->if_xname); goto back; } - - M_DUP_PKTHDR(mnew, m); - if (m->m_pkthdr.len > MHLEN) { - MCLGET(mnew, M_DONTWAIT); - if (!(mnew->m_flags & M_EXT)) { - m_freem(m); - m_freem(mnew); - error = ENOBUFS; - } - } - - if (error) { - printf("%s: can't defrag tx mbuf\n", ifp->if_xname); - goto back; - } - - m_copydata(m, 0, m->m_pkthdr.len, mtod(mnew, caddr_t)); - m_freem(m); - mnew->m_len = mnew->m_pkthdr.len; - m = mnew; - error = bus_dmamap_load_mbuf(sc->sc_dmat, txbuf->tb_mbuf_dmamap, m, BUS_DMA_NOWAIT); if (error) { |