Module Name:    src
Committed By:   riastradh
Date:           Wed Apr 17 18:52:54 UTC 2024

Modified Files:
        src/sys/net: if_tap.c

Log Message:
tap(4): Just use mutex_enter.

PR kern/58167


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/net/if_tap.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/net/if_tap.c
diff -u src/sys/net/if_tap.c:1.131 src/sys/net/if_tap.c:1.132
--- src/sys/net/if_tap.c:1.131	Wed Apr 17 18:52:39 2024
+++ src/sys/net/if_tap.c	Wed Apr 17 18:52:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tap.c,v 1.131 2024/04/17 18:52:39 riastradh Exp $	*/
+/*	$NetBSD: if_tap.c,v 1.132 2024/04/17 18:52:54 riastradh Exp $	*/
 
 /*
  *  Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.131 2024/04/17 18:52:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.132 2024/04/17 18:52:54 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 
@@ -857,13 +857,7 @@ tap_dev_read(int unit, struct uio *uio, 
 	if ((ifp->if_flags & IFF_UP) == 0)
 		return EHOSTDOWN;
 
-	/* In the TAP_NBIO case, we have to make sure we won't be sleeping */
-	if ((sc->sc_flags & TAP_NBIO) != 0) {
-		if (!mutex_tryenter(&sc->sc_lock))
-			return EWOULDBLOCK;
-	} else
-		mutex_enter(&sc->sc_lock);
-
+	mutex_enter(&sc->sc_lock);
 	if (IFQ_IS_EMPTY(&ifp->if_snd)) {
 		ifp->if_flags &= ~IFF_OACTIVE;
 		if (sc->sc_flags & TAP_NBIO)

Reply via email to