DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] What is the 'unit of timestamp' assigned to mbuf packet in DPDK?
@ 2019-11-18 14:29 Gokul Bargaje
  2019-11-22 14:48 ` [dpdk-dev] [dpdk-users] " Ferruh Yigit
  2019-11-25 10:56 ` Archit Pandey
  0 siblings, 2 replies; 7+ messages in thread
From: Gokul Bargaje @ 2019-11-18 14:29 UTC (permalink / raw)
  To: dev, users

Hi,

The timestamp assigned to packet at the time of enqueue (value of timestamp
field in mbuf), is it in milliseconds or microseconds or in cpu cycles?

How this timestamp is calculated? Is it calculated using the *rte_cycles.h*?

Thanks in advance!
--Gokul

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [dpdk-users] What is the 'unit of timestamp' assigned to mbuf packet in DPDK?
  2019-11-18 14:29 [dpdk-dev] What is the 'unit of timestamp' assigned to mbuf packet in DPDK? Gokul Bargaje
@ 2019-11-22 14:48 ` Ferruh Yigit
  2019-11-22 17:00   ` Gokul Bargaje
  2019-11-25 10:56 ` Archit Pandey
  1 sibling, 1 reply; 7+ messages in thread
From: Ferruh Yigit @ 2019-11-22 14:48 UTC (permalink / raw)
  To: Gokul Bargaje, dev, users

On 11/18/2019 2:29 PM, Gokul Bargaje wrote:
> Hi,
> 
> The timestamp assigned to packet at the time of enqueue (value of timestamp
> field in mbuf), is it in milliseconds or microseconds or in cpu cycles?

The unit is not defined [1]. 'rte_eth_read_clock()' was added [2] to help
converting it to time when it is clock counter.

[1]
918ae9dc775e ("mbuf: add a timestamp field")

[2]
5e741377657c ("ethdev: add API to read device clock")

> 
> How this timestamp is calculated? Is it calculated using the *rte_cycles.h*?
> 






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [dpdk-users] What is the 'unit of timestamp' assigned to mbuf packet in DPDK?
  2019-11-22 14:48 ` [dpdk-dev] [dpdk-users] " Ferruh Yigit
@ 2019-11-22 17:00   ` Gokul Bargaje
  2019-11-22 17:05     ` Stephen Hemminger
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Gokul Bargaje @ 2019-11-22 17:00 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, users

Thank you for the clarification. But I am still unable to understand how
exactly timestamp is calculated before assigning to a timestamp field.
Could you please tell me the steps to calculate the timestamp in DPDK?

I have to implement the PIE AQM algorithm in DPDK and for that, I need to
calculate the total time spent by the packet waiting in queue (i.e. the
difference between enqueue time and dequeue time).

Thanks,
Gokul

On Fri, Nov 22, 2019 at 8:18 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 11/18/2019 2:29 PM, Gokul Bargaje wrote:
> > Hi,
> >
> > The timestamp assigned to packet at the time of enqueue (value of
> timestamp
> > field in mbuf), is it in milliseconds or microseconds or in cpu cycles?
>
> The unit is not defined [1]. 'rte_eth_read_clock()' was added [2] to help
> converting it to time when it is clock counter.
>
> [1]
> 918ae9dc775e ("mbuf: add a timestamp field")
>
> [2]
> 5e741377657c ("ethdev: add API to read device clock")
>
> >
> > How this timestamp is calculated? Is it calculated using the
> *rte_cycles.h*?
> >
>
>
>
>
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [dpdk-users] What is the 'unit of timestamp' assigned to mbuf packet in DPDK?
  2019-11-22 17:00   ` Gokul Bargaje
@ 2019-11-22 17:05     ` Stephen Hemminger
  2019-11-27 14:49     ` Tom Barbette
  2019-11-28  8:28     ` Harman Kalra
  2 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2019-11-22 17:05 UTC (permalink / raw)
  To: Gokul Bargaje; +Cc: Ferruh Yigit, dev, users

