summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2008-05-08 15:05:38 +0000
committerscottl <scottl@FreeBSD.org>2008-05-08 15:05:38 +0000
commit494160ee656e9d1bbcc0fb4d77980e3fd1d85da7 (patch)
tree83b682957de8bf14c63d3e91a9d3db035c744a3d /sys
parent24e48584df154f3ae44e20f1fd32177f7ad0d22f (diff)
downloadFreeBSD-src-494160ee656e9d1bbcc0fb4d77980e3fd1d85da7.zip
FreeBSD-src-494160ee656e9d1bbcc0fb4d77980e3fd1d85da7.tar.gz
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.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/bce/if_bce.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/dev/bce/if_bce.c b/sys/dev/bce/if_bce.c
index 859d74f..14bfcb9 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;
OpenPOWER on IntegriCloud