From 81fd86580b9a42ebb051237ca298907020daf85d Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 7 Jul 2021 21:12:51 +0000 Subject: [PATCH] When the list of free RX descriptors fills up completely, the consumed and produced index are equal. The RX refill operation did not refill in that case, because it believed that this means there's nothing to do. In that case no RX buffers were allocated, and the RX descriptor ring went dry forever. Instead loop until we reach an empty freelist entry. --- sys/dev/fdt/if_mvpp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/dev/fdt/if_mvpp.c b/sys/dev/fdt/if_mvpp.c index 1894dd2abfd..61f7803d536 100644 --- a/sys/dev/fdt/if_mvpp.c +++ b/sys/dev/fdt/if_mvpp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mvpp.c,v 1.46 2021/06/03 21:42:23 patrick Exp $ */ +/* $OpenBSD: if_mvpp.c,v 1.47 2021/07/07 21:12:51 patrick Exp $ */ /* * Copyright (c) 2008, 2019 Mark Kettenis * Copyright (c) 2017, 2020 Patrick Wildt @@ -2241,8 +2241,7 @@ mvpp2_rx_refill(struct mvpp2_port *sc) KASSERT(pool < sc->sc->sc_npools); bm = &sc->sc->sc_bm_pools[pool]; - while (bm->free_cons != bm->free_prod) { - KASSERT(bm->freelist[bm->free_cons] != -1); + while (bm->freelist[bm->free_cons] != -1) { virt = bm->freelist[bm->free_cons]; KASSERT(((virt >> 16) & 0xffff) == pool); KASSERT((virt & 0xffff) < MVPP2_BM_SIZE); -- 2.20.1