howto determine network device unit number? device.hints?

Eygene Ryabinkin rea-fbsd at codelabs.ru
Thu Jan 15 08:48:24 PST 2009


Bruce, good day.

Thu, Jan 15, 2009 at 03:01:37PM +0000, Bruce M. Simpson wrote:
> Bruce M. Simpson wrote:
> > In your case I'm not sure why your two cards would flip order. Could 
> > it be how your BIOS and hardware set up the PCI IDSEL lines at boot?
> 
> If this is the case on your system, then you really need to provide more 
> data about your hardware, i.e. motherboard, BIOS, vendor information 
> etc. as others point out.

I wanted to stress only one point: simple 'kldunload <driver>' and
'kldload <driver>' makes devices to flip for Yony's case.  This means
that unless some PCI hotplug stuff is here (which I don't believe to be
present, because no physical cards are touched and there is actually a
small amount of PCI hotplug support in FreeBSD), no physical PCI devices
get added or removed from the PCI child tree.  It looks like that
something goes wrong during the PCI tree reprobe on the driver module
loading.

Correct me if I am wrong, but pci_driver_added from /sys/pci/pci.c will
invoke device_get_children() to get the list of the attached devices,
and for PCI case the list should be static.

Here is what I get for the 'kldload if_em' with verbose boot:
-----
pci0: driver added
found-> vendor=0x8086, dev=0x283e, revid=0x02
        domain=0, bus=0, slot=31, func=3
        class=0c-05-00, hdrtype=0x00, mfdev=0
        cmdreg=0x0001, statreg=0x0280, cachelnsz=0 (dwords)
        lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
        intpin=c, irq=18
pci0:0:31:3: reprobing on driver added
pci1: driver added
pci2: driver added
pci3: driver added
pci4: driver added
pci5: driver added
found-> vendor=0x8086, dev=0x1010, revid=0x01
        domain=0, bus=5, slot=3, func=0
        class=02-00-00, hdrtype=0x00, mfdev=1
        cmdreg=0x0017, statreg=0x0230, cachelnsz=8 (dwords)
        lattimer=0x40 (1920 ns), mingnt=0xff (63750 ns), maxlat=0x00 (0 ns)
        intpin=a, irq=16
        powerspec 2  supports D0 D3  current D0
        MSI supports 1 message, 64 bit
pci0:5:3:0: reprobing on driver added
em0: <Intel(R) PRO/1000 Network Connection 6.9.6> port 0xb880-0xb8bf mem 0xff7c0000-0xff7dffff irq 16 at device 3.0 on pci5
pcib5: em0 requested memory range 0xff7c0000-0xff7dffff: good
pcib5: em0 requested I/O range 0xb880-0xb8bf: in range
em0: [FILTER]
em0: bpf attached
em0: Ethernet address: NN:NN:NN:NN:NN:NN
found-> vendor=0x8086, dev=0x1010, revid=0x01
        domain=0, bus=5, slot=3, func=1
        class=02-00-00, hdrtype=0x00, mfdev=1
        cmdreg=0x0017, statreg=0x0230, cachelnsz=8 (dwords)
        lattimer=0x40 (1920 ns), mingnt=0xff (63750 ns), maxlat=0x00 (0 ns)
        intpin=b, irq=17
        powerspec 2  supports D0 D3  current D0
        MSI supports 1 message, 64 bit
pci0:5:3:1: reprobing on driver added
em1: <Intel(R) PRO/1000 Network Connection 6.9.6> port 0xbc00-0xbc3f mem 0xff7e0000-0xff7fffff irq 17 at device 3.1 on pci5
pcib5: em1 requested memory range 0xff7e0000-0xff7fffff: good
pcib5: em1 requested I/O range 0xbc00-0xbc3f: in range
em1: [FILTER]
em1: bpf attached
em1: Ethernet address: NN:NN:NN:NN:NN:NN
-----
And this message is stable across repeated kldunload/kldload.

I guess that when Yony will enable verbose boot and will show us kernel
messages from two successive kldunload/kldload sequences, we will get
some additional information about what's going on.
-- 
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-net mailing list