OSDN Git Service

net: add tx_packets/tx_bytes/tx_dropped counters in struct netdev_queue
authorEric Dumazet <dada1@cosmosbay.com>
Mon, 18 May 2009 00:34:33 +0000 (00:34 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 18 May 2009 22:15:06 +0000 (15:15 -0700)
commit7004bf252c53da18f6b55103e0c92f777f846806
tree29868ce170599fbed3471f53afe3a20f23fb31c3
parentba98898eb3fc07ee54566fcc3626354a44355acb
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>
include/linux/netdevice.h
net/core/dev.c