[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1510179656.2849.112.camel@edumazet-glaptop3.roam.corp.google.com>
Date: Wed, 08 Nov 2017 14:20:56 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Dave Taht <dave.taht@...il.com>
Cc: netdev@...r.kernel.org, stephen@...workplumber.org
Subject: Re: [PATCH v2 net-next 1/3] netem: convert to
qdisc_watchdog_schedule_ns
On Wed, 2017-11-08 at 13:09 -0800, Dave Taht wrote:
> Upgrade the internal netem scheduler to use nanoseconds rather than
> ticks throughout.
>
...
> -static psched_time_t packet_len_2_sched_time(unsigned int len, struct netem_sched_data *q)
> +static s64 packet_len_2_sched_time(unsigned int len,
> + struct netem_sched_data *q)
> {
> - u64 ticks;
> -
> + s64 offset;
> len += q->packet_overhead;
>
> if (q->cell_size) {
> @@ -345,11 +345,9 @@ static psched_time_t packet_len_2_sched_time(unsigned int len, struct netem_sche
> cells++;
> len = cells * (q->cell_size + q->cell_overhead);
> }
> -
> - ticks = (u64)len * NSEC_PER_SEC;
> -
> - do_div(ticks, q->rate);
> - return PSCHED_NS2TICKS(ticks);
> + offset = (s64)len * NSEC_PER_SEC;
> + do_div(offset, q->rate);
> + return offset;
> }
do_div() first argument being u64, I do not see why you chose
's64 offset'
packet_len_2_sched_time() should return u64, because I do not see how we
could return a negative value, since a packet length is positive.
Powered by blists - more mailing lists