Stephen Hemminger a écrit : > Another value since if someone turns on SO_TIMESTAMP they want usec (timeval) > and SO_TIMESTAMPNS would be for nanosecond values. Trying to set both > flags would be not allowed. > > - original - > > If the SO_TIMESTAMP option is enabled on a SOCK_DGRAM socket, the > recvmsg(2) call will return a timestamp corresponding to when the data- > gram was received. The msg_control field in the msghdr structure points > to a buffer that contains a cmsghdr structure followed by a struct > timeval. The cmsghdr fields have the following values: > > cmsg_len = sizeof(struct timeval) > cmsg_level = SOL_SOCKET > cmsg_type = SCM_TIMESTAMP > > - add - > If the SO_TIMESTAMPNS option is enabled on a SOCK_DGRAM socket, > ... > cmsg_len = sizeof(struct timespec) > cmsg_level = SOL_SOCKET > cmsg_type = SCM_TIMESTAMPNS I got it now, thank you :) Here is the second version of the patch. [NET] : introduce nanosecond time infrastructure for packet timestamping It appears some machines are *really* fast and that micro second resolution is a limiting factor. This patch converts sk_buff timestamp to use new nanosecond infra (added in 2.6.21), and introduces a new ioctl SIOCGSTAMPNS to let applications access nanosecond resolution (ie a timespec instead of timeval) SO_TIMESTAMPNS is also introduced so that a recvmsg() on SOCK_DGRAM socket may transfer a struct timespec (cmsg_type = SCM_TIMESTAMPNS). SO_TIMESTAMP and SO_TIMESTAMPNS are mutually exclusive. Signed-off-by: Eric Dumazet fs/compat_ioctl.c | 17 +++++++++ include/asm-alpha/socket.h | 2 + include/asm-alpha/sockios.h | 1 include/asm-arm/socket.h | 2 + include/asm-arm26/socket.h | 2 + include/asm-arm26/sockios.h | 3 + include/asm-avr32/socket.h | 2 + include/asm-avr32/sockios.h | 3 + include/asm-cris/sockios.h | 3 + include/asm-frv/socket.h | 2 + include/asm-frv/sockios.h | 3 + include/asm-h8300/socket.h | 2 + include/asm-h8300/sockios.h | 3 + include/asm-i386/socket.h | 2 + include/asm-i386/sockios.h | 3 + include/asm-ia64/socket.h | 2 + include/asm-ia64/sockios.h | 3 + include/asm-m32r/socket.h | 2 + include/asm-m32r/sockios.h | 3 + include/asm-m68k/socket.h | 2 + include/asm-m68k/sockios.h | 3 + include/asm-mips/socket.h | 2 + include/asm-mips/sockios.h | 3 + include/asm-parisc/socket.h | 2 + include/asm-parisc/sockios.h | 3 + include/asm-powerpc/socket.h | 2 + include/asm-powerpc/sockios.h | 3 + include/asm-s390/socket.h | 2 - include/asm-s390/sockios.h | 3 + include/asm-sh/socket.h | 2 - include/asm-sh/sockios.h | 1 include/asm-sh64/sockios.h | 1 include/asm-sparc/socket.h | 2 + include/asm-sparc/sockios.h | 3 + include/asm-sparc64/socket.h | 2 + include/asm-sparc64/sockios.h | 3 + include/asm-v850/socket.h | 2 + include/asm-v850/sockios.h | 3 + include/asm-x86_64/socket.h | 2 + include/asm-x86_64/sockios.h | 3 + include/asm-xtensa/socket.h | 2 + include/asm-xtensa/sockios.h | 3 + include/linux/skbuff.h | 38 ++++++++++++++++------ include/net/compat.h | 1 include/net/sock.h | 31 ++++++++++++----- net/appletalk/ddp.c | 3 + net/atm/ioctl.c | 3 + net/ax25/af_ax25.c | 4 ++ net/bridge/netfilter/ebt_ulog.c | 7 ++-- net/compat.c | 33 +++++++++++++++++-- net/core/dev.c | 8 ++-- net/core/sock.c | 36 +++++++++++++++++++- net/econet/af_econet.c | 5 ++ net/ipv4/af_inet.c | 3 + net/ipv4/ip_fragment.c | 6 +-- net/ipv4/netfilter/ip_queue.c | 2 - net/ipv4/netfilter/ipt_ULOG.c | 2 - net/ipv6/af_inet6.c | 3 + net/ipv6/netfilter/ip6_queue.c | 2 - net/ipv6/netfilter/nf_conntrack_reasm.c | 6 +-- net/ipv6/reassembly.c | 6 +-- net/ipx/af_ipx.c | 2 - net/netfilter/nfnetlink_log.c | 2 - net/netfilter/nfnetlink_queue.c | 2 - net/netrom/af_netrom.c | 5 ++ net/packet/af_packet.c | 4 +- net/rose/af_rose.c | 2 + net/sunrpc/svcsock.c | 9 ++--- net/wanrouter/af_wanpipe.c | 3 + net/x25/af_x25.c | 12 ++++++ 70 files changed, 280 insertions(+), 74 deletions(-)