diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2009-05-17 20:34:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-18 18:15:06 -0400 |
commit | 7004bf252c53da18f6b55103e0c92f777f846806 (patch) | |
tree | 29868ce170599fbed3471f53afe3a20f23fb31c3 /include/linux/netdevice.h | |
parent | ba98898eb3fc07ee54566fcc3626354a44355acb (diff) |
net: add tx_packets/tx_bytes/tx_dropped counters in struct netdev_queue
offsetof(struct net_device, features)=0x44
offsetof(struct net_device, stats.tx_packets)=0x54
offsetof(struct net_device, stats.tx_bytes)=0x5c
offsetof(struct net_device, stats.tx_dropped)=0x6c
Network drivers that touch dev->stats.tx_packets/stats.tx_bytes in their
tx path can slow down SMP operations, since they dirty a cache line
that should stay shared (dev->features is needed in rx and tx paths)
We could move away stats field in net_device but it wont help that much.
(Two cache lines dirtied in tx path, we can do one only)
Better solution is to add tx_packets/tx_bytes/tx_dropped in struct
netdev_queue because this structure is already touched in tx path and
counters updates will then be free (no increase in size)
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index cd547d04a8ce..f8574e76b743 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -474,6 +474,9 @@ struct netdev_queue { | |||
474 | * please use this field instead of dev->trans_start | 474 | * please use this field instead of dev->trans_start |
475 | */ | 475 | */ |
476 | unsigned long trans_start; | 476 | unsigned long trans_start; |
477 | unsigned long tx_bytes; | ||
478 | unsigned long tx_packets; | ||
479 | unsigned long tx_dropped; | ||
477 | } ____cacheline_aligned_in_smp; | 480 | } ____cacheline_aligned_in_smp; |
478 | 481 | ||
479 | 482 | ||