From 19a3e3add0eeb9cd6220d0cb0c65cd9159a1ae53 Mon Sep 17 00:00:00 2001 From: wpaul Date: Tue, 24 Aug 1999 03:19:45 +0000 Subject: Change PN_RXLEN from 1518 bytes to 1536 bytes. The chip always DMAs data in 4 byte chunks. It turns out that with the 82c169C on the Netgear FA-310TX Rev D2, if you tell the chip you have reserved a buffer of 1518 bytes, it will actually treat it as 1516 bytes since 1518 is divisible by four. Consequently, a packet of 1514 bytes will always end up consuming two buffers: the last coupleof bytes will spill over into the next descriptor. This causes the pn_rx_bug_war() routine to trip unnecessarily. I'm not sure if the 82c169B or 82c168 chips behave the same way; I'll have to check them. In any case, this change should work just as well with them. Note that the FA-310TX Rev D2 also has a Broadcom PHY instead of a Level One LXT970 PHY, however this shouldn't make any difference as far as the driver is concerned. This change also allows me to do a way with one rounding overation in pn_rx-buf_war(). --- sys/pci/if_pn.c | 8 ++++---- sys/pci/if_pnreg.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'sys/pci') diff --git a/sys/pci/if_pn.c b/sys/pci/if_pn.c index 20f968e..02d5a48 100644 --- a/sys/pci/if_pn.c +++ b/sys/pci/if_pn.c @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_pn.c,v 1.53 1999/05/28 18:45:26 wpaul Exp wpaul $ + * $Id: if_pn.c,v 1.24 1999/07/28 02:19:51 wpaul Exp $ */ /* @@ -105,7 +105,7 @@ #ifndef lint static const char rcsid[] = - "$Id: if_pn.c,v 1.53 1999/05/28 18:45:26 wpaul Exp wpaul $"; + "$Id: if_pn.c,v 1.24 1999/07/28 02:19:51 wpaul Exp $"; #endif /* @@ -1158,7 +1158,7 @@ static int pn_attach(dev) if (revision == PN_169B_REV || revision == PN_169_REV || (revision & 0xF0) == PN_168_REV) { sc->pn_rx_war = 1; - sc->pn_rx_buf = malloc(PN_RXLEN * 16, M_DEVBUF, M_NOWAIT); + sc->pn_rx_buf = malloc(PN_RXLEN * 5, M_DEVBUF, M_NOWAIT); if (sc->pn_rx_buf == NULL) { printf("pn%d: no memory for workaround buffer\n", unit); bus_teardown_intr(dev, sc->pn_irq, sc->pn_intrhand); @@ -1496,7 +1496,7 @@ static void pn_rx_bug_war(sc, cur_rx) while ((c->pn_ptr->pn_status & PN_WHOLEFRAME) != PN_WHOLEFRAME) { rxstat = c->pn_ptr->pn_status; m_copydata(c->pn_mbuf, 0, PN_RXLEN, ptr); - ptr += PN_RXLEN - 2; /* round down to 32-bit boundary */ + ptr += PN_RXLEN; if (c == cur_rx) break; if (rxstat & PN_RXSTAT_LASTFRAG) diff --git a/sys/pci/if_pnreg.h b/sys/pci/if_pnreg.h index ce1294a..7072353 100644 --- a/sys/pci/if_pnreg.h +++ b/sys/pci/if_pnreg.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_pnreg.h,v 1.27 1999/05/28 18:45:26 wpaul Exp wpaul $ + * $Id: if_pnreg.h,v 1.15 1999/07/28 02:19:52 wpaul Exp $ */ /* @@ -393,7 +393,7 @@ struct pn_desc { #define PN_TX_LIST_CNT 128 #define PN_MIN_FRAMELEN 60 #define PN_FRAMELEN 1536 -#define PN_RXLEN 1518 +#define PN_RXLEN 1536 #define ETHER_ALIGN 2 /* -- cgit v1.1