Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jan 2011 23:15:09 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r217385 - head/sys/dev/re
Message-ID:  <201101132315.p0DNF9dM066973@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Thu Jan 13 23:15:09 2011
New Revision: 217385
URL: http://svn.freebsd.org/changeset/base/217385

Log:
  If driver is not able to allocate RX buffer, do not start driver.
  While I'm here move RX buffer allocation and descriptor
  initialization up to not touch hardware registers in case of RX
  buffer allocation failure.

Modified:
  head/sys/dev/re/if_re.c

Modified: head/sys/dev/re/if_re.c
==============================================================================
--- head/sys/dev/re/if_re.c	Thu Jan 13 23:00:28 2011	(r217384)
+++ head/sys/dev/re/if_re.c	Thu Jan 13 23:15:09 2011	(r217385)
@@ -2622,6 +2622,16 @@ re_init_locked(struct rl_softc *sc)
 	re_reset(sc);
 
 	/*
+	 * For C+ mode, initialize the RX descriptors and mbufs.
+	 */
+	if (re_rx_list_init(sc) != 0) {
+		device_printf(sc->rl_dev, "no memory for RX buffers\n");
+		re_stop(sc);
+		return;
+	}
+	re_tx_list_init(sc);
+
+	/*
 	 * Enable C+ RX and TX mode, as well as VLAN stripping and
 	 * RX checksum offload. We must configure the C+ register
 	 * before all others.
@@ -2673,12 +2683,6 @@ re_init_locked(struct rl_softc *sc)
 	CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
 
 	/*
-	 * For C+ mode, initialize the RX descriptors and mbufs.
-	 */
-	re_rx_list_init(sc);
-	re_tx_list_init(sc);
-
-	/*
 	 * Load the addresses of the RX and TX lists into the chip.
 	 */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101132315.p0DNF9dM066973>