Code Monkey home page Code Monkey logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on September 18, 2024
Hi Shawn,

Thanks for the patches.

I pushed the first one, but i have a two questions about the second one:
a. To my understanding the timestamp need to be taken when the packet is 
arriving to the interface from the NIC, and not when the user call the 
recvmsg() function. I think the linux kernel takes the timestamp even before 
the upper protocols (ip/tcp), and save it in the skb. I will move the timestamp 
taking to rx_input_cb(), and store it in our mem_buf_desc_t (skb analogous). 
Let me know if you think it should behave differently.
b. Do you have a special reason to use CLOCK_REALTIME?
Why not CLOCK_MONOTONIC or RDTSC?
If you have none, i would like to change it to RDTSC (see 
./src/vma/util/rdtsc.h).

Regarding HW timestamps, this feature is available in our NIC and driver, but 
is not fully exposed to user-space through verbs yet. Once it will, we will add 
support for it in libvma.

Original comment by [email protected] on 1 Feb 2014 at 8:59

from libvma.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 18, 2024
a) You are totally correct and I should have mentioned that I probably wasn't 
grabbing the timestamp in the best place.  I'm slowly working my way through 
the libvma code and wasn't sure where the earliest place VMA sees the packet.  
Feel free to grab the time at the earliest place you can.  Like you mentioned 
in the kernel the skb is normally timestampped in netif_receive_skb() which is 
the earliest point that the packet enters the networking core.  At that point 
the kernel timestamps the skb with ktime_get_real() which leads to...

b) The ktime_get_real() timestamp on the skb is used for SO_TIMESTAMP, 
SO_TIMESTAMPNS, and the software timestamp of SO_TIMESTAMPING.  
ktime_get_real() is equivalent to CLOCK_REALTIME.  Aside from simply matching 
the kernel's behavior, our use case typically uses the packet timestamp to 
compute delays through our system and even across machines.  We synchronize our 
system clocks with PTP and thus we can even  compute one-way delays with 
reasonable accuracy of packets between machines.

Original comment by [email protected] on 2 Feb 2014 at 12:15

from libvma.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 18, 2024
I moved the timestamp taking to when the packet reach the socket.
It can be a done a little earlier, when the packet is pulled from the CQ, but 
it is much more convenient to do it in the socket.

I stayed with the CLOCK_REALTIME.

https://code.google.com/p/libvma/source/detail?r=f6c8b49c677ef5463b438a25a42624b
a7d4653cd

https://code.google.com/p/libvma/source/detail?r=517b387b6d76d5f9d75df923f071696
24773d79c

https://code.google.com/p/libvma/source/detail?r=4368d99de8ef4b8086309cbbcd814a0
a56ee5777

Original comment by [email protected] on 2 Feb 2014 at 11:57

  • Changed state: Fixed

from libvma.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 18, 2024
    1599    +   if (m_b_rcvtstamp || (m_n_tsing_flags & (SOF_TIMESTAMPING_RX_SOFTWARE | SOF_TIMESTAMPING_SOFTWARE))) {
    1600    +   memset(&(p_desc->path.rx.timestamp), 0, sizeof(struct timespec));
    1601    +   clock_gettime(CLOCK_REALTIME, &(p_desc->path.rx.timestamp));
    1602    +   }

Is there reason for the memset before calling clock_gettime?  Are you afraid 
clock_gettime() might fail leaving garbage in the timestamp?

Original comment by [email protected] on 3 Feb 2014 at 11:35

from libvma.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 18, 2024
I removed the memset, but added another initializtion on mem_buff_desc recycle.

please see 
https://code.google.com/p/libvma/source/detail?r=364f41da4111a64fb22364d84982d31
c0c630849

Original comment by [email protected] on 6 Feb 2014 at 10:32

from libvma.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 18, 2024
Your latest change looks good to me, and I would also uncomment your TODO for 
when timestampping was requested after a packet has already arrived since that 
is exactly what the kernel does.  See __sock_recv_timestamp() in net/socket.c.

Original comment by [email protected] on 6 Feb 2014 at 5:16

from libvma.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 18, 2024
I uncomment the TODO.
I also added a memset to 0 for tsing, as we were returning garbage in the HW 
info for tsing_flags.

https://code.google.com/p/libvma/source/detail?r=f5e064e8c5986014f69a65fdbbfe0da
680bfd06d

Original comment by [email protected] on 6 Feb 2014 at 6:48

from libvma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.