From 4ba1d670a473fc8c0d7e96e5a67f791be6dca38d Mon Sep 17 00:00:00 2001 From: dlg Date: Mon, 12 Aug 2024 06:47:11 +0000 Subject: [PATCH] try harder to leave a gap on the tx ring. i think before this change we could overwrite entries on the ring, which can confuse the chip and the tx completion code. i think. it's funny how much a comparison hurts my brain. ok patrick@ tested by and ok kevlo@ --- sys/dev/ic/re.c | 4 ++-- sys/dev/pci/if_rge.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c index 29074188922..a8967f686df 100644 --- a/sys/dev/ic/re.c +++ b/sys/dev/ic/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.217 2024/01/19 03:46:14 dlg Exp $ */ +/* $OpenBSD: re.c,v 1.218 2024/08/12 06:47:11 dlg Exp $ */ /* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -1834,7 +1834,7 @@ re_start(struct ifqueue *ifq) free -= idx; for (;;) { - if (sc->rl_ldata.rl_tx_ndescs >= free + 2) { + if (free < sc->rl_ldata.rl_tx_ndescs + 2) { ifq_set_oactive(ifq); break; } diff --git a/sys/dev/pci/if_rge.c b/sys/dev/pci/if_rge.c index b6ba51494d5..4309f2cdf46 100644 --- a/sys/dev/pci/if_rge.c +++ b/sys/dev/pci/if_rge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rge.c,v 1.28 2024/08/10 21:53:06 patrick Exp $ */ +/* $OpenBSD: if_rge.c,v 1.29 2024/08/12 06:47:11 dlg Exp $ */ /* * Copyright (c) 2019, 2020, 2023, 2024 @@ -581,7 +581,7 @@ rge_start(struct ifqueue *ifq) free -= idx; for (;;) { - if (RGE_TX_NSEGS >= free + 2) { + if (free < RGE_TX_NSEGS + 2) { ifq_set_oactive(&ifp->if_snd); break; } -- 2.20.1