Date: Fri, 5 Sep 2014 12:04:54 +0000 From: "Eggert, Lars" <lars@netapp.com> To: Luigi Rizzo <rizzo@iet.unipi.it> Cc: "net@freebsd.org" <net@freebsd.org> Subject: Re: netmap extra rings and buffers Message-ID: <B3645592-E5B8-448E-86FE-76FF96FB8733@netapp.com> In-Reply-To: <20140904154829.GA80780@onelab2.iet.unipi.it> References: <B1098F39-36FD-440B-B325-91F0FE78C9E1@netapp.com> <20140904154829.GA80780@onelab2.iet.unipi.it>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_D38DAF81-2472-404E-961F-DB255E0C6728 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Thank you! On 2014-9-4, at 17:48, Luigi Rizzo <rizzo@iet.unipi.it> wrote: > On Thu, Sep 04, 2014 at 11:58:28AM +0000, Eggert, Lars wrote: >> Hi Luigi, >>=20 >> I'm allocating extra rings and/or extra buffers via the = nr_arg1/nr_arg3 parameters for NIOCREGIF. >>=20 >> Once I've done that, how do I actually access those rings and = buffers? >>=20 >> For extra rings, the documentation and example code don't really say = anything. >>=20 >> For extra buffers, the documentation says "nifp->ni_bufs_head will be = the index of the first buffer" but doesn't really explain how I can find = the buffer given its index (since it's not in a ring, the NETMAP_BUF = macro doesn't seem to apply?) The part about "buffers are linked to each = other using the first uint32_t as the index" is also unclear to me. >>=20 >> Do you have some more text or example code that shows how to use = extra rings and buffers? >=20 > the ifield to request extra rings is only important when you want > to make sure that the memory region for a VALE port has also > space to host some pipes. Otherwise, for physical ports (which at > the moment all share the same address space) there is not a real > need to specify it. >=20 > For the extra buffers, remember that NETMAP_BUF() can translate > buffer indexes for any netmap buffer, even those not in a ring. > All it does is grab the base address of the buffer pool from the > ring, and add the buffer index times the buffer size. >=20 > So you can navigate the pool of extra buffers as follows >=20 > uint32_t x =3D nifp->ni_bufs_head; // index of first buf >=20 > void *p =3D NETMAP_BUF(any_ring, x); // address of the first = buffer >=20 > x =3D *((uint32_t *)p); // index of the next buffer >=20 > cheers > luigi --Apple-Mail=_D38DAF81-2472-404E-961F-DB255E0C6728 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- iQCVAwUBVAmm7tZcnpRveo1xAQJdvwQArdgb98zSrUuO4ZwsIM9QRAUqwNZaZUkJ RPWm6tjnUtl/xBFnTYsYSx7rxv41c/eq0gt+wjco8B0I0AMoRBuGGslZ0MAfddne epfyAQflorXAnqK0kdbsc4rTB1qtk8LOaijZBMogPTQiBnviL0NZinU10qrRowiE w0rrn322IBo= =KfOU -----END PGP SIGNATURE----- --Apple-Mail=_D38DAF81-2472-404E-961F-DB255E0C6728--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B3645592-E5B8-448E-86FE-76FF96FB8733>