Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Introduce arp_settimer



details:   https://anonhg.NetBSD.org/src/rev/d69d3cccd810
branches:  trunk
changeset: 812316:d69d3cccd810
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Dec 11 01:15:00 2015 +0000

description:
Introduce arp_settimer

No functional change.

diffstat:

 sys/netinet/if_arp.c |  21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diffs (64 lines):

diff -r ca4a7b53a983 -r d69d3cccd810 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Thu Dec 10 22:04:54 2015 +0000
+++ b/sys/netinet/if_arp.c      Fri Dec 11 01:15:00 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.195 2015/11/30 06:45:38 ozaki-r Exp $     */
+/*     $NetBSD: if_arp.c,v 1.196 2015/12/11 01:15:00 ozaki-r Exp $     */
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.195 2015/11/30 06:45:38 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.196 2015/12/11 01:15:00 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -161,6 +161,7 @@
            const struct sockaddr *);
 static void arptfree(struct rtentry *);
 static void arptimer(void *);
+static void arp_settimer(struct llentry *, int);
 static struct llentry *arplookup(struct ifnet *, struct mbuf *,
            const struct in_addr *, int, int, int, struct rtentry *);
 static void in_arpinput(struct mbuf *);
@@ -374,6 +375,15 @@
        IF_AFDATA_UNLOCK(ifp);
 }
 
+static void
+arp_settimer(struct llentry *la, int sec)
+{
+
+       LLE_WLOCK_ASSERT(la);
+       LLE_ADDREF(la);
+       callout_reset(&la->la_timer, hz * sec, arptimer, la);
+}
+
 /*
  * We set the gateway for RTF_CLONING routes to a "prototype"
  * link-layer sockaddr whose interface type (if_type) and interface
@@ -974,10 +984,8 @@
                    CLLADDR(rt->rt_ifp->if_sadl):
 #endif
                    CLLADDR(ifp->if_sadl);
-               LLE_ADDREF(la);
                la->la_expire = time_uptime;
-               callout_reset(&la->la_timer, hz * arpt_down,
-                   arptimer, la);
+               arp_settimer(la, arpt_down);
                la->la_asked++;
                LLE_WUNLOCK(la);
 
@@ -1338,8 +1346,7 @@
                rt->rt_expire = time_uptime + arpt_keep;
 
                KASSERT((la->la_flags & LLE_STATIC) == 0);
-               LLE_ADDREF(la);
-               callout_reset(&la->la_timer, hz * arpt_keep, arptimer, la);
+               arp_settimer(la, arpt_keep);
        }
        rt->rt_flags &= ~RTF_REJECT;
        la->la_asked = 0;



Home | Main Index | Thread Index | Old Index