From owner-freebsd-net@FreeBSD.ORG Fri Sep 5 12:05:10 2014 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 89BE5F6A for ; Fri, 5 Sep 2014 12:05:10 +0000 (UTC) Received: from mx11.netapp.com (mx11.netapp.com [216.240.18.76]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "mx11.netapp.com", Issuer "VeriSign Class 3 International Server CA - G3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B4CE1BA6 for ; Fri, 5 Sep 2014 12:05:09 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.04,472,1406617200"; d="asc'?scan'208";a="144600218" Received: from hioexcmbx05-prd.hq.netapp.com ([10.122.105.38]) by mx11-out.netapp.com with ESMTP; 05 Sep 2014 05:05:03 -0700 Received: from HIOEXCMBX07-PRD.hq.netapp.com (10.122.105.40) by hioexcmbx05-prd.hq.netapp.com (10.122.105.38) with Microsoft SMTP Server (TLS) id 15.0.913.22; Fri, 5 Sep 2014 05:04:55 -0700 Received: from HIOEXCMBX07-PRD.hq.netapp.com ([::1]) by hioexcmbx07-prd.hq.netapp.com ([fe80::55e3:a7dc:11bd:462%21]) with mapi id 15.00.0913.011; Fri, 5 Sep 2014 05:04:55 -0700 From: "Eggert, Lars" To: Luigi Rizzo Subject: Re: netmap extra rings and buffers Thread-Topic: netmap extra rings and buffers Thread-Index: AQHPyDeKjIx8ly78NE+bckXSokPnmZvxlEGAgAFT5wA= Date: Fri, 5 Sep 2014 12:04:54 +0000 Message-ID: References: <20140904154829.GA80780@onelab2.iet.unipi.it> In-Reply-To: <20140904154829.GA80780@onelab2.iet.unipi.it> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.1878.6) x-originating-ip: [10.122.56.79] Content-Type: multipart/signed; boundary="Apple-Mail=_D38DAF81-2472-404E-961F-DB255E0C6728"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 Cc: "net@freebsd.org" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Sep 2014 12:05:10 -0000 --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 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--