diff options
author | orion <orion@FreeBSD.org> | 2003-02-08 15:05:15 +0000 |
---|---|---|
committer | orion <orion@FreeBSD.org> | 2003-02-08 15:05:15 +0000 |
commit | 7d33afda117bff479815528dacad73d9ac598c90 (patch) | |
tree | 707c92d56c8fc21c1164f4f98cbf604c0bb8af66 /sys/netinet/if_ether.c | |
parent | 384af30f6369e69cff201afee3edc6d2ac874bb2 (diff) | |
download | FreeBSD-src-7d33afda117bff479815528dacad73d9ac598c90.zip FreeBSD-src-7d33afda117bff479815528dacad73d9ac598c90.tar.gz |
Avoid multiply for preemptive arp calculation since it hits every
ethernet packet sent.
Prompted by: Jeffrey Hsu <hsu@FreeBSD.org>
Diffstat (limited to 'sys/netinet/if_ether.c')
-rw-r--r-- | sys/netinet/if_ether.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index b8d9453..4a4d91f 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -97,7 +97,7 @@ struct llinfo_arp { LIST_ENTRY(llinfo_arp) la_le; struct rtentry *la_rt; struct mbuf *la_hold; /* last packet until resolved/timeout */ - u_short la_preempt; /* #times we QUERIED before entry expiration */ + u_short la_preempt; /* countdown for pre-expiry arps */ u_short la_asked; /* #times we QUERIED following expiration */ #define la_timer la_rt->rt_rmx.rmx_expire /* deletion time in seconds */ }; @@ -442,13 +442,12 @@ arpresolve(ifp, rt, m, dst, desten, rt0) * arpt_down interval. */ if ((rt->rt_expire != 0) && - (time_second + (arp_maxtries - la->la_preempt) * arpt_down - > rt->rt_expire)) { + (time_second + la->la_preempt > rt->rt_expire)) { arprequest(ifp, &SIN(rt->rt_ifa->ifa_addr)->sin_addr, &SIN(dst)->sin_addr, IF_LLADDR(ifp)); - la->la_preempt++; + la->la_preempt--; } bcopy(LLADDR(sdl), desten, sdl->sdl_alen); @@ -484,7 +483,8 @@ arpresolve(ifp, rt, m, dst, desten, rt0) } else { rt->rt_flags |= RTF_REJECT; rt->rt_expire += arpt_down; - la->la_preempt = la->la_asked = 0; + la->la_asked = 0; + la->la_preempt = arp_maxtries; } } @@ -745,7 +745,8 @@ match: if (rt->rt_expire) rt->rt_expire = time_second + arpt_keep; rt->rt_flags &= ~RTF_REJECT; - la->la_preempt = la->la_asked = 0; + la->la_asked = 0; + la->la_preempt = arp_maxtries; if (la->la_hold) { (*ifp->if_output)(ifp, la->la_hold, rt_key(rt), rt); |