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.yi...@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*? > > > > > > > > > > > > > > >