From owner-freebsd-net@FreeBSD.ORG Mon Mar 17 15:55:14 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97CE9106564A for ; Mon, 17 Mar 2008 15:55:14 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (cl-162.ewr-01.us.sixxs.net [IPv6:2001:4830:1200:a1::2]) by mx1.freebsd.org (Postfix) with ESMTP id 168A68FC13 for ; Mon, 17 Mar 2008 15:55:13 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.1/8.13.8) with ESMTP id m2HFtDpo048729; Mon, 17 Mar 2008 10:55:13 -0500 (CDT) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.2/8.14.2/Submit) id m2HFtCPD048728; Mon, 17 Mar 2008 10:55:12 -0500 (CDT) (envelope-from brooks) Date: Mon, 17 Mar 2008 10:55:12 -0500 From: Brooks Davis To: Yehonatan Yossef Message-ID: <20080317155512.GB38485@lor.one-eyed-alien.net> References: <200803171107.m2HB78ri055178@freefall.freebsd.org> <6C2C79E72C305246B504CBA17B5500C9038B0EA3@mtlexch01.mtl.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="R3G7APHDIzY6R/pk" Content-Disposition: inline In-Reply-To: <6C2C79E72C305246B504CBA17B5500C9038B0EA3@mtlexch01.mtl.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (lor.one-eyed-alien.net [127.0.0.1]); Mon, 17 Mar 2008 10:55:13 -0500 (CDT) Cc: freebsd-net@freebsd.org Subject: Re: Duplicate interface name X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Mar 2008 15:55:14 -0000 --R3G7APHDIzY6R/pk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 17, 2008 at 01:24:13PM +0200, Yehonatan Yossef wrote: > =20 > Hi, >=20 > I'm porting a 10GigE driver to FreeBSD 6.3. My card has 2 ports. > Loading the driver brings up two new interfaces, problem is they have > the same name. >=20 > How do I configure the interface numbering? Generating the interface name is the driver's responsibility. In a typical hardware driver, this code is used: if_initname(ifp, device_get_name(dev), device_get_unit(dev)); With a dual-ported card that has only one bus attachment, you can't do that since you'll have to ifnets. If the driver will only support cards that ha= ve exactly two port, the easy solution would be to make the first if_initname call: if_initname(ifp, device_get_name(dev), device_get_unit(dev)*2); and the second if_initname(ifp, device_get_name(dev), (device_get_unit(dev)*2) + 1); If the number of ports can potentially vary then the driver will need to manage them internally. The unit number allocation framework can take care= of this for you. See alloc_unr(9). -- Brooks --R3G7APHDIzY6R/pk Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (FreeBSD) iD8DBQFH3pRfXY6L6fI4GtQRApMXAJ9xC4+/GcAQSemNdUH0ZdeBd3EO8gCgoM8D 2AdxnGoKSfZWMQc2Fa7kzSg= =0Qax -----END PGP SIGNATURE----- --R3G7APHDIzY6R/pk--