howto determine network device unit number? device.hints?

Eygene Ryabinkin rea-fbsd at codelabs.ru
Thu Jan 15 04:35:17 PST 2009


Thu, Jan 15, 2009 at 01:15:53PM +0200, Yony Yossef wrote:
> > You're using your own driver, aren't you?  If yes, could you 
> > show your device_method_t structure and the corresponding 
> > identify, probe, attach and detach routines?  You're setting 
> > the unit numbers via 'if_initname(ifp, device_get_name(dev), 
> > device_get_unit(dev))' or alike?
> 
> My device has 2 ports, therefore my if_initname is that:
> 
> if_initname(dev, device_get_name(mdev->pdev), 
>                 port + 2 * device_get_unit(mdev->pdev));

So, you totally have four network interfaces -- two for each PCI
device?

> This is what I captured the last time it happened. 
> 
> # pciconf -l | grep mtnic
> mtnic0 at pci0:19:0:0:     class=0x020000 card=0x001715b3 chip=0x636815b3
> rev=0xa0 hdr=0x00
> mtnic1 at pci0:16:0:0:     class=0x020000 card=0x001715b3 chip=0x636815b3
> rev=0xa0 hdr=0x00
> 
> # kldunload if_mtnic
> # kldload if_mtnic
> 
> # pciconf -l | grep mtnic
> mtnic1 at pci0:19:0:0:     class=0x020000 card=0x001715b3 chip=0x636815b3
> rev=0xa0 hdr=0x00
> mtnic0 at pci0:16:0:0:     class=0x020000 card=0x001715b3 chip=0x636815b3
> rev=0xa0 hdr=0x00

Could you do the following:

1. Boot with verbose kernel mode (push '5' on the boot screen).
2. Kldload your module and provide the full list of kernel messages
   you will see after this action.
3. Kldunload and again, provide all messages kernel will print
   for this.
4. Kldload again and supply all messages for the last time.

This will show the PCI enumeration sequence and probe order for your
driver pci device units.  This might shed some light on the problem.

Thanks.
-- 
Eygene
 _                ___       _.--.   #
 \`.|\..----...-'`   `-._.-'_.-'`   #  Remember that it is hard
 /  ' `         ,       __.--'      #  to read the on-line manual
 )/' _/     \   `-_,   /            #  while single-stepping the kernel.
 `-'" `"\_  ,_.-;_.-\_ ',  fsc/as   #
     _.-'_./   {_.'   ; /           #    -- FreeBSD Developers handbook
    {_.-``-'         {_/            #


More information about the freebsd-questions mailing list