On Wed, Dec 19, 2018 at 07:57:11PM +0100, Claudio Jeker wrote:
> This is mostly replacing timeout_add calls that use some sort of HZ
> dependent value to timeout_add_(m)sec(). IFNET_SLOWHZ is only used in one
> place and could be moved there.
> In general I think the result is easier to understand.
> 
> OK?

OK bluhm@

> Index: net/if.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if.c,v
> retrieving revision 1.569
> diff -u -p -r1.569 if.c
> --- net/if.c  11 Dec 2018 22:08:57 -0000      1.569
> +++ net/if.c  19 Dec 2018 16:03:20 -0000
> @@ -1626,7 +1620,7 @@ if_slowtimo(void *arg)
>       if (ifp->if_watchdog) {
>               if (ifp->if_timer > 0 && --ifp->if_timer == 0)
>                       task_add(net_tq(ifp->if_index), &ifp->if_watchdogtask);
> -             timeout_add(&ifp->if_slowtimo, hz / IFNET_SLOWHZ);
> +             timeout_add_sec(&ifp->if_slowtimo, IFNET_SLOWTIMO);
>       }
>       splx(s);
>  }
> Index: net/if_var.h
> ===================================================================
> RCS file: /cvs/src/sys/net/if_var.h,v
> retrieving revision 1.92
> diff -u -p -r1.92 if_var.h
> --- net/if_var.h      19 Dec 2018 05:31:28 -0000      1.92
> +++ net/if_var.h      19 Dec 2018 16:22:30 -0000
> @@ -274,7 +274,7 @@ struct ifg_list {
>       TAILQ_ENTRY(ifg_list)    ifgl_next;
>  };
>  
> -#define      IFNET_SLOWHZ    1               /* granularity is 1 second */
> +#define      IFNET_SLOWTIMO  1               /* granularity is 1 second */
>  
>  /*
>   * IFQ compat on ifq API
> Index: net/rtsock.c
> ===================================================================
> RCS file: /cvs/src/sys/net/rtsock.c,v
> retrieving revision 1.280
> diff -u -p -r1.280 rtsock.c
> --- net/rtsock.c      12 Nov 2018 16:36:54 -0000      1.280
> +++ net/rtsock.c      19 Dec 2018 16:21:40 -0000
> @@ -169,7 +169,7 @@ struct rtptable rtptable;
>  #define ROUTECB_FLAG_FLUSH   0x2     /* Wait until socket is empty before
>                                          queueing more packets */
>  
> -#define ROUTE_DESYNC_RESEND_TIMEOUT  (hz / 5)        /* In hz */
> +#define ROUTE_DESYNC_RESEND_TIMEOUT  200     /* In ms */
>  
>  void
>  route_prinit(void)
> @@ -461,7 +461,7 @@ rtm_senddesync(struct socket *so)
>               m_freem(desync_mbuf);
>       }
>       /* Re-add timeout to try sending msg again */
> -     timeout_add(&rop->rop_timeout, ROUTE_DESYNC_RESEND_TIMEOUT);
> +     timeout_add_msec(&rop->rop_timeout, ROUTE_DESYNC_RESEND_TIMEOUT);
>  }
>  
>  void
> Index: netinet6/nd6_nbr.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/nd6_nbr.c,v
> retrieving revision 1.126
> diff -u -p -r1.126 nd6_nbr.c
> --- netinet6/nd6_nbr.c        7 Dec 2018 10:01:06 -0000       1.126
> +++ netinet6/nd6_nbr.c        19 Dec 2018 16:16:00 -0000
> @@ -1059,11 +1059,11 @@ nd6_dad_find(struct ifaddr *ifa)
>  }
>  
>  void
> -nd6_dad_starttimer(struct dadq *dp, int ticks)
> +nd6_dad_starttimer(struct dadq *dp, int msec)
>  {
>  
>       timeout_set_proc(&dp->dad_timer_ch, nd6_dad_timer, dp->dad_ifa);
> -     timeout_add(&dp->dad_timer_ch, ticks);
> +     timeout_add_msec(&dp->dad_timer_ch, msec);
>  }
>  
>  void
> @@ -1137,8 +1137,7 @@ nd6_dad_start(struct ifaddr *ifa)
>       dp->dad_ns_icount = dp->dad_na_icount = 0;
>       dp->dad_ns_ocount = dp->dad_ns_tcount = 0;
>       nd6_dad_ns_output(dp, ifa);
> -     nd6_dad_starttimer(dp,
> -         (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000);
> +     nd6_dad_starttimer(dp, ND_IFINFO(ifa->ifa_ifp)->retrans);
>  }
>  
>  /*
> @@ -1220,8 +1219,7 @@ nd6_dad_timer(void *xifa)
>                * We have more NS to go.  Send NS packet for DAD.
>                */
>               nd6_dad_ns_output(dp, ifa);
> -             nd6_dad_starttimer(dp,
> -                 (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000);
> +             nd6_dad_starttimer(dp, ND_IFINFO(ifa->ifa_ifp)->retrans);
>       } else {
>               /*
>                * We have transmitted sufficient number of DAD packets.

Reply via email to