]> git.baikalelectronics.ru Git - kernel.git/commit
net: Consistent skb timestamping
authorEric Dumazet <eric.dumazet@gmail.com>
Sun, 16 May 2010 06:57:10 +0000 (23:57 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 16 May 2010 06:57:10 +0000 (23:57 -0700)
commit769c199f0e8960bb6c5e092a68bc146fff1f4cc5
tree586c4f5dc57988ade175ffc7e4b6d0261b12e166
parent958e8f646013883318df500b695d4b47940c2420
net: Consistent skb timestamping

With RPS inclusion, skb timestamping is not consistent in RX path.

If netif_receive_skb() is used, its deferred after RPS dispatch.

If netif_rx() is used, its done before RPS dispatch.

This can give strange tcpdump timestamps results.

I think timestamping should be done as soon as possible in the receive
path, to get meaningful values (ie timestamps taken at the time packet
was delivered by NIC driver to our stack), even if NAPI already can
defer timestamping a bit (RPS can help to reduce the gap)

Tom Herbert prefer to sample timestamps after RPS dispatch. In case
sampling is expensive (HPET/acpi_pm on x86), this makes sense.

Let admins switch from one mode to another, using a new
sysctl, /proc/sys/net/core/netdev_tstamp_prequeue

Its default value (1), means timestamps are taken as soon as possible,
before backlog queueing, giving accurate timestamps.

Setting a 0 value permits to sample timestamps when processing backlog,
after RPS dispatch, to lower the load of the pre-RPS cpu.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/sysctl/net.txt
include/linux/netdevice.h
net/core/dev.c
net/core/sysctl_net_core.c