From c224706f7b5af6a4a86464d511ac249cb36d7d65 Mon Sep 17 00:00:00 2001 From: glebius Date: Thu, 23 Jan 2020 01:47:43 +0000 Subject: [PATCH] Stop entering the network epoch in ether_input(), unless driver is marked with IFF_NEEDSEPOCH. --- sys/net/if_ethersubr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 7a750558890a..7d918216b300 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -809,7 +809,8 @@ ether_input(struct ifnet *ifp, struct mbuf *m) * them up. This allows the drivers to amortize the receive lock. */ CURVNET_SET_QUIET(ifp->if_vnet); - NET_EPOCH_ENTER(et); + if (__predict_false(ifp->if_flags & IFF_NEEDSEPOCH)) + NET_EPOCH_ENTER(et); while (m) { mn = m->m_nextpkt; m->m_nextpkt = NULL; @@ -824,7 +825,8 @@ ether_input(struct ifnet *ifp, struct mbuf *m) netisr_dispatch(NETISR_ETHER, m); m = mn; } - NET_EPOCH_EXIT(et); + if (__predict_false(ifp->if_flags & IFF_NEEDSEPOCH)) + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); }