diff options
author | karels <karels@FreeBSD.org> | 2016-08-03 06:32:44 +0000 |
---|---|---|
committer | karels <karels@FreeBSD.org> | 2016-08-03 06:32:44 +0000 |
commit | c37958558f4f896fa6d34ca70cf5cf97155e6db8 (patch) | |
tree | 6610c5e996c64270620ff9603f2491d75bc32544 | |
parent | bd38a253d7c8bab87a63fc12cace0b20ee4f3ad9 (diff) | |
download | FreeBSD-src-c37958558f4f896fa6d34ca70cf5cf97155e6db8.zip FreeBSD-src-c37958558f4f896fa6d34ca70cf5cf97155e6db8.tar.gz |
MFC r303171: Fix per-connection L2 caching in fast path
r301217 re-added per-connection L2 caching from a previous change,
but it omitted caching in the fast path. Add it.
Reviewed By: gallatin
Approved by: gnn (mentor)
Approved by: re (kostikbel)
Differential Revision: https://reviews.freebsd.org/D7239
-rw-r--r-- | sys/netinet/if_ether.c | 9 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 11 |
2 files changed, 17 insertions, 3 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 1a23390..9f36c32 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -607,7 +607,7 @@ arpresolve(struct ifnet *ifp, int is_gw, struct mbuf *m, } IF_AFDATA_RLOCK(ifp); - la = lla_lookup(LLTABLE(ifp), LLE_UNLOCKED, dst); + la = lla_lookup(LLTABLE(ifp), plle ? LLE_EXCLUSIVE : LLE_UNLOCKED, dst); if (la != NULL && (la->r_flags & RLLE_VALID) != 0) { /* Entry found, let's copy lle info */ bcopy(la->r_linkdata, desten, la->r_hdrlen); @@ -619,9 +619,16 @@ arpresolve(struct ifnet *ifp, int is_gw, struct mbuf *m, la->r_skip_req = 0; /* Notify that entry was used */ LLE_REQ_UNLOCK(la); } + if (plle) { + LLE_ADDREF(la); + *plle = la; + LLE_WUNLOCK(la); + } IF_AFDATA_RUNLOCK(ifp); return (0); } + if (plle && la) + LLE_WUNLOCK(la); IF_AFDATA_RUNLOCK(ifp); return (arpresolve_full(ifp, is_gw, la == NULL ? LLE_CREATE : 0, m, dst, diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 8fc229f..3decb70 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -2222,7 +2222,8 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, } IF_AFDATA_RLOCK(ifp); - ln = nd6_lookup(&dst6->sin6_addr, LLE_UNLOCKED, ifp); + ln = nd6_lookup(&dst6->sin6_addr, plle ? LLE_EXCLUSIVE : LLE_UNLOCKED, + ifp); if (ln != NULL && (ln->r_flags & RLLE_VALID) != 0) { /* Entry found, let's copy lle info */ bcopy(ln->r_linkdata, desten, ln->r_hdrlen); @@ -2235,9 +2236,15 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, ln->lle_hittime = time_uptime; LLE_REQ_UNLOCK(ln); } + if (plle) { + LLE_ADDREF(ln); + *plle = ln; + LLE_WUNLOCK(ln); + } IF_AFDATA_RUNLOCK(ifp); return (0); - } + } else if (plle && ln) + LLE_WUNLOCK(ln); IF_AFDATA_RUNLOCK(ifp); return (nd6_resolve_slow(ifp, 0, m, dst6, desten, pflags, plle)); |