Avoid multiply for preemptive arp calculation since it hits every

ethernet packet sent.

Prompted by: Jeffrey Hsu <hsu@FreeBSD.org>
This commit is contained in:
Orion Hodson 2003-02-08 15:05:15 +00:00
parent a09a56b5ad
commit 022695f82a

View File

@ -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 @@ in_arpinput(m)
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);