Module Name: src
Committed By: martin
Date: Thu Aug 22 19:22:35 UTC 2024
Modified Files:
src/sys/dev/pci [netbsd-10]: if_rge.c
Log Message:
Pull up following revision(s) (requested by mrg in ticket #782):
sys/dev/pci/if_rge.c: revision 1.29
- handle stuck transmitter (descriptor still owned)
- restart send queue after transmit
- count output packets
- use deferred start
Should fix PR 57694
To generate a diff of this commit:
cvs rdiff -u -r1.24.4.3 -r1.24.4.4 src/sys/dev/pci/if_rge.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/if_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.24.4.3 src/sys/dev/pci/if_rge.c:1.24.4.4
--- src/sys/dev/pci/if_rge.c:1.24.4.3 Sun Oct 22 06:25:32 2023
+++ src/sys/dev/pci/if_rge.c Thu Aug 22 19:22:35 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: if_rge.c,v 1.24.4.3 2023/10/22 06:25:32 martin Exp $ */
+/* $NetBSD: if_rge.c,v 1.24.4.4 2024/08/22 19:22:35 martin Exp $ */
/* $OpenBSD: if_rge.c,v 1.9 2020/12/12 11:48:53 jan Exp $ */
/*
@@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.24.4.3 2023/10/22 06:25:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.24.4.4 2024/08/22 19:22:35 martin Exp $");
#include <sys/types.h>
@@ -351,6 +351,7 @@ rge_attach(device_t parent, device_t sel
sc->sc_media.ifm_media = sc->sc_media.ifm_cur->ifm_media;
if_attach(ifp);
+ if_deferred_start_init(ifp, NULL);
ether_ifattach(ifp, eaddr);
if (pmf_device_register(self, NULL, NULL))
@@ -1385,10 +1386,14 @@ rge_txeof(struct rge_softc *sc)
m_freem(txq->txq_mbuf);
txq->txq_mbuf = NULL;
+ net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
if (txstat & (RGE_TDCMDSTS_EXCESSCOLL | RGE_TDCMDSTS_COLL))
- if_statinc(ifp, if_collisions);
+ if_statinc_ref(nsr, if_collisions);
if (txstat & RGE_TDCMDSTS_TXERR)
- if_statinc(ifp, if_oerrors);
+ if_statinc_ref(nsr, if_oerrors);
+ else
+ if_statinc_ref(nsr, if_opackets);
+ IF_STAT_PUTREF(ifp);
bus_dmamap_sync(sc->sc_dmat, sc->rge_ldata.rge_tx_list_map,
idx * sizeof(struct rge_tx_desc),
@@ -1404,24 +1409,12 @@ rge_txeof(struct rge_softc *sc)
sc->rge_ldata.rge_txq_considx = cons;
-#if 0
- if (ifq_is_oactive(&ifp->if_snd))
- ifq_restart(&ifp->if_snd);
- else if (free == 2)
- ifq_serialize(&ifp->if_snd, &sc->sc_task);
- else
- ifp->if_timer = 0;
-#else
-#if 0
- if (!IF_IS_EMPTY(&ifp->if_snd))
- rge_start(ifp);
- else
if (free == 2)
- if (0) { rge_txstart(&sc->sc_task, sc); }
- else
-#endif
- ifp->if_timer = 0;
-#endif
+ rge_txstart(&sc->sc_task, sc);
+
+ CLR(ifp->if_flags, IFF_OACTIVE);
+ ifp->if_timer = 0;
+ if_schedule_deferred_start(ifp);
return (1);
}