Date: Fri, 17 Oct 2014 17:55:26 +0100 From: "Matthew P. Grosvenor" <matthew.grosvenor@cl.cam.ac.uk> To: freebsd-net@freebsd.org Subject: Netmap: head vs cur vs tail? Message-ID: <9C6995C3-2B7A-4769-A658-DCF1C1B23B60@cl.cam.ac.uk>
next in thread | raw e-mail | index | archive | help
Hi all, I=92m trying to understand how to use the netmap framework, specifically = how the head, tail and current =93pointers=94 interact with each other.=20= Looking in man NETMAP(4) = (http://www.freebsd.org/cgi/man.cgi?query=3Dnetmap&sektion=3D4) under = data structures, struct netmap_ring it says: " contains the index = of he current read or write slot (cur), =93. In the example code, the = following pattern is used:=20 i =3D ring->cur; ... ring->cur =3D NETMAP_RING_NEXT(ring, i); However, in the example that ships with the netmap source = (https://code.google.com/p/netmap/source/browse/examples/bridge.c#72 & = https://code.google.com/p/netmap/source/browse/examples/pkt-gen.c#660) = the following pattern is used:=20 j =3D rxring->cur;=20 while(=85){ j =3D nm_ring_next(rxring, j); =85 } rxring->head =3D rxring->cur =3D j; So the obvious question is, what is the relationship between head and = current? Do I believe the man page (and man page example) that head is = not necessary, or do I believe the example code that head is necessary = and should be set to the same value as current? And if so, what is the = point of head? And why is it updated outside of the loop in both of the = examples?=20 At a high level, I=92m looking for a better understanding of what head, = tail and current mean and how they affect the processing of rings.=20 Cheers, Matt
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9C6995C3-2B7A-4769-A658-DCF1C1B23B60>