From b58ef082af9dc030a07dbc0bf4e05646b33f24d0 Mon Sep 17 00:00:00 2001 From: kettenis Date: Tue, 4 Jul 2023 12:48:42 +0000 Subject: [PATCH] Handle rx error. ok jsing@, patrick@ --- sys/dev/ic/dwqe.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sys/dev/ic/dwqe.c b/sys/dev/ic/dwqe.c index 15c90859277..e11fee360ab 100644 --- a/sys/dev/ic/dwqe.c +++ b/sys/dev/ic/dwqe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwqe.c,v 1.9 2023/07/04 09:00:24 kettenis Exp $ */ +/* $OpenBSD: dwqe.c,v 1.10 2023/07/04 12:48:42 kettenis Exp $ */ /* * Copyright (c) 2008, 2019 Mark Kettenis * Copyright (c) 2017, 2022 Patrick Wildt @@ -672,15 +672,21 @@ dwqe_rx_proc(struct dwqe_softc *sc) len, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->sc_dmat, rxb->tb_map); - /* Strip off CRC. */ - len -= ETHER_CRC_LEN; - KASSERT(len > 0); - m = rxb->tb_m; rxb->tb_m = NULL; - m->m_pkthdr.len = m->m_len = len; - ml_enqueue(&ml, m); + if (rxd->sd_tdes3 & RDES3_ES) { + ifp->if_ierrors++; + m_freem(m); + } else { + /* Strip off CRC. */ + len -= ETHER_CRC_LEN; + KASSERT(len > 0); + + m->m_pkthdr.len = m->m_len = len; + + ml_enqueue(&ml, m); + } put++; if (sc->sc_rx_cons == (DWQE_NRXDESC - 1)) -- 2.20.1