summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2017-01-04 03:12:54 +0000
committerdlg <dlg@openbsd.org>2017-01-04 03:12:54 +0000
commit0e2f71724dcc8ecf04429140acf094b107a7e058 (patch)
tree0a9e7a3d672fb22dd0dedd07d6b177d37cf9bf3d
parentrelax PKCS#11 whitelist a bit to allow libexec as well as lib (diff)
downloadwireguard-openbsd-0e2f71724dcc8ecf04429140acf094b107a7e058.tar.xz
wireguard-openbsd-0e2f71724dcc8ecf04429140acf094b107a7e058.zip
make if_input return early if the mbuf list is empty.
this saves doing wakeups of the softnet thread. ok deraadt@
-rw-r--r--sys/net/if.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 85ccf2e62a0..9c4c639ede8 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.470 2017/01/03 13:11:55 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.471 2017/01/04 03:12:54 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -624,6 +624,9 @@ if_input(struct ifnet *ifp, struct mbuf_list *ml)
caddr_t if_bpf;
#endif
+ if (ml_empty(ml))
+ return;
+
MBUF_LIST_FOREACH(ml, m) {
m->m_pkthdr.ph_ifidx = ifp->if_index;
m->m_pkthdr.ph_rtableid = ifp->if_rdomain;
@@ -649,6 +652,9 @@ if_input(struct ifnet *ifp, struct mbuf_list *ml)
ml_enqueue(ml, m);
}
}
+
+ if (ml_empty(ml))
+ return;
#endif
mq_enlist(&ifp->if_inputqueue, ml);