Subject: Re: [PATCH] pktgen: restore nanosec delays

From: Eric Dumazet <[email-masked]>
Date: Sun, 04 Oct 2009 08:45:12 +0200

Stephen Hemminger a écrit :
> On Sat, 03 Oct 2009 13:39:18 +0200
> Eric Dumazet <[email-masked]> wrote:
> 
>> Commit fd29cf72 (pktgen: convert to use ktime_t)
>> inadvertantly converted "delay" parameter from nanosec to microsec.
>>
>> Signed-off-by: Eric Dumazet <[email-masked]>
>> ---
>>
>> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
>> index b694552..227ba31 100644
>> --- a/net/core/pktgen.c
>> +++ b/net/core/pktgen.c
>> @@ -964,7 +964,7 @@ static ssize_t pktgen_if_write(struct file *file,
>>  		if (value == 0x7FFFFFFF)
>>  			pkt_dev->delay = ULLONG_MAX;
>>  		else
>> -			pkt_dev->delay = (u64)value * NSEC_PER_USEC;
>> +			pkt_dev->delay = (u64)value;
> 
> Is the cast really necessary?

It reminds us 'value' is 32 bits, but it's not necessary, as C compiler
can silently do the cast.