Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Oct 2014 07:58:57 +0100
From:      "Matthew P. Grosvenor" <matthew.grosvenor@cl.cam.ac.uk>
To:        Luigi Rizzo <rizzo@iet.unipi.it>
Cc:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   Re: Netmap: head vs cur vs tail?
Message-ID:  <986ECDB1-3D76-4930-9C08-A2661F573431@cl.cam.ac.uk>
In-Reply-To: <CA%2BhQ2%2Bg4awd8EHVe68O6%2B5B7QcFcco0scD5bPGWKhkUxT_LpgA@mail.gmail.com>
References:  <9C6995C3-2B7A-4769-A658-DCF1C1B23B60@cl.cam.ac.uk> <CA%2BhQ2%2Bg4awd8EHVe68O6%2B5B7QcFcco0scD5bPGWKhkUxT_LpgA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks! This has tons more info. I'll have a read.=20

-----------
Sent from my phone, sorry about the typos.=20

> On 17 Oct 2014, at 18:27, Luigi Rizzo <rizzo@iet.unipi.it> wrote:
>=20
>=20
>=20
>> On Fri, Oct 17, 2014 at 9:55 AM, Matthew P. Grosvenor <matthew.grosvenor@=
cl.cam.ac.uk> wrote:
>> Hi all,
>> I=E2=80=99m trying to understand how to use the netmap framework, specifi=
cally how the head, tail and current =E2=80=9Cpointers=E2=80=9D interact wit=
h each other.
>>=20
>> Looking in man NETMAP(4) (http://www.freebsd.org/cgi/man.cgi?query=3Dnetm=
ap&sektion=3D4) under data structures, struct netmap_ring   it says: "  cont=
ains the index of he current read or write slot (cur), =E2=80=9C. In the exa=
mple code, the following pattern is used:
>=20
> =E2=80=8Bthe default netmap manpage at the above URL is the old one,
> please use the one for 10-stable or 11-current=20
>=20
> http://www.freebsd.org/cgi/man.cgi=E2=80=8B?=E2=80=8Bquery=3Dnetmap&manpat=
h=3DFreeBSD+10.0-stable
>=20
> =E2=80=8Bwhich=E2=80=8B explains in more detail the role
> of the three pointers (with some ascii graphics too).
>=20
> Feel free to ask for more details if the page is not clear
>=20
> cheers
> luigi
>=20
>>=20
>>         i =3D ring->cur;
>>         ...
>>         ring->cur =3D NETMAP_RING_NEXT(ring, i);
>>=20
>> However, in the example that ships with the netmap source (https://code.g=
oogle.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 u=
sed:
>>=20
>>         j =3D rxring->cur;
>>         while(=E2=80=A6){
>>                 j =3D nm_ring_next(rxring, j);
>>         =E2=80=A6
>>         }
>>         rxring->head =3D rxring->cur =3D j;
>>=20
>> So the obvious question is, what is the relationship between head and cur=
rent? Do I believe the man page (and man page example) that head is not nece=
ssary, 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=E2=80=99m looking for a better understanding of what h=
ead, tail and current mean and how they affect the processing of rings.
>=20
> =20
>> Cheers,
>> Matt
>>=20
>> _______________________________________________
>> 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"
>=20
>=20
>=20
> --=20
> -----------------------------------------+-------------------------------
>  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?986ECDB1-3D76-4930-9C08-A2661F573431>