Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/cavium/dev Move the send queue checking to a n...



details:   https://anonhg.NetBSD.org/src/rev/8be04ee733b3
branches:  trunk
changeset: 1021331:8be04ee733b3
user:      simonb <simonb%NetBSD.org@localhost>
date:      Thu May 27 03:23:29 2021 +0000

description:
Move the send queue checking to a new function, and also call this
in the rx interrupt path.  Measureable improvement on a NFS "create
small files" test.

diffstat:

 sys/arch/mips/cavium/dev/if_cnmac.c |  36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diffs (82 lines):

diff -r 4c614fa1d87d -r 8be04ee733b3 sys/arch/mips/cavium/dev/if_cnmac.c
--- a/sys/arch/mips/cavium/dev/if_cnmac.c       Thu May 27 01:43:32 2021 +0000
+++ b/sys/arch/mips/cavium/dev/if_cnmac.c       Thu May 27 03:23:29 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $     */
+/*     $NetBSD: if_cnmac.c,v 1.26 2021/05/27 03:23:29 simonb Exp $     */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.26 2021/05/27 03:23:29 simonb Exp $");
 
 /*
  * If no free send buffer is available, free all the sent buffers and bail out.
@@ -122,6 +122,7 @@
 static inline void cnmac_send_queue_flush_fetch(struct cnmac_softc *);
 static inline void cnmac_send_queue_flush(struct cnmac_softc *);
 static inline void cnmac_send_queue_flush_sync(struct cnmac_softc *);
+static void cnmac_send_queue_check_and_flush(struct cnmac_softc *);
 static inline int cnmac_send_queue_is_full(struct cnmac_softc *);
 static inline void cnmac_send_queue_add(struct cnmac_softc *, struct mbuf *,
     uint64_t *);
@@ -604,6 +605,23 @@
        return 0;
 }
 
+static void
+cnmac_send_queue_check_and_flush(struct cnmac_softc *sc)
+{
+       int s;
+
+       /* XXX XXX XXX */
+       s = splnet();
+       if (sc->sc_soft_req_cnt > 0) {
+               cnmac_send_queue_flush_prefetch(sc);
+               cnmac_send_queue_flush_fetch(sc);
+               cnmac_send_queue_flush(sc);
+               cnmac_send_queue_flush_sync(sc);
+       }
+       splx(s);
+       /* XXX XXX XXX */
+}
+
 /*
  * (Ab)use m_nextpkt and m_paddr to maintain mbuf chain and pointer to gather
  * buffer.  Other mbuf members may be used by m_freem(), so don't touch them!
@@ -1299,6 +1317,8 @@
                }
 
                (void)cnmac_recv(sc, work);
+
+               cnmac_send_queue_check_and_flush(sc);
        }
 
        _POW_WR8(sc->sc_pow, POW_WQ_INT_OFFSET, wqmask);
@@ -1326,21 +1346,11 @@
 {
        struct cnmac_softc *sc = arg;
        int timo;
-       int s;
 
-       s = splnet();
-       /* XXX XXX XXX */
-       if (sc->sc_soft_req_cnt > 0) {
-               cnmac_send_queue_flush_prefetch(sc);
-               cnmac_send_queue_flush_fetch(sc);
-               cnmac_send_queue_flush(sc);
-               cnmac_send_queue_flush_sync(sc);
-       }
-       /* XXX XXX XXX */
+       cnmac_send_queue_check_and_flush(sc);
 
        timo = (sc->sc_ext_callback_cnt > 0) ? 1 : hz;
        callout_schedule(&sc->sc_tick_free_ch, timo);
-       splx(s);
 }
 
 /*



Home | Main Index | Thread Index | Old Index