Subject: 1.6.2 kernel: ex driver sometimes can't allocate
To: None <>
From: Chapman Flack <>
List: tech-kern
Date: 09/18/2004 19:58:50

My PC-Card NIC (3c575B-TX) always works fine if it is present at boot.

If I plug it in later, it sometimes works fine, and sometimes fails in
attach at this line (/sys/dev/ic/elinkxl.c:276):

         * Allocate the download descriptors, and create and load the DMA
         * map for them.
        if ((error = bus_dmamem_alloc(sc->sc_dmat,
            EX_NDPD * sizeof (struct ex_dpd), PAGE_SIZE, 0, &sc->sc_dseg, 1, 
            &sc->sc_drseg, BUS_DMA_NOWAIT)) != 0) {
                printf("%s: can't allocate download descriptors, error = %d\n",
                    sc->sc_dev.dv_xname, error);
                goto fail;

error comes back 12 (ENOMEM?)

I actually got it to attach last time by popping the card back out and then
closing a few xterms and mozilla; shoved the card back in and it worked.
How does *that* work - what resources are userland programs able to starve
bus_dmamem_alloc of?

Is there any way I can configure some kind of resource reservation so this
doesn't happen when I plug this card in after boot?  Would it work better if
I explicitly config ex0 and ex1, instead of clone ex* ?

Abridged dmesg:

NetBSD 1.6.2 (olaf) #31: Sun Sep  5 07:54:25 EST 2004
cpu0: Intel Celeron (Mendocino) (686-class), 397.07 MHz
cpu0: I-cache 16 KB 32b/line 4-way, D-cache 16 KB 32b/line 2-way
cpu0: L2 cache 256 KB 32b/line 4-way
cpu0: features 183f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR>
cpu0: features 183f9ff<PGE,MCA,CMOV,FGPAT,PSE36,MMX>
cpu0: features 183f9ff<FXSR>
total memory = 127 MB
avail memory = 114 MB
using 1658 buffers containing 6632 KB of memory
mainbus0 (root)
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
cbb0 at pci0 dev 3 function 0: Texas Instruments PCI1225 PCI-CardBus Bridge (rev. 0x01)
cbb0: interrupting at irq 11
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 2 device 0
ex1 at cardbus0 dev 0 function 0: 3Com 3c575B-TX Ethernet
ex1: MAC address 00:50:04:df:69:42
ukphy0 at ex1 phy 0: Generic IEEE 802.3u media interface
ukphy0: 78Q2120 10/100 media interface (OUI 0x00039c, model 0x0014), rev. 3
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto

That's from a successful attach.  ukphy is right; it's a tq device on the
card but tqphy doesn't want it because the revision number of the device is
lower than tqphy will attach.

The unsuccessful attach just looks like this:

ex1 at cardbus0 dev 0 function 0: 3Com 3c575B-TX Ethernet
ex1: MAC address 00:50:04:df:69:42
ex1: can't allocate download descriptors, error = 12