From: Eric Dumazet <dada1@cosmosbay.com>
To: "Antoine Zen-Ruffinen" <antoine.zen@gmail.com>
Cc: netdev@vger.kernel.org, linux-net@vger.kernel.org,
netfilter-devel@vger.kernel.org, patrik.arlos@bth.se
Subject: Re: Problem with frame time stamping
Date: Mon, 12 Nov 2007 17:47:59 +0100 [thread overview]
Message-ID: <20071112174759.c2777ea2.dada1@cosmosbay.com> (raw)
In-Reply-To: <2cbbd8de0711120742h35f27441p5f096e5e99e1d7dc@mail.gmail.com>
On Mon, 12 Nov 2007 16:42:34 +0100
"Antoine Zen-Ruffinen" <antoine.zen@gmail.com> wrote:
> Dear all,
>
> I'm writing a network analyzer software using Linux and I need a VERY
> precise frame time stamping. Therefor I am planing to add my own time
> stamping algorithm on a modified network driver. For test purpose I
> did so :
>
> skb->tstamp.tv64 = 0x00010002;
> netif_rx(skb);
>
> On the user side, I ask for the timestamp that way :
>
> ...
> sock = socket(AF_PACKET, SOCK_RAW, type);
> ...
> //bind this socket with the interface using my modified driver.
> ...
> recvByteCount = recv(sock, buffer, 1514, 0);
> ioctl(sock, SIOCGSTAMP, &timeStamp);
>
> I was surprised to see that the var timeStamp was still holding a
> count of second since year 1970.
>
> Investigating a bit into the kernel code, I found that ioctl(sock,
> SIOCGSTAMP, ...) was giving just the current kernel time using
> ktime_get_real().
>
> Are my investigation wrong ?
> Is that a bug in kernel code ?
> Is there an other way to access skb.tstamp from user side ?
>
> Thank's to any one that can help me !
If your kernel is recent enough, you can already get nanosecond precision from skb tstamp, using SIOCGSTAMPNS ioctl or SO_TIMESTAMPNS / SCM_TIMESTAMPNS
(changes where done in March/April this year)
http://git2.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=b7aa0bf70c4afb9e38be25f5c0922498d0f8684c
http://git2.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=ae40eb1ef30ab4120bd3c8b7e3da99ee53d27a23
http://git2.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=92f37fd2ee805aa77925c1e64fd56088b46094fc
No need to modify a network driver :)
next prev parent reply other threads:[~2007-11-12 16:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-12 15:42 Problem with frame time stamping Antoine Zen-Ruffinen
2007-11-12 16:47 ` Eric Dumazet [this message]
2007-11-13 10:07 ` Antoine Zen-Ruffinen
2007-11-13 10:27 ` Eric Dumazet
2007-11-13 10:39 ` Antoine Zen-Ruffinen
2007-11-13 10:43 ` Antoine Zen-Ruffinen
2007-11-13 10:55 ` Eric Dumazet
2007-11-13 12:34 ` Antoine Zen-Ruffinen
2007-11-13 13:13 ` Eric Dumazet
2007-11-13 14:46 ` Antoine Zen-Ruffinen
2007-11-13 10:36 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071112174759.c2777ea2.dada1@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=antoine.zen@gmail.com \
--cc=linux-net@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=patrik.arlos@bth.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).