Index: if_em.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_em.c,v retrieving revision 1.308 diff -u -p -r1.308 if_em.c --- if_em.c 8 Oct 2015 09:21:26 -0000 1.308 +++ if_em.c 9 Oct 2015 05:01:22 -0000 @@ -229,7 +229,7 @@ void em_disable_aspm(struct em_softc *); void em_txeof(struct em_softc *); int em_allocate_receive_structures(struct em_softc *); int em_allocate_transmit_structures(struct em_softc *); -int em_rxfill(struct em_softc *); +int em_rxfill(struct em_softc *, int); void em_rxeof(struct em_softc *); void em_receive_checksum(struct em_softc *, struct em_rx_desc *, struct mbuf *); @@ -240,7 +240,7 @@ void em_iff(struct em_softc *); void em_print_hw_stats(struct em_softc *); #endif void em_update_link_status(struct em_softc *); -int em_get_buf(struct em_softc *, int); +int em_get_buf(struct em_softc *, int, int); void em_enable_hw_vlans(struct em_softc *); int em_encap(struct em_softc *, struct mbuf *); void em_smartspeed(struct em_softc *); @@ -931,7 +931,7 @@ em_intr(void *arg) KERNEL_UNLOCK(); } - if (refill && em_rxfill(sc)) { + if (refill && em_rxfill(sc, 0)) { /* Advance the Rx Queue #0 "Tail Pointer". */ E1000_WRITE_REG(&sc->hw, RDT, sc->last_rx_desc_filled); } @@ -2499,7 +2499,7 @@ em_txeof(struct em_softc *sc) * **********************************************************************/ int -em_get_buf(struct em_softc *sc, int i) +em_get_buf(struct em_softc *sc, int i, int wait) { struct mbuf *m; struct em_buffer *pkt; @@ -2515,7 +2515,7 @@ em_get_buf(struct em_softc *sc, int i) return (ENOBUFS); } - m = MCLGETI(NULL, M_DONTWAIT, NULL, EM_MCLBYTES); + m = MCLGETI(NULL, wait ? M_WAITOK : M_NOWAIT, NULL, EM_MCLBYTES); if (!m) { sc->mbuf_cluster_failed++; return (ENOBUFS); @@ -2525,7 +2525,8 @@ em_get_buf(struct em_softc *sc, int i) m_adj(m, ETHER_ALIGN); #endif - error = bus_dmamap_load_mbuf(sc->rxtag, pkt->map, m, BUS_DMA_NOWAIT); + error = bus_dmamap_load_mbuf(sc->rxtag, pkt->map, m, + wait ? BUS_DMA_WAITOK : BUS_DMA_NOWAIT); if (error) { m_freem(m); return (error); @@ -2617,7 +2618,7 @@ em_setup_receive_structures(struct em_so 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) { + if (em_rxfill(sc, 1) == 0) { printf("%s: unable to fill any rx descriptors\n", sc->sc_dv.dv_xname); } @@ -2773,7 +2774,7 @@ em_free_receive_structures(struct em_sof } int -em_rxfill(struct em_softc *sc) +em_rxfill(struct em_softc *sc, int wait) { u_int slots; int post = 0; @@ -2786,7 +2787,7 @@ em_rxfill(struct em_softc *sc) if (++i == sc->num_rx_desc) i = 0; - if (em_get_buf(sc, i) != 0) + if (em_get_buf(sc, i, wait) != 0) break; sc->last_rx_desc_filled = i;