From: kettenis Date: Tue, 12 May 2015 20:20:18 +0000 (+0000) Subject: Make sure the rx ring lwm is set to at least 4. As far as we know, all X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9a39b166e45206f985fb015f90a387e6545f07ce;p=openbsd Make sure the rx ring lwm is set to at least 4. As far as we know, all hardware variants need at least 4 descriptors on the rx ring to be able to receive packets. Should fix the issue reported by Christian Schulte on bugs@. ok mikeb@, sthen@ --- diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index cc55e79f685..908e74ff506 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.296 2015/05/12 02:33:39 jsg Exp $ */ +/* $OpenBSD: if_em.c,v 1.297 2015/05/12 20:20:18 kettenis Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include @@ -2599,6 +2599,7 @@ int em_setup_receive_structures(struct em_softc *sc) { struct ifnet *ifp = &sc->interface_data.ac_if; + u_int lwm; memset(sc->rx_desc_base, 0, sizeof(struct em_rx_desc) * sc->num_rx_desc); @@ -2610,8 +2611,8 @@ em_setup_receive_structures(struct em_softc *sc) sc->next_rx_desc_to_check = 0; sc->last_rx_desc_filled = sc->num_rx_desc - 1; - if_rxr_init(&sc->rx_ring, 2 * ((ifp->if_hardmtu / MCLBYTES) + 1), - sc->num_rx_desc); + lwm = max(4, 2 * ((ifp->if_hardmtu / MCLBYTES) + 1)); + if_rxr_init(&sc->rx_ring, lwm, sc->num_rx_desc); if (em_rxfill(sc) == 0) { printf("%s: unable to fill any rx descriptors\n",