Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic When we init the hardware's rx/tx ring configurat...



details:   https://anonhg.NetBSD.org/src/rev/c98aec117927
branches:  trunk
changeset: 368590:c98aec117927
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jul 20 18:48:41 2022 +0000

description:
When we init the hardware's rx/tx ring configuration we need to
adjust our internal state, as this implicitly resets the current
descriptor pointer.
Previously "ifconfig eqos0 down; ifconfig eqos0 up" made the interface
non-functional.

diffstat:

 sys/dev/ic/dwc_eqos.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 94d6e7c4d16d -r c98aec117927 sys/dev/ic/dwc_eqos.c
--- a/sys/dev/ic/dwc_eqos.c     Wed Jul 20 18:25:10 2022 +0000
+++ b/sys/dev/ic/dwc_eqos.c     Wed Jul 20 18:48:41 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.6 2022/04/16 23:20:47 jmcneill Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.7 2022/07/20 18:48:41 martin Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.6 2022/04/16 23:20:47 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.7 2022/07/20 18:48:41 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -510,7 +510,13 @@
 static void
 eqos_init_rings(struct eqos_softc *sc, int qid)
 {
-       sc->sc_tx.queued = 0;
+       /*
+        * We reset the rings paddr, this implicitly resets
+        * the hardwares current descriptor pointer.
+        * Adjust our internal state accordingly.
+        */
+       sc->sc_tx.cur = sc->sc_tx.next = sc->sc_tx.queued = 0;
+       sc->sc_rx.cur = sc->sc_rx.next = sc->sc_rx.queued = 0;
 
        WR4(sc, GMAC_DMA_CHAN0_TX_BASE_ADDR_HI,
            (uint32_t)(sc->sc_tx.desc_ring_paddr >> 32));



Home | Main Index | Thread Index | Old Index