netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Felipe Dias <felipediassss@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: skb->tstamp == 0.00000 ?
Date: Sun, 20 Nov 2011 18:15:14 +0100	[thread overview]
Message-ID: <4EC935A2.6020200@hartkopp.net> (raw)
In-Reply-To: <CAJX4=r1nz4Wq00tmJKUsJNLb41Bh4=-V1ixLcS05mXm0tpek9g@mail.gmail.com>

On 19.11.2011 22:18, Felipe Dias wrote:

> Hi..
> 
> Please let me know if this isnt right list to this kind of question.
> 
> I'm registering a new protocol handler with dev_add_pack. I would like
> to know only the difference between timestamp on skb->tstamp and the
> time of reception by my module.


Hello Felipe,

tstamp is a ktime_t type, which is a timestamp in nanosecs

http://lxr.linux.no/#linux+v3.1.1/include/linux/ktime.h#L28

The value in the skbuff

http://lxr.linux.no/#linux+v3.1.1/include/linux/skbuff.h#L347

is usually set at PDU reception time -> see netif_rx().

http://lxr.linux.no/#linux+v3.1.1/net/core/dev.c#L2879

where net_timestamp_check(skb) is executed which usually sets the timestamp
when timestamping is activated.

So when your netdevice creates a proper skbuff (e.g. using skb_alloc) the
timestamp is set to zero and therefore set to the receive time in
net_timestamp_check().


> 
> So I do:
> ----
> struct timeval time_skb, time_module;
> do_gettimeofday(&time_module):
> skb_get_timestamp(skb, &time_skb);
> ---
> 
> And time_skb.tv_sec and time_skb.tv_usec are equal to 0;
> 
> I'm doing some wrong ?


Hm, i don't see, why you convert ktime_t to timeval.

You better work on skb->tstamp with the ktime functions directly, e.g. with
skb_get_ktime().

I hope this gives you a bit more insight in skb->tstamp - even if i don't know
your problem in detail %-)

Regards,
Oliver

      reply	other threads:[~2011-11-20 17:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-19 21:18 skb->tstamp == 0.00000 ? Felipe Dias
2011-11-20 17:15 ` Oliver Hartkopp [this message]

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=4EC935A2.6020200@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=felipediassss@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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).