Date: Sat, 8 Jan 2005 00:03:40 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 68506 for review Message-ID: <200501080003.j0803ecq077578@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=68506 Change 68506 by sam@sam_ebb on 2005/01/08 00:02:56 o use m_defrag when packet is too fragmented for pre-allocated tx descriptor space o don't panic if m_defrag gives us back a packet w/ >1 segment [m_defrag is too expensive for our needs; it blindly copies everything to compact, need to roll our own or make m_defrag smarer--e.g. supply max frags permitted] Affected files ... .. //depot/projects/wifi/sys/dev/ath/if_ath.c#59 edit Differences ... ==== //depot/projects/wifi/sys/dev/ath/if_ath.c#59 (text+ko) ==== @@ -2926,7 +2926,6 @@ u_int8_t cix = 0xff; /* NB: silence compiler */ struct ath_desc *ds, *ds0; struct ath_txq *txq; - struct mbuf *m; struct ieee80211_frame *wh; u_int subtype, flags, ctsduration; HAL_PKT_TYPE atype; @@ -3007,24 +3006,12 @@ */ if (bf->bf_nseg > ATH_TXDESC) { /* too many desc's, linearize */ sc->sc_stats.ast_tx_linear++; - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) { + m0 = m_defrag(m0, M_DONTWAIT); + if (m0 == NULL) { sc->sc_stats.ast_tx_nombuf++; m_freem(m0); return ENOMEM; } - M_MOVE_PKTHDR(m, m0); - MCLGET(m, M_DONTWAIT); - if ((m->m_flags & M_EXT) == 0) { - sc->sc_stats.ast_tx_nomcl++; - m_freem(m0); - m_free(m); - return ENOMEM; - } - m_copydata(m0, 0, m0->m_pkthdr.len, mtod(m, caddr_t)); - m_freem(m0); - m->m_len = m->m_pkthdr.len; - m0 = m; error = bus_dmamap_load_mbuf(sc->sc_dmat, bf->bf_dmamap, m0, ath_mbuf_load_cb, bf, BUS_DMA_NOWAIT); @@ -3033,8 +3020,8 @@ m_freem(m0); return error; } - KASSERT(bf->bf_nseg == 1, - ("packet not one segment; nseg %u", bf->bf_nseg)); + KASSERT(bf->bf_nseg <= ATH_TXDESC, + ("too many segments after defrag; nseg %u", bf->bf_nseg)); } else if (bf->bf_nseg == 0) { /* null packet, discard */ sc->sc_stats.ast_tx_nodata++; m_freem(m0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200501080003.j0803ecq077578>