From owner-svn-src-head@freebsd.org Fri Jul 22 02:11:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A03BBA106E; Fri, 22 Jul 2016 02:11:50 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 342B91969; Fri, 22 Jul 2016 02:11:50 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6M2BnmO052398; Fri, 22 Jul 2016 02:11:49 GMT (envelope-from karels@FreeBSD.org) Received: (from karels@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6M2BnQb052396; Fri, 22 Jul 2016 02:11:49 GMT (envelope-from karels@FreeBSD.org) Message-Id: <201607220211.u6M2BnQb052396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: karels set sender to karels@FreeBSD.org using -f From: Mike Karels Date: Fri, 22 Jul 2016 02:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303171 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2016 02:11:50 -0000 Author: karels Date: Fri Jul 22 02:11:49 2016 New Revision: 303171 URL: https://svnweb.freebsd.org/changeset/base/303171 Log: 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) Differential Revision: https://reviews.freebsd.org/D7239 Modified: head/sys/netinet/if_ether.c head/sys/netinet6/nd6.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Fri Jul 22 01:16:56 2016 (r303170) +++ head/sys/netinet/if_ether.c Fri Jul 22 02:11:49 2016 (r303171) @@ -607,7 +607,7 @@ arpresolve(struct ifnet *ifp, int is_gw, } 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, 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, Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Fri Jul 22 01:16:56 2016 (r303170) +++ head/sys/netinet6/nd6.c Fri Jul 22 02:11:49 2016 (r303171) @@ -2222,7 +2222,8 @@ nd6_resolve(struct ifnet *ifp, int is_gw } 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 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));