On Fri, 22 Nov 2019 22:30:11 +0530
Gokul Bargaje <gokulbargaje.182009@nitk.edu.in> wrote:

> Thank you for the clarification. But I am still unable to understand how
> exactly timestamp is calculated before assigning to a timestamp field.
> Could you please tell me the steps to calculate the timestamp in DPDK?
> 
> I have to implement the PIE AQM algorithm in DPDK and for that, I need to
> calculate the total time spent by the packet waiting in queue (i.e. the
> difference between enqueue time and dequeue time).

The use of timestamp field is very spotty.
Only mellanox implements it.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [dpdk-users] What is the 'unit of timestamp' assigned to mbuf packet in DPDK?
  2019-11-18 14:29 [dpdk-dev] What is the 'unit of timestamp' assigned to mbuf packet in DPDK? Gokul Bargaje
  2019-11-22 14:48 ` [dpdk-dev] [dpdk-users] " Ferruh Yigit
@ 2019-11-25 10:56 ` Archit Pandey
  1 sibling, 0 replies; 7+ messages in thread
From: Archit Pandey @ 2019-11-25 10:56 UTC (permalink / raw)
  To: Gokul Bargaje, dev, users

 From lib/librte_mbuf/rte_mbuf_core.h:

|605 /** Valid if PKT_RX_TIMESTAMP is set. The unit and time reference 
606 * are not normalized but are always the same for a given port. 607 * 
Some devices allow to query rte_eth_read_clock that will return the 608 
* current device timestamp. 609 */ 610 uint64_t timestamp;|

|I believe the timestamp in mbuf is set by the NIC. If it isn't, 
librte_eventdev sets it using rte_get_tsc_cycle(). From 
/lib/librte_eventdev/rte_event_eth_rx_adapter.h |

22 * The adapter uses a EAL service core function for SW based packet transfer
23 * and uses the eventdev PMD functions to configure HW based packet transfer
24 * between the ethernet device and the event device. For SW based packet
25 * transfer, if the mbuf does not have a timestamp set, the adapter adds a
26 * timestamp to the mbuf using rte_get_tsc_cycles(), this provides a more
27 * accurate timestamp as compared to if the application were to set the time
28 * stamp since it avoids event device schedule latency.

Hope that helps!

On 11/18/2019 7:59 PM, Gokul Bargaje wrote:
> Hi,
>
> The timestamp assigned to packet at the time of enqueue (value of timestamp
> field in mbuf), is it in milliseconds or microseconds or in cpu cycles?
>
> How this timestamp is calculated? Is it calculated using the *rte_cycles.h*?
>
> Thanks in advance!
> --Gokul

-- 
Archit Pandey
Senior Year Undergraduate Student
Department of Computer Science and Engineering
National Institute of Technology Karnataka
Surathkal, India


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [dpdk-users] What is the 'unit of timestamp' assigned to mbuf packet in DPDK?
  2019-11-22 17:00   ` Gokul Bargaje
  2019-11-22 17:05     ` Stephen Hemminger
@ 2019-11-27 14:49     ` Tom Barbette
  2019-11-28  8:28     ` Harman Kalra
  2 siblings, 0 replies; 7+ messages in thread
From: Tom Barbette @ 2019-11-27 14:49 UTC (permalink / raw)
  To: Gokul Bargaje, Ferruh Yigit; +Cc: dev, users

Hi Gokul,

As Setphen said, only Mellanox sets the hardware timestamp.

If you have a Mellanox card, you can actually follow the example given 
in the rxtx_callback sample application that precisely gives the number 
of CPU cycles a packet spent into the queue.


Tom

