Date: Fri, 17 Oct 2014 10:27:54 -0700 From: Luigi Rizzo <rizzo@iet.unipi.it> To: "Matthew P. Grosvenor" <matthew.grosvenor@cl.cam.ac.uk> Cc: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org> Subject: Re: Netmap: head vs cur vs tail? Message-ID: <CA%2BhQ2%2Bg4awd8EHVe68O6%2B5B7QcFcco0scD5bPGWKhkUxT_LpgA@mail.gmail.com> In-Reply-To: <9C6995C3-2B7A-4769-A658-DCF1C1B23B60@cl.cam.ac.uk> References: <9C6995C3-2B7A-4769-A658-DCF1C1B23B60@cl.cam.ac.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Oct 17, 2014 at 9:55 AM, Matthew P. Grosvenor < matthew.grosvenor@cl.cam.ac.uk> wrote: > Hi all, > I’m trying to understand how to use the netmap framework, specifically how > the head, tail and current “pointers” interact with each other. > > Looking in man NETMAP(4) ( > http://www.freebsd.org/cgi/man.cgi?query=netmap&sektion=4) under data > structures, struct netmap_ring it says: " contains the index of he > current read or write slot (cur), “. In the example code, the following > pattern is used: > the default netmap manpage at the above URL is the old one, please use the one for 10-stable or 11-current http://www.freebsd.org/cgi/man.cgi ? query=netmap&manpath=FreeBSD+10.0-stable which explains in more detail the role of the three pointers (with some ascii graphics too). Feel free to ask for more details if the page is not clear cheers luigi > i = ring->cur; > ... > ring->cur = 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: > > j = rxring->cur; > while(…){ > j = nm_ring_next(rxring, j); > … > } > rxring->head = rxring->cur = 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? > > At a high level, I’m looking for a better understanding of what head, tail > and current mean and how they affect the processing of rings. > > > Cheers, > Matt > > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://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-2211611 . 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%2Bg4awd8EHVe68O6%2B5B7QcFcco0scD5bPGWKhkUxT_LpgA>
