Date: Fri, 10 Mar 2006 00:07:53 GMT From: Olivier Houchard <cognet@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 93082 for review Message-ID: <200603100007.k2A07r3r040508@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=93082 Change 93082 by cognet@cognet on 2006/03/10 00:06:58 Split the received mbuf into two mbuf, for alignment constraints. Affected files ... .. //depot/projects/arm/src/sys/arm/at91/if_ate.c#35 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/if_ate.c#35 (text+ko) ==== @@ -74,7 +74,7 @@ #include "miibus_if.h" #define ATE_MAX_TX_BUFFERS 2 /* We have ping-pong tx buffers */ -#define ATE_MAX_RX_BUFFERS 64 +#define ATE_MAX_RX_BUFFERS 8 struct ate_softc { @@ -579,7 +579,7 @@ struct ate_softc *sc = xsc; int status; int i; - struct mbuf *mb; + struct mbuf *mb, *tmp_mbuf; bus_dma_segment_t seg; int rx_stat; int nsegs; @@ -630,8 +630,6 @@ * the new buffer is loaded for dma. */ sc->rx_mbuf[i] = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - sc->rx_mbuf[i]->m_len = - sc->rx_mbuf[i]->m_pkthdr.len = MCLBYTES; if (!sc->rx_mbuf[i]) { printf("Failed to get another mbuf -- discarding packet\n"); sc->rx_mbuf[i] = mb; @@ -642,6 +640,8 @@ BUS_DMASYNC_PREWRITE); continue; } + sc->rx_mbuf[i]->m_len = + sc->rx_mbuf[i]->m_pkthdr.len = MCLBYTES; bus_dmamap_unload(sc->rxtag, sc->rx_map[i]); if (bus_dmamap_load_mbuf_sg(sc->rxtag, sc->rx_map[i], sc->rx_mbuf[i], &seg, &nsegs, 0) != 0) { @@ -657,6 +657,7 @@ mb->m_len = rx_stat & ETH_LEN_MASK; mb->m_pkthdr.len = mb->m_len; mb->m_pkthdr.rcvif = sc->ifp; + tmp_mbuf = m_copyup(mb, ETHER_HDR_LEN, 2); /* * For the last buffer, set the wrap bit so * the controller restarts from the first @@ -670,7 +671,7 @@ BUS_DMASYNC_PREREAD); bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, BUS_DMASYNC_PREWRITE); - (*sc->ifp->if_input)(sc->ifp, mb); + (*sc->ifp->if_input)(sc->ifp, tmp_mbuf); } } if (status & ETH_ISR_TCOM) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603100007.k2A07r3r040508>