diff options
author | yongari <yongari@FreeBSD.org> | 2010-08-28 00:16:49 +0000 |
---|---|---|
committer | yongari <yongari@FreeBSD.org> | 2010-08-28 00:16:49 +0000 |
commit | dca3c7eeb42a77b207d7614b9745ecc60a399536 (patch) | |
tree | 77a922cb798e6b94e5a4270c8f67446a03f23b84 /sys/dev/e1000 | |
parent | af0e7d98f0484bd360c34c0be0464894143dd158 (diff) | |
download | FreeBSD-src-dca3c7eeb42a77b207d7614b9745ecc60a399536.zip FreeBSD-src-dca3c7eeb42a77b207d7614b9745ecc60a399536.tar.gz |
If em(4) failed to allocate RX buffers, do not call panic(9).
Just showing some buffer allocation error is more appropriate
action for drivers. This should fix occasional panic reported on
em(4) when driver encountered resource shortage.
Reviewed by: jfv
Diffstat (limited to 'sys/dev/e1000')
-rw-r--r-- | sys/dev/e1000/if_em.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 86f28e3..56859ea 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -3843,7 +3843,7 @@ em_setup_receive_ring(struct rx_ring *rxr) rxbuf = &rxr->rx_buffers[j]; rxbuf->m_head = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (rxbuf->m_head == NULL) - panic("RX ring hdr initialization failed!\n"); + return (ENOBUFS); rxbuf->m_head->m_len = MCLBYTES; rxbuf->m_head->m_flags &= ~M_HASFCS; /* we strip it */ rxbuf->m_head->m_pkthdr.len = MCLBYTES; @@ -3852,8 +3852,11 @@ em_setup_receive_ring(struct rx_ring *rxr) error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxbuf->map, rxbuf->m_head, seg, &nsegs, BUS_DMA_NOWAIT); - if (error != 0) - panic("RX ring dma initialization failed!\n"); + if (error != 0) { + m_freem(rxbuf->m_head); + rxbuf->m_head = NULL; + return (error); + } bus_dmamap_sync(rxr->rxtag, rxbuf->map, BUS_DMASYNC_PREREAD); |