svn commit: r186200 - head/sys/netinet
Kip Macy
kmacy at FreeBSD.org
Wed Dec 17 00:14:28 UTC 2008
Author: kmacy
Date: Wed Dec 17 00:14:28 2008
New Revision: 186200
URL: http://svn.freebsd.org/changeset/base/186200
Log:
default to doing lla_lookup with shared afdata lock and returning a
shared lock on the lle - thus restoring parallel performance to
pre-arpv2 level
Modified:
head/sys/netinet/if_ether.c
Modified: head/sys/netinet/if_ether.c
==============================================================================
--- head/sys/netinet/if_ether.c Wed Dec 17 00:11:56 2008 (r186199)
+++ head/sys/netinet/if_ether.c Wed Dec 17 00:14:28 2008 (r186200)
@@ -251,7 +251,7 @@ arpresolve(struct ifnet *ifp, struct rte
{
INIT_VNET_INET(ifp->if_vnet);
struct llentry *la = 0;
- u_int flags;
+ u_int flags = 0;
int error, renew;
*lle = NULL;
@@ -268,18 +268,19 @@ arpresolve(struct ifnet *ifp, struct rte
return (0);
}
}
-
- flags = (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) ? 0 : LLE_CREATE;
-
/* XXXXX
- * Since this function returns an llentry, the
- * lock is held by the caller.
- * XXX if caller is required to hold lock, assert it
*/
retry:
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
la = lla_lookup(LLTABLE(ifp), flags, dst);
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
+ if ((la == NULL) && ((flags & LLE_EXCLUSIVE) == 0)
+ && ((ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0)) {
+ flags |= (LLE_CREATE | LLE_EXCLUSIVE);
+ IF_AFDATA_WLOCK(ifp);
+ la = lla_lookup(LLTABLE(ifp), flags, dst);
+ IF_AFDATA_WUNLOCK(ifp);
+ }
if (la == NULL) {
if (flags & LLE_CREATE)
log(LOG_DEBUG,
More information about the svn-src-head
mailing list