diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-11-06 00:04:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-06 01:34:27 -0500 |
commit | baac8564547ac7f944af1c2e8cc6fdd57f2836a4 (patch) | |
tree | 3e8054248800b2da155dcc039270e7ca75db177c /net/core/pktgen.c | |
parent | bf8e56bfc4fcfcef9f08e6233dc619706807893a (diff) |
pktgen: tx_bytes might be slightly wrong
cur_pkt_size can be changed in proc fs while pktgen is running,
we better use a private field to get precise tx-bytes counter.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r-- | net/core/pktgen.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 5ce017bf4afa..d38470a32792 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -340,6 +340,7 @@ struct pktgen_dev { | |||
340 | __u16 cur_udp_src; | 340 | __u16 cur_udp_src; |
341 | __u16 cur_queue_map; | 341 | __u16 cur_queue_map; |
342 | __u32 cur_pkt_size; | 342 | __u32 cur_pkt_size; |
343 | __u32 last_pkt_size; | ||
343 | 344 | ||
344 | __u8 hh[14]; | 345 | __u8 hh[14]; |
345 | /* = { | 346 | /* = { |
@@ -3434,7 +3435,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3434 | pkt_dev->clone_count--; /* back out increment, OOM */ | 3435 | pkt_dev->clone_count--; /* back out increment, OOM */ |
3435 | return; | 3436 | return; |
3436 | } | 3437 | } |
3437 | 3438 | pkt_dev->last_pkt_size = pkt_dev->skb->len; | |
3438 | pkt_dev->allocated_skbs++; | 3439 | pkt_dev->allocated_skbs++; |
3439 | pkt_dev->clone_count = 0; /* reset counter */ | 3440 | pkt_dev->clone_count = 0; /* reset counter */ |
3440 | } | 3441 | } |
@@ -3461,7 +3462,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3461 | pkt_dev->last_ok = 1; | 3462 | pkt_dev->last_ok = 1; |
3462 | pkt_dev->sofar++; | 3463 | pkt_dev->sofar++; |
3463 | pkt_dev->seq_num++; | 3464 | pkt_dev->seq_num++; |
3464 | pkt_dev->tx_bytes += pkt_dev->cur_pkt_size; | 3465 | pkt_dev->tx_bytes += pkt_dev->last_pkt_size; |
3465 | break; | 3466 | break; |
3466 | default: /* Drivers are not supposed to return other values! */ | 3467 | default: /* Drivers are not supposed to return other values! */ |
3467 | if (net_ratelimit()) | 3468 | if (net_ratelimit()) |