Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Apr 2014 04:59:47 +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-9@freebsd.org
Subject:   svn commit: r264445 - stable/9/sys/dev/ae
Message-ID:  <201404140459.s3E4xlVk036856@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Mon Apr 14 04:59:46 2014
New Revision: 264445
URL: http://svnweb.freebsd.org/changeset/base/264445

Log:
  MFC r259543:
    Failed m_devget(9) indicates lack of free mbuf cluster.  Update
    if_iqdrops counter for that case since the received frame is ok.
    While here, simplify updating counter logic.

Modified:
  stable/9/sys/dev/ae/if_ae.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/ae/if_ae.c
==============================================================================
--- stable/9/sys/dev/ae/if_ae.c	Mon Apr 14 04:58:50 2014	(r264444)
+++ stable/9/sys/dev/ae/if_ae.c	Mon Apr 14 04:59:46 2014	(r264445)
@@ -132,7 +132,7 @@ static void	ae_mac_config(ae_softc_t *sc
 static int	ae_intr(void *arg);
 static void	ae_int_task(void *arg, int pending);
 static void	ae_tx_intr(ae_softc_t *sc);
-static int	ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd);
+static void	ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd);
 static void	ae_rx_intr(ae_softc_t *sc);
 static void	ae_watchdog(ae_softc_t *sc);
 static void	ae_tick(void *arg);
@@ -1881,7 +1881,7 @@ ae_tx_intr(ae_softc_t *sc)
 	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 }
 
-static int
+static void
 ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd)
 {
 	struct ifnet *ifp;
@@ -1900,12 +1900,15 @@ ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd)
 	size = le16toh(rxd->len) - ETHER_CRC_LEN;
 	if (size < (ETHER_MIN_LEN - ETHER_CRC_LEN - ETHER_VLAN_ENCAP_LEN)) {
 		if_printf(ifp, "Runt frame received.");
-		return (EIO);
+		ifp->if_ierrors++;
+		return;
 	}
 
 	m = m_devget(&rxd->data[0], size, ETHER_ALIGN, ifp, NULL);
-	if (m == NULL)
-		return (ENOBUFS);
+	if (m == NULL) {
+		ifp->if_iqdrops++;
+		return;
+	}
 
 	if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 &&
 	    (flags & AE_RXD_HAS_VLAN) != 0) {
@@ -1913,14 +1916,13 @@ ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd)
 		m->m_flags |= M_VLANTAG;
 	}
 
+	ifp->if_ipackets++;
 	/*
 	 * Pass it through.
 	 */
 	AE_UNLOCK(sc);
 	(*ifp->if_input)(ifp, m);
 	AE_LOCK(sc);
-
-	return (0);
 }
 
 static void
@@ -1929,7 +1931,7 @@ ae_rx_intr(ae_softc_t *sc)
 	ae_rxd_t *rxd;
 	struct ifnet *ifp;
 	uint16_t flags;
-	int count, error;
+	int count;
 
 	KASSERT(sc != NULL, ("[ae, %d]: sc is NULL!", __LINE__));
 
@@ -1957,17 +1959,10 @@ ae_rx_intr(ae_softc_t *sc)
 		 */
 		sc->rxd_cur = (sc->rxd_cur + 1) % AE_RXD_COUNT_DEFAULT;
 
-		if ((flags & AE_RXD_SUCCESS) == 0) {
-			ifp->if_ierrors++;
-			continue;
-		}
-		error = ae_rxeof(sc, rxd);
-		if (error != 0) {
+		if ((flags & AE_RXD_SUCCESS) != 0)
+			ae_rxeof(sc, rxd);
+		else
 			ifp->if_ierrors++;
-			continue;
-		} else {
-			ifp->if_ipackets++;
-		}
 	}
 
 	if (count > 0) {



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