Le 22/11/2019 à 18:00, Gokul Bargaje a écrit :
> Thank you for the clarification. But I am still unable to understand how
> exactly timestamp is calculated before assigning to a timestamp field.
> Could you please tell me the steps to calculate the timestamp in DPDK?
> 
> I have to implement the PIE AQM algorithm in DPDK and for that, I need to
> calculate the total time spent by the packet waiting in queue (i.e. the
> difference between enqueue time and dequeue time).
> 
> Thanks,
> Gokul
> 
> On Fri, Nov 22, 2019 at 8:18 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> 
>> On 11/18/2019 2:29 PM, Gokul Bargaje wrote:
>>> Hi,
>>>
>>> The timestamp assigned to packet at the time of enqueue (value of
>> timestamp
>>> field in mbuf), is it in milliseconds or microseconds or in cpu cycles?
>>
>> The unit is not defined [1]. 'rte_eth_read_clock()' was added [2] to help
>> converting it to time when it is clock counter.
>>
>> [1]
>> 918ae9dc775e ("mbuf: add a timestamp field")
>>
>> [2]
>> 5e741377657c ("ethdev: add API to read device clock")
>>
>>>
>>> How this timestamp is calculated? Is it calculated using the
>> *rte_cycles.h*?
>>>
>>
>>
>>
>>
>>
>>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [dpdk-users] What is the 'unit of timestamp' assigned to mbuf packet in DPDK?
  2019-11-22 17:00   ` Gokul Bargaje
  2019-11-22 17:05     ` Stephen Hemminger
  2019-11-27 14:49     ` Tom Barbette
@ 2019-11-28  8:28     ` Harman Kalra
  2 siblings, 0 replies; 7+ messages in thread
From: Harman Kalra @ 2019-11-28  8:28 UTC (permalink / raw)
  To: Gokul Bargaje; +Cc: Ferruh Yigit, dev, users

On Fri, Nov 22, 2019 at 10:30:11PM +0530, Gokul Bargaje wrote:
> Thank you for the clarification. But I am still unable to understand how
> exactly timestamp is calculated before assigning to a timestamp field.
> Could you please tell me the steps to calculate the timestamp in DPDK?
> 
> I have to implement the PIE AQM algorithm in DPDK and for that, I need to
> calculate the total time spent by the packet waiting in queue (i.e. the
> difference between enqueue time and dequeue time).
> 
> Thanks,
> Gokul

Hi Gokul

octeontx2 also suports hardware timestamping, as soon as packet enter
the NIC queue, MAC writes the timestamp value to a memory location
(which is later read in mbuf->timestamp). Later using
'rte_eth_read_clock()' one can read the timestamp clock. Hence
"mbuf->timestamp - rte_eth_read_clock()" gives the time spent by packet
when it entered the queue to that point. As everybody suggested you can
refer rxtx_callback for more clarity. 
Octeontx2 driver also has 'rte_eth_read_clock()' eth op implemented

Thanks
Harman

> 
> On Fri, Nov 22, 2019 at 8:18 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> 
> > On 11/18/2019 2:29 PM, Gokul Bargaje wrote:
> > > Hi,
> > >
> > > The timestamp assigned to packet at the time of enqueue (value of
> > timestamp
> > > field in mbuf), is it in milliseconds or microseconds or in cpu cycles?
> >
> > The unit is not defined [1]. 'rte_eth_read_clock()' was added [2] to help
> > converting it to time when it is clock counter.
> >
> > [1]
> > 918ae9dc775e ("mbuf: add a timestamp field")
> >
> > [2]
> > 5e741377657c ("ethdev: add API to read device clock")
> >
> > >
> > > How this timestamp is calculated? Is it calculated using the
> > *rte_cycles.h*?
> > >
> >
> >
> >
> >
> >
> >

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-28  8:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18 14:29 [dpdk-dev] What is the 'unit of timestamp' assigned to mbuf packet in DPDK? Gokul Bargaje
2019-11-22 14:48 ` [dpdk-dev] [dpdk-users] " Ferruh Yigit
2019-11-22 17:00   ` Gokul Bargaje
2019-11-22 17:05     ` Stephen Hemminger
2019-11-27 14:49     ` Tom Barbette
2019-11-28  8:28     ` Harman Kalra
2019-11-25 10:56 ` Archit Pandey

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).