summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2014-04-14 04:58:50 +0000
committeryongari <yongari@FreeBSD.org>2014-04-14 04:58:50 +0000
commit6a63f9b17b4ecb245a6dbce023e5ac2d599c73a8 (patch)
tree8d009d1cbd3697be77256fd7f8138ee51db85654 /sys/dev
parentfa731335a20543877153a2aabbf27e200ec99974 (diff)
downloadFreeBSD-src-6a63f9b17b4ecb245a6dbce023e5ac2d599c73a8.zip
FreeBSD-src-6a63f9b17b4ecb245a6dbce023e5ac2d599c73a8.tar.gz
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.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ae/if_ae.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/sys/dev/ae/if_ae.c b/sys/dev/ae/if_ae.c
index f10763b..101d963 100644
--- a/sys/dev/ae/if_ae.c
+++ b/sys/dev/ae/if_ae.c
@@ -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) {
OpenPOWER on IntegriCloud