diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-11-22 14:00:53 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-11-22 14:00:53 +0000 |
commit | b4179d47d583c89bf2a2d600971313a36484e7a9 (patch) | |
tree | 72e1ee4f1921be9b58f1bd1bc027e1b71f2a928c /sys | |
parent | fbe2860947706bdffd5cf9029c2ba0cff1d5c2fc (diff) |
avoid uninitialised variable use in igc(4)
read icr reg before testing bit in result
add missing block in rxeof from ix
ok kevlo@ patrick@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/if_igc.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/dev/pci/if_igc.c b/sys/dev/pci/if_igc.c index 875a3eb5bd1..e66ca876133 100644 --- a/sys/dev/pci/if_igc.c +++ b/sys/dev/pci/if_igc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_igc.c,v 1.4 2021/10/31 15:25:10 patrick Exp $ */ +/* $OpenBSD: if_igc.c,v 1.5 2021/11/22 14:00:52 jsg Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause * @@ -1283,7 +1283,7 @@ igc_rxeof(struct rx_ring *rxr) uint32_t ptype, staterr = 0; uint16_t len, vtag; uint8_t eop = 0; - int i; + int i, nextp; if (!ISSET(ifp->if_flags, IFF_RUNNING)) return 0; @@ -1342,6 +1342,17 @@ igc_rxeof(struct rx_ring *rxr) if_rxr_inuse(&rxr->rx_ring), rxr->last_desc_filled); } + if (!eop) { + /* + * Figure out the next descriptor of this frame. + */ + nextp = i + 1; + if (nextp == sc->num_rx_desc) + nextp = 0; + nxbuf = &rxr->rx_buffers[nextp]; + /* prefetch(nxbuf); */ + } + mp->m_len = len; m = rxbuf->fmp; @@ -1736,7 +1747,7 @@ int igc_intr_link(void *arg) { struct igc_softc *sc = (struct igc_softc *)arg; - uint32_t reg_icr; + uint32_t reg_icr = IGC_READ_REG(&sc->hw, IGC_ICR); if (reg_icr & IGC_ICR_LSC) { KERNEL_LOCK(); |