On Mon, Mar 17, 2008 at 01:24:13PM +0200, Yehonatan Yossef wrote: > > Hi, > > 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. > > 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 have 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
pgpHsJXaIL14i.pgp
Description: PGP signature