Date: Thu, 18 Feb 2016 14:41:30 -0800 From: Luigi Rizzo <rizzo@iet.unipi.it> To: Chris Inacio <nacho319@gmail.com> Cc: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org> Subject: Re: netmap packet timestamping Message-ID: <CA%2BhQ2%2Bgj2ELg6h%2BW4Ov7ihK4WH6gynXYLdvcFbnSnOQPxUOTJA@mail.gmail.com> In-Reply-To: <CAG_PEew%2BVSGRefkYhyP03fX%2BN4rBAGFXnV1zJ0pW8NJttqZbvA@mail.gmail.com> References: <CAG_PEew%2BVSGRefkYhyP03fX%2BN4rBAGFXnV1zJ0pW8NJttqZbvA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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@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@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" -- -----------------------------------------+------------------------------- Prof. Luigi RIZZO, rizzo@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) -----------------------------------------+-------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BhQ2%2Bgj2ELg6h%2BW4Ov7ihK4WH6gynXYLdvcFbnSnOQPxUOTJA>