Skip to content

net: tx scalability works : tx_packets/tx_bytes/tx_dropped

Eric Dumazet netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2net: add tx_packets/tx_bytes/tx_dropped counters in struct netdev_queueinclude/linux/netdevice.h net/core/dev.c+23 -30 replies
2/2vlan: use struct netdev_queue counters instead of dev->statsnet/8021q/vlan_dev.c net/8021q/vlanproc.c+9 -80 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] net: tx scalability works : tx_packets/tx_bytes/tx_dropped

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

This means drivers that touch 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.

First patch adds the infrastructure, and second one uses this infrastructure for VLAN devices, for which I spoted the performance problem on Gigabit links.

rx path has same problem of course, but less prevalent as less cpus are involved in rx path if IRQ affinities not too dumb.

Thank you