From 9fc852229b754a2e84ed71e34c852d06d9a07e61 Mon Sep 17 00:00:00 2001 From: Scott Long Date: Thu, 8 May 2008 15:05:38 +0000 Subject: The BCE chips appear to have an undocumented requirement that RX frames be aligned on an 8 byte boundary. Prior to rev 1.36 this wasn't a problem because mbuf clusters tend be naturally aligned. The switch to using split buffers with the first buffer being the embedded data area of the mbuf has broken this assumption, at least on i386, causing a complete failure of RX functionality. Fix this for now by using a full cluster for the first RX buffer. A more sophisticated approach could be done with the old buffer scheme to realign the m_data pointer with m_adj(), but I'm also not clear on performance benefits of this old scheme or the performance implications of adding an m_adj() call to every allocation. --- sys/dev/bce/if_bce.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sys/dev/bce') diff --git a/sys/dev/bce/if_bce.c b/sys/dev/bce/if_bce.c index 859d74fb7b8da..14bfcb992f4d5 100644 --- a/sys/dev/bce/if_bce.c +++ b/sys/dev/bce/if_bce.c @@ -776,7 +776,11 @@ bce_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Use standard mbuf sizes for buffer allocation. */ +#ifdef BCE_USE_SPLIT_HEADER sc->rx_bd_mbuf_alloc_size = MHLEN; +#else + sc->rx_bd_mbuf_alloc_size = MCLBYTES;; +#endif sc->pg_bd_mbuf_alloc_size = MCLBYTES; ifp->if_snd.ifq_drv_maxlen = USABLE_TX_BD; @@ -3804,7 +3808,11 @@ bce_get_rx_buf(struct bce_softc *sc, struct mbuf *m, u16 *prod, goto bce_get_rx_buf_exit); /* This is a new mbuf allocation. */ +#ifdef BCE_USE_SPLIT_HEADER MGETHDR(m_new, M_DONTWAIT, MT_DATA); +#else + m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); +#endif if (m_new == NULL) { sc->mbuf_alloc_failed++; rc = ENOBUFS; -- cgit v1.3