diff mbox

pktgen: restore nanosec delays

Message ID 4AC737E6.1050809@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Oct. 3, 2009, 11:39 a.m. UTC
Commit fd29cf72 (pktgen: convert to use ktime_t)
inadvertantly converted "delay" parameter from nanosec to microsec.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

stephen hemminger Oct. 4, 2009, 4:16 a.m. UTC | #1
On Sat, 03 Oct 2009 13:39:18 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Commit fd29cf72 (pktgen: convert to use ktime_t)
> inadvertantly converted "delay" parameter from nanosec to microsec.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> 
> 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?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet Oct. 4, 2009, 6:45 a.m. UTC | #2
Stephen Hemminger a écrit :
> On Sat, 03 Oct 2009 13:39:18 +0200
> Eric Dumazet <eric.dumazet@gmail.com> wrote:
> 
>> Commit fd29cf72 (pktgen: convert to use ktime_t)
>> inadvertantly converted "delay" parameter from nanosec to microsec.
>>
>> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
>> ---
>>
>> 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.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Oct. 5, 2009, 4:09 a.m. UTC | #3
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 03 Oct 2009 13:39:18 +0200

> Commit fd29cf72 (pktgen: convert to use ktime_t)
> inadvertantly converted "delay" parameter from nanosec to microsec.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
 
 		sprintf(pg_result, "OK: delay=%llu",
 			(unsigned long long) pkt_dev->delay);