Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Mar 2008 10:55:12 -0500
From:      Brooks Davis <brooks@freebsd.org>
To:        Yehonatan Yossef <yoniy@mellanox.co.il>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Duplicate interface name
Message-ID:  <20080317155512.GB38485@lor.one-eyed-alien.net>
In-Reply-To: <6C2C79E72C305246B504CBA17B5500C9038B0EA3@mtlexch01.mtl.com>
References:  <200803171107.m2HB78ri055178@freefall.freebsd.org> <6C2C79E72C305246B504CBA17B5500C9038B0EA3@mtlexch01.mtl.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080317155512.GB38485>