From owner-svn-src-all@FreeBSD.ORG Sat Aug 28 00:16:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3177F1065695; Sat, 28 Aug 2010 00:16:50 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 212738FC16; Sat, 28 Aug 2010 00:16:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7S0GoYP012177; Sat, 28 Aug 2010 00:16:50 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7S0GoVQ012175; Sat, 28 Aug 2010 00:16:50 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008280016.o7S0GoVQ012175@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 28 Aug 2010 00:16:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211909 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Aug 2010 00:16:50 -0000 Author: yongari Date: Sat Aug 28 00:16:49 2010 New Revision: 211909 URL: http://svn.freebsd.org/changeset/base/211909 Log: 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: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sat Aug 28 00:09:46 2010 (r211908) +++ head/sys/dev/e1000/if_em.c Sat Aug 28 00:16:49 2010 (r211909) @@ -3843,7 +3843,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; @@ -3852,8 +3852,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);