Skip to contentSkip to conversation

pktgen: restore nanosec delays

PATCH Applied Eric Dumazet 3 participants 4 messages Oct 3, 2009 – Oct 5, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pktgen: restore nanosec delays

Commit fd29cf72 (pktgen: convert to use ktime_t) inadvertantly converted "delay" parameter from nanosec to microsec.

---

net/core/pktgen.c +1 -1
index b694552..227ba31 100644
@@ -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);
#1 lore raw
Quoted 11 lines · On Sat, 03 Oct 2009 13:39:18 +0200 Eric Dumazet <[email protected]> wrote:

Commit fd29cf72 (pktgen: convert to use ktime_t) inadvertantly converted "delay" parameter from nanosec to microsec.

---

net/core/pktgen.c +0 -0
index b694552..227ba31 100644

net/core/pktgen.c static ssize_t pktgen_if_write(struct file *file, · line 967

Quoted 5 lines
net/core/pktgen.c +1 -1
@@ -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?

#2 lore raw
Quoted 9 lines · Stephen Hemminger
Quoted 6 lines · On Sat, 03 Oct 2009 13:39:18 +0200 Eric Dumazet <[email protected]> wrote:

Commit fd29cf72 (pktgen: convert to use ktime_t) inadvertantly converted "delay" parameter from nanosec to microsec.

---

Quoted 12 lines

net/core/pktgen.c static ssize_t pktgen_if_write(struct file *file, · line 967

Quoted 10 lines
net/core/pktgen.c +1 -1
index b694552..227ba31 100644
@@ -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.