From ead4c37a5d8172d88956369616d5eda24d82bb5c Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Tue, 31 Aug 1999 04:22:46 +0000 Subject: [PATCH] Fix a couple of things that weren't quite right for not using PN_RX_BUG_WAR - it was freeing memory that may not have been allocated, and unconditionally bzero'ing the mbufs even if the workaround wasn't enabled. --- sys/pci/if_pn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/pci/if_pn.c b/sys/pci/if_pn.c index c3744dbe4058..63b9141cf72e 100644 --- a/sys/pci/if_pn.c +++ b/sys/pci/if_pn.c @@ -1295,7 +1295,8 @@ static int pn_detach(dev) free(sc->pn_ldata_ptr, M_DEVBUF); #ifdef PN_RX_BUG_WAR - free(sc->pn_rx_buf, M_DEVBUF); + if (sc->pn_rx_war) + free(sc->pn_rx_buf, M_DEVBUF); #endif ifmedia_removeall(&sc->ifmedia); @@ -1411,11 +1412,14 @@ static int pn_newbuf(sc, c, m) */ m_adj(m_new, sizeof(u_int64_t)); +#ifdef PN_RX_BUG_WAR /* * Zero the buffer. This is part of the workaround for the * promiscuous mode bug in the revision 33 PNIC chips. */ - bzero((char *)mtod(m_new, char *), m_new->m_len); + if (sc->pn_rx_war) + bzero((char *)mtod(m_new, char *), m_new->m_len); +#endif c->pn_mbuf = m_new; c->pn_ptr->pn_data = vtophys(mtod(m_new, caddr_t));