Date: Mon, 27 Sep 2010 18:22:50 +0000 (UTC) From: Pyun YongHyeon <yongari@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r213222 - stable/7/sys/dev/e1000 Message-ID: <201009271822.o8RIMoKr045895@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: yongari Date: Mon Sep 27 18:22:50 2010 New Revision: 213222 URL: http://svn.freebsd.org/changeset/base/213222 Log: MFC r211909: 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 Modified: stable/7/sys/dev/e1000/if_em.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/e1000/if_em.c ============================================================================== --- stable/7/sys/dev/e1000/if_em.c Mon Sep 27 18:20:56 2010 (r213221) +++ stable/7/sys/dev/e1000/if_em.c Mon Sep 27 18:22:50 2010 (r213222) @@ -3841,7 +3841,7 @@ em_setup_receive_ring(struct rx_ring *rx 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; @@ -3850,8 +3850,11 @@ em_setup_receive_ring(struct rx_ring *rx 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009271822.o8RIMoKr045895>