diff options
-rw-r--r-- | include/netlink/utils.h | 2 | ||||
-rw-r--r-- | lib/route/neigh.c | 2 | ||||
-rw-r--r-- | lib/route/route_obj.c | 4 | ||||
-rw-r--r-- | lib/route/sch/htb.c | 4 | ||||
-rw-r--r-- | lib/utils.c | 12 |
5 files changed, 14 insertions, 10 deletions
diff --git a/include/netlink/utils.h b/include/netlink/utils.h index 480bab6..9f38f21 100644 --- a/include/netlink/utils.h +++ b/include/netlink/utils.h @@ -48,7 +48,7 @@ extern long nl_size2int(const char *); extern long nl_prob2int(const char *); /* time translations */ -extern int nl_get_hz(void); +extern int nl_get_user_hz(void); extern uint32_t nl_us2ticks(uint32_t); extern uint32_t nl_ticks2us(uint32_t); extern int nl_str2msec(const char *, uint64_t *); diff --git a/lib/route/neigh.c b/lib/route/neigh.c index 6c90bc2..a8ebfd5 100644 --- a/lib/route/neigh.c +++ b/lib/route/neigh.c @@ -367,7 +367,7 @@ static void neigh_dump_details(struct nl_object *a, struct nl_dump_params *p) { char rtn_type[32]; struct rtnl_neigh *n = (struct rtnl_neigh *) a; - int hz = nl_get_hz(); + int hz = nl_get_user_hz(); neigh_dump_line(a, p); diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c index 856dce4..c3d7de5 100644 --- a/lib/route/route_obj.c +++ b/lib/route/route_obj.c @@ -284,8 +284,8 @@ static void route_dump_stats(struct nl_object *obj, struct nl_dump_params *p) nl_dump_line(p, " used %u refcnt %u last-use %us " "expires %us\n", ci->rtci_used, ci->rtci_clntref, - ci->rtci_last_use / nl_get_hz(), - ci->rtci_expires / nl_get_hz()); + ci->rtci_last_use / nl_get_user_hz(), + ci->rtci_expires / nl_get_user_hz()); } } diff --git a/lib/route/sch/htb.c b/lib/route/sch/htb.c index 93ec28a..4af8a04 100644 --- a/lib/route/sch/htb.c +++ b/lib/route/sch/htb.c @@ -284,14 +284,14 @@ static struct nl_msg *htb_class_get_opts(struct rtnl_class *class) if (d->ch_mask & SCH_HTB_HAS_RBUFFER) buffer = d->ch_rbuffer; else - buffer = opts.rate.rate / nl_get_hz() + mtu; + buffer = opts.rate.rate / nl_get_user_hz() + mtu; /* XXX */ opts.buffer = rtnl_tc_calc_txtime(buffer, opts.rate.rate); if (d->ch_mask & SCH_HTB_HAS_CBUFFER) cbuffer = d->ch_cbuffer; else - cbuffer = opts.ceil.rate / nl_get_hz() + mtu; + cbuffer = opts.ceil.rate / nl_get_user_hz() + mtu; /* XXX */ opts.cbuffer = rtnl_tc_calc_txtime(cbuffer, opts.ceil.rate); diff --git a/lib/utils.c b/lib/utils.c index 56a92bf..1168293 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -313,11 +313,15 @@ static void __init get_psched_settings(void) strncpy(name, "/proc/net/psched", sizeof(name) - 1); if ((fd = fopen(name, "r"))) { - uint32_t tick, us; + uint32_t ns_per_usec, ns_per_tick; /* the file contains 4 hexadecimals, but we just use the first two of them */ - fscanf(fd, "%08x %08x", &tick, &us); - ticks_per_usec = (double)tick/(double)us; + fscanf(fd, "%08x %08x", &ns_per_usec, &ns_per_tick); + + ticks_per_usec = (double) ns_per_usec / + (double) ns_per_tick; + + fclose(fd); } } @@ -327,7 +331,7 @@ static void __init get_psched_settings(void) /** * Return the value of HZ */ -int nl_get_hz(void) +int nl_get_user_hz(void) { return user_hz; } |