Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Always hold tx lock in deferred transmit to send...



details:   https://anonhg.NetBSD.org/src/rev/00688bace91e
branches:  trunk
changeset: 933353:00688bace91e
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Mon May 25 09:25:31 2020 +0000

description:
Always hold tx lock in deferred transmit to send all packets

There may be packets that enqueued before another transmission
releases the lock after finish of its transmission.
When using mutex_try_enter(), vioif_deferred_transmit() can not
sends them.

pointed out by knakahara@n.o

diffstat:

 sys/dev/pci/if_vioif.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (32 lines):

diff -r 1fcda140b2dc -r 00688bace91e sys/dev/pci/if_vioif.c
--- a/sys/dev/pci/if_vioif.c    Mon May 25 09:07:43 2020 +0000
+++ b/sys/dev/pci/if_vioif.c    Mon May 25 09:25:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vioif.c,v 1.59 2020/05/25 09:07:43 yamaguchi Exp $  */
+/*     $NetBSD: if_vioif.c,v 1.60 2020/05/25 09:25:31 yamaguchi Exp $  */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.59 2020/05/25 09:07:43 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.60 2020/05/25 09:25:31 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1432,10 +1432,9 @@
        struct vioif_softc *sc = device_private(virtio_child(vsc));
        struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 
-       if (mutex_tryenter(txq->txq_lock)) {
-               vioif_send_common_locked(ifp, txq, true);
-               mutex_exit(txq->txq_lock);
-       }
+       mutex_enter(txq->txq_lock);
+       vioif_send_common_locked(ifp, txq, true);
+       mutex_exit(txq->txq_lock);
 }
 
 static int



Home | Main Index | Thread Index | Old Index