mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
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>
This commit is contained in:
parent
bf8e56bfc4
commit
baac856454
1 changed files with 3 additions and 2 deletions
|
@ -340,6 +340,7 @@ struct pktgen_dev {
|
||||||
__u16 cur_udp_src;
|
__u16 cur_udp_src;
|
||||||
__u16 cur_queue_map;
|
__u16 cur_queue_map;
|
||||||
__u32 cur_pkt_size;
|
__u32 cur_pkt_size;
|
||||||
|
__u32 last_pkt_size;
|
||||||
|
|
||||||
__u8 hh[14];
|
__u8 hh[14];
|
||||||
/* = {
|
/* = {
|
||||||
|
@ -3434,7 +3435,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
|
||||||
pkt_dev->clone_count--; /* back out increment, OOM */
|
pkt_dev->clone_count--; /* back out increment, OOM */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
pkt_dev->last_pkt_size = pkt_dev->skb->len;
|
||||||
pkt_dev->allocated_skbs++;
|
pkt_dev->allocated_skbs++;
|
||||||
pkt_dev->clone_count = 0; /* reset counter */
|
pkt_dev->clone_count = 0; /* reset counter */
|
||||||
}
|
}
|
||||||
|
@ -3461,7 +3462,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
|
||||||
pkt_dev->last_ok = 1;
|
pkt_dev->last_ok = 1;
|
||||||
pkt_dev->sofar++;
|
pkt_dev->sofar++;
|
||||||
pkt_dev->seq_num++;
|
pkt_dev->seq_num++;
|
||||||
pkt_dev->tx_bytes += pkt_dev->cur_pkt_size;
|
pkt_dev->tx_bytes += pkt_dev->last_pkt_size;
|
||||||
break;
|
break;
|
||||||
default: /* Drivers are not supposed to return other values! */
|
default: /* Drivers are not supposed to return other values! */
|
||||||
if (net_ratelimit())
|
if (net_ratelimit())
|
||||||
|
|
Loading…
Reference in a new issue