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.







Reply via email to