netmap packet timestamping

Luigi Rizzo rizzo at iet.unipi.it
Thu Feb 18 22:41:32 UTC 2016


Hi,
when you call poll() or one of the ioctl, the timestamp
is saved in the netmap_ring and you can access it from
there. This is roughly as good (or as bad) as the timestamp
supplied by the OS kernel in the regular network stack.

Differences:
- the kernel network stack typically produces a timestamp
  when the interrupt/NAPI thread runs, which is not when
  packet was received. Packets processed in the same run
  of the interrupt handler may have slightly different
  timestamps but the interval between packets has no
  relation to the actual interarrival times.

- the timestamp provided by netmap in the netmap ring only
  indicates the last time the *_rxsync() has been called.
  This happens during the execution of a system call, so
  when the calling process is about to be woken up. Again
  it does not correspond to the actual packet arrival time,
  though the process may run slightly later than the interrupt
  thread in the previous case, depending on priorities.

  We could in principle have the interrupt thread update
  the timestamp in the ring but that would be racy.

  There is only a single timestamp for the entire ring,
  which helps reminding you that you cannot compute
  interarrival times for packets that arrive in the same interrupt.


cheers
luigi

On Mon, Feb 15, 2016 at 6:20 PM, Chris Inacio <nacho319 at gmail.com> wrote:
> Hello all,
>
> I'm trying to write some code to work with netmap which previously worked
> with PCAP API.  In the PCAP API it's easy enough to get the timestamp the
> packet arrived from the API, but I can't find that (easily) from the netmap
> API.  I'm not concerned with Tx, only Rx.
>
> Is there an easy place to get the packet timestamp?  I saw the timestamp in
> the flags, but it wasn't clear to me that it would be a received timestamp.
>
> Also, since I'm not a regular list reader, please keep my email address on
> the thread too.
>
> Thanks
> chris inacio
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"



-- 
-----------------------------------------+-------------------------------
 Prof. Luigi RIZZO, rizzo at iet.unipi.it  . Dip. di Ing. dell'Informazione
 http://www.iet.unipi.it/~luigi/        . Universita` di Pisa
 TEL      +39-050-2217533               . via Diotisalvi 2
 Mobile   +39-338-6809875               . 56122 PISA (Italy)
-----------------------------------------+-------------------------------


More information about the freebsd-net mailing list