diff options
author | ae <ae@FreeBSD.org> | 2012-11-16 12:12:02 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2012-11-16 12:12:02 +0000 |
commit | 4e1bc5063bfa594a28bca5b0e186cd205af78f8d (patch) | |
tree | c7201a56dd9f5ce7d846d6ec3c34da3ee8499c5e /sys/netinet6 | |
parent | deebb6a0a705bcc52dc09a560e78d6b1d36b30d6 (diff) | |
download | FreeBSD-src-4e1bc5063bfa594a28bca5b0e186cd205af78f8d.zip FreeBSD-src-4e1bc5063bfa594a28bca5b0e186cd205af78f8d.tar.gz |
Reduce the overhead of locking, use IF_AFDATA_RLOCK() when we are doing
simple lookups.
Sponsored by: Yandex LLC
MFC after: 1 week
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/icmp6.c | 4 | ||||
-rw-r--r-- | sys/netinet6/in6_src.c | 4 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 4 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 12 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 12 |
5 files changed, 18 insertions, 18 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 9c2daa7..d9ea93e 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -2677,9 +2677,9 @@ icmp6_redirect_output(struct mbuf *m0, struct rtentry *rt) struct nd_opt_hdr *nd_opt; char *lladdr; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); ln = nd6_lookup(router_ll6, 0, ifp); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if (ln == NULL) goto nolladdropt; diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index e028517..fb7e6f0 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -609,9 +609,9 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, rt = ron->ro_rt; ifp = rt->rt_ifp; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); la = lla_lookup(LLTABLE6(ifp), 0, (struct sockaddr *)&sin6_next->sin6_addr); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if (la != NULL) LLE_RUNLOCK(la); else { diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 3b50143..1b90c75 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -686,10 +686,10 @@ passin: dst6.sin6_len = sizeof(struct sockaddr_in6); dst6.sin6_addr = ip6->ip6_dst; ifp = m->m_pkthdr.rcvif; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); lle = lla_lookup(LLTABLE6(ifp), 0, (struct sockaddr *)&dst6); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if ((lle != NULL) && (lle->la_flags & LLE_IFADDR)) { struct ifaddr *ifa; struct in6_ifaddr *ia6; diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 0ce7378..9993c77 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -975,12 +975,12 @@ nd6_is_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp) * Even if the address matches none of our addresses, it might be * in the neighbor cache. */ - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); if ((lle = nd6_lookup(&addr->sin6_addr, 0, ifp)) != NULL) { LLE_RUNLOCK(lle); rc = 1; } - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); return (rc); } @@ -1480,9 +1480,9 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) if ((error = in6_setscope(&nb_addr, ifp, NULL)) != 0) return (error); - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); ln = nd6_lookup(&nb_addr, 0, ifp); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if (ln == NULL) { error = EINVAL; @@ -2198,9 +2198,9 @@ nd6_storelladdr(struct ifnet *ifp, struct mbuf *m, /* * the entry should have been created in nd6_store_lladdr */ - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); ln = lla_lookup(LLTABLE6(ifp), 0, dst); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if ((ln == NULL) || !(ln->la_flags & LLE_VALID)) { if (ln != NULL) LLE_RUNLOCK(ln); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index f346cdb..f6bae0c 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -637,13 +637,13 @@ defrouter_select(void) * the ordering rule of the list described in defrtrlist_update(). */ TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { - IF_AFDATA_LOCK(dr->ifp); + IF_AFDATA_RLOCK(dr->ifp); if (selected_dr == NULL && (ln = nd6_lookup(&dr->rtaddr, 0, dr->ifp)) && ND6_IS_LLINFO_PROBREACH(ln)) { selected_dr = dr; } - IF_AFDATA_UNLOCK(dr->ifp); + IF_AFDATA_RUNLOCK(dr->ifp); if (ln != NULL) { LLE_RUNLOCK(ln); ln = NULL; @@ -671,13 +671,13 @@ defrouter_select(void) else selected_dr = TAILQ_NEXT(installed_dr, dr_entry); } else if (installed_dr) { - IF_AFDATA_LOCK(installed_dr->ifp); + IF_AFDATA_RLOCK(installed_dr->ifp); if ((ln = nd6_lookup(&installed_dr->rtaddr, 0, installed_dr->ifp)) && ND6_IS_LLINFO_PROBREACH(ln) && rtpref(selected_dr) <= rtpref(installed_dr)) { selected_dr = installed_dr; } - IF_AFDATA_UNLOCK(installed_dr->ifp); + IF_AFDATA_RUNLOCK(installed_dr->ifp); if (ln != NULL) LLE_RUNLOCK(ln); } @@ -1301,9 +1301,9 @@ find_pfxlist_reachable_router(struct nd_prefix *pr) int canreach; LIST_FOREACH(pfxrtr, &pr->ndpr_advrtrs, pfr_entry) { - IF_AFDATA_LOCK(pfxrtr->router->ifp); + IF_AFDATA_RLOCK(pfxrtr->router->ifp); ln = nd6_lookup(&pfxrtr->router->rtaddr, 0, pfxrtr->router->ifp); - IF_AFDATA_UNLOCK(pfxrtr->router->ifp); + IF_AFDATA_RUNLOCK(pfxrtr->router->ifp); if (ln == NULL) continue; canreach = ND6_IS_LLINFO_PROBREACH(ln); |