iproute: rename 'get_jiffies' since it uses msecs
The get_jiffies() function retrieves rtt-type values in units of milliseconds. This patch updates the function name accordingly, following the pattern given by dst_metric() <=> dst_metric_rtt().
This commit is contained in:
parent
9b2cdc00da
commit
81d03dc356
|
|
@ -79,7 +79,7 @@ extern int mask2bits(__u32 netmask);
|
||||||
|
|
||||||
extern int get_integer(int *val, const char *arg, int base);
|
extern int get_integer(int *val, const char *arg, int base);
|
||||||
extern int get_unsigned(unsigned *val, const char *arg, int base);
|
extern int get_unsigned(unsigned *val, const char *arg, int base);
|
||||||
extern int get_jiffies(unsigned *val, const char *arg, int *raw);
|
extern int get_time_rtt(unsigned *val, const char *arg, int *raw);
|
||||||
#define get_byte get_u8
|
#define get_byte get_u8
|
||||||
#define get_ushort get_u16
|
#define get_ushort get_u16
|
||||||
#define get_short get_s16
|
#define get_short get_s16
|
||||||
|
|
|
||||||
|
|
@ -835,7 +835,7 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
|
||||||
mxlock |= (1<<RTAX_RTT);
|
mxlock |= (1<<RTAX_RTT);
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
}
|
}
|
||||||
if (get_jiffies(&rtt, *argv, &raw))
|
if (get_time_rtt(&rtt, *argv, &raw))
|
||||||
invarg("\"rtt\" value is invalid\n", *argv);
|
invarg("\"rtt\" value is invalid\n", *argv);
|
||||||
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_RTT,
|
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_RTT,
|
||||||
(raw) ? rtt : rtt * 8);
|
(raw) ? rtt : rtt * 8);
|
||||||
|
|
@ -843,7 +843,7 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
|
||||||
unsigned rto_min;
|
unsigned rto_min;
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
mxlock |= (1<<RTAX_RTO_MIN);
|
mxlock |= (1<<RTAX_RTO_MIN);
|
||||||
if (get_jiffies(&rto_min, *argv, &raw))
|
if (get_time_rtt(&rto_min, *argv, &raw))
|
||||||
invarg("\"rto_min\" value is invalid\n",
|
invarg("\"rto_min\" value is invalid\n",
|
||||||
*argv);
|
*argv);
|
||||||
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_RTO_MIN,
|
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_RTO_MIN,
|
||||||
|
|
@ -895,7 +895,7 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
|
||||||
mxlock |= (1<<RTAX_RTTVAR);
|
mxlock |= (1<<RTAX_RTTVAR);
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
}
|
}
|
||||||
if (get_jiffies(&win, *argv, &raw))
|
if (get_time_rtt(&win, *argv, &raw))
|
||||||
invarg("\"rttvar\" value is invalid\n", *argv);
|
invarg("\"rttvar\" value is invalid\n", *argv);
|
||||||
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_RTTVAR,
|
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_RTTVAR,
|
||||||
(raw) ? win : win * 4);
|
(raw) ? win : win * 4);
|
||||||
|
|
|
||||||
19
lib/utils.c
19
lib/utils.c
|
|
@ -93,14 +93,13 @@ int get_unsigned(unsigned *val, const char *arg, int base)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_jiffies is "translated" from a similar routine "get_time" in
|
* get_time_rtt is "translated" from a similar routine "get_time" in
|
||||||
* tc_util.c. we don't use the exact same routine because tc passes
|
* tc_util.c. We don't use the exact same routine because tc passes
|
||||||
* microseconds to the kernel and the callers of get_jiffies want
|
* microseconds to the kernel and the callers of get_time_rtt want to
|
||||||
* to pass jiffies, and have a different assumption for the units of
|
* pass milliseconds (standard unit for rtt values since 2.6.27), and
|
||||||
* a "raw" number.
|
* have a different assumption for the units of a "raw" number.
|
||||||
*/
|
*/
|
||||||
|
int get_time_rtt(unsigned *val, const char *arg, int *raw)
|
||||||
int get_jiffies(unsigned *jiffies, const char *arg, int *raw)
|
|
||||||
{
|
{
|
||||||
double t;
|
double t;
|
||||||
unsigned long res;
|
unsigned long res;
|
||||||
|
|
@ -135,9 +134,9 @@ int get_jiffies(unsigned *jiffies, const char *arg, int *raw)
|
||||||
|
|
||||||
/* emulate ceil() without having to bring-in -lm and always be >= 1 */
|
/* emulate ceil() without having to bring-in -lm and always be >= 1 */
|
||||||
|
|
||||||
*jiffies = t;
|
*val = t;
|
||||||
if (*jiffies < t)
|
if (*val < t)
|
||||||
*jiffies += 1;
|
*val += 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue