Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net tun(4): Omit TUN_RWAIT micro-optimization.
details: https://anonhg.NetBSD.org/src/rev/6d65230a5f77
branches: trunk
changeset: 363501:6d65230a5f77
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Mar 13 21:32:43 2022 +0000
description:
tun(4): Omit TUN_RWAIT micro-optimization.
cv_broadcast aleady has a fast path for no-waiters.
diffstat:
sys/net/if_tun.c | 24 +++++-------------------
sys/net/if_tun.h | 4 ++--
2 files changed, 7 insertions(+), 21 deletions(-)
diffs (94 lines):
diff -r 5b3e4d2c59aa -r 6d65230a5f77 sys/net/if_tun.c
--- a/sys/net/if_tun.c Sun Mar 13 21:32:35 2022 +0000
+++ b/sys/net/if_tun.c Sun Mar 13 21:32:43 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tun.c,v 1.169 2022/03/13 21:32:35 riastradh Exp $ */
+/* $NetBSD: if_tun.c,v 1.170 2022/03/13 21:32:43 riastradh Exp $ */
/*
* Copyright (c) 1988, Julian Onions <jpo%cs.nott.ac.uk@localhost>
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.169 2022/03/13 21:32:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.170 2022/03/13 21:32:43 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -330,10 +330,7 @@
}
mutex_exit(&tun_softc_lock);
- if (tp->tun_flags & TUN_RWAIT) {
- tp->tun_flags &= ~TUN_RWAIT;
- cv_broadcast(&tp->tun_cv);
- }
+ cv_broadcast(&tp->tun_cv);
if (tp->tun_flags & TUN_ASYNC && tp->tun_pgid)
fownsignal(tp->tun_pgid, SIGIO, POLL_HUP, 0, NULL);
selnotify(&tp->tun_rsel, 0, NOTE_SUBMIT);
@@ -654,15 +651,10 @@
}
mutex_enter(&tp->tun_lock);
- if (tp->tun_flags & TUN_RWAIT) {
- tp->tun_flags &= ~TUN_RWAIT;
- cv_broadcast(&tp->tun_cv);
- }
+ cv_broadcast(&tp->tun_cv);
if (tp->tun_flags & TUN_ASYNC && tp->tun_pgid)
softint_schedule(tp->tun_isih);
-
selnotify(&tp->tun_rsel, 0, NOTE_SUBMIT);
-
mutex_exit(&tp->tun_lock);
out:
if (error && m0)
@@ -823,8 +815,6 @@
goto out;
}
- tp->tun_flags &= ~TUN_RWAIT;
-
do {
IFQ_DEQUEUE(&ifp->if_snd, m0);
if (m0 == 0) {
@@ -832,7 +822,6 @@
error = EWOULDBLOCK;
goto out;
}
- tp->tun_flags |= TUN_RWAIT;
if (cv_wait_sig(&tp->tun_cv, &tp->tun_lock)) {
error = EINTR;
goto out;
@@ -1024,10 +1013,7 @@
mutex_enter(&tp->tun_lock);
if (!IF_IS_EMPTY(&ifp->if_snd)) {
- if (tp->tun_flags & TUN_RWAIT) {
- tp->tun_flags &= ~TUN_RWAIT;
- cv_broadcast(&tp->tun_cv);
- }
+ cv_broadcast(&tp->tun_cv);
if (tp->tun_flags & TUN_ASYNC && tp->tun_pgid)
softint_schedule(tp->tun_osih);
diff -r 5b3e4d2c59aa -r 6d65230a5f77 sys/net/if_tun.h
--- a/sys/net/if_tun.h Sun Mar 13 21:32:35 2022 +0000
+++ b/sys/net/if_tun.h Sun Mar 13 21:32:43 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tun.h,v 1.21 2022/03/13 21:31:58 riastradh Exp $ */
+/* $NetBSD: if_tun.h,v 1.22 2022/03/13 21:32:43 riastradh Exp $ */
/*
* Copyright (c) 1988, Julian Onions <jpo%cs.nott.ac.uk@localhost>
@@ -41,7 +41,7 @@
#define TUN_RCOLL 0x0004
#define TUN_IASET 0x0008
#define TUN_DSTADDR 0x0010
-#define TUN_RWAIT 0x0040
+#define TUN_UNUSED0 0x0040 /* was TUN_RWAIT */
#define TUN_ASYNC 0x0080
#define TUN_NBIO 0x0100
#define TUN_PREPADDR 0x0200
Home |
Main Index |
Thread Index |
Old Index