# [SOLVED] - iwlwifi: delay loading firmware

## cach0rr0

Just trying to get this issue put to paper so that a)maybe I can figure it out, b)other people can find it 

The only other place I've found where someone else seems to notice this is here: http://forums.funtoo.org/viewtopic.php?id=1301

The crux of it is this - iwlwifi gets loaded after ~15 seconds

```

[   15.444646] iwlwifi 0000:02:00.0: pci_resource_len = 0x00002000

[   15.444649] iwlwifi 0000:02:00.0: pci_resource_base = ffffc90000068000

[   15.444651] iwlwifi 0000:02:00.0: HW Revision ID = 0x0

[   15.444738] iwlwifi 0000:02:00.0: irq 47 for MSI/MSI-X

[   15.444795] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_DEBUG disabled

[   15.444797] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_DEBUGFS disabled

[   15.444799] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_DEVICE_TRACING disabled

[   15.444801] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_DEVICE_TESTMODE enabled

[   15.444803] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_P2P disabled

[   15.444809] iwlwifi 0000:02:00.0: Detected Intel(R) Centrino(R) Wireless-N 1000 BGN, REV=0x6C

[   15.444871] iwlwifi 0000:02:00.0: L1 Enabled; Disabling L0S

[   15.463894] iwlwifi 0000:02:00.0: device EEPROM VER=0x15d, CALIB=0x6

[   15.463896] iwlwifi 0000:02:00.0: Device SKU: 0x50

[   15.463898] iwlwifi 0000:02:00.0: Valid Tx ant: 0x1, Valid Rx ant: 0x3

[   15.463906] iwlwifi 0000:02:00.0: Tunable channels: 13 802.11bg, 0 802.11a channels

```

However, the card isn't usable until the firmware gets loaded, over a minute after:

```

[   49.073403] EXT4-fs (sda4): re-mounted. Opts: commit=0

[   76.735484] iwlwifi 0000:02:00.0: loaded firmware version 39.31.5.1 build 35138

[   76.735758] Registered led device: phy0-led

[   76.736396] ieee80211 phy0: Selected rate control algorithm 'iwl-agn-rs'

```

The tangible result of which, is that you're sitting there staring at your system waiting for wireless to actually be usable for a good minute before you can actually connect. 

I've come across a handful of somewhat old (6+ months) posts with regards to a kernel patch to delay loading of firmware, BUT the further reading I've done seemed to imply this wasn't particularly relevant. 

Has anyone else seen this kind of absurd delay with iwlwifi? 

For reference, my hardware is as such:

```

02:00.0 Network controller [0280]: Intel Corporation Centrino Wireless-N 1000 [8086:0084]

        Subsystem: Intel Corporation Centrino Wireless-N 1000 BGN [8086:1315]

        Flags: bus master, fast devsel, latency 0, IRQ 47

        Memory at d8500000 (64-bit, non-prefetchable) [size=8K]

        Capabilities: [c8] Power Management version 3

        Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+

        Capabilities: [e0] Express Endpoint, MSI 00

        Capabilities: [100] Advanced Error Reporting

        Capabilities: [140] Device Serial Number 00-1e-64-ff-ff-2b-90-38

        Kernel driver in use: iwlwifi

        Kernel modules: iwlwifi

```

tried this on gentoo-sources-3.3.0 and gentoo-sources-3.3.4, same behaviour on both. 

firmware in question is:

```

[I] net-wireless/iwl1000-ucode

     Available versions:  

        (0)     39.31.5.1

        (3)     **128.50.3.1

     Installed versions:  39.31.5.1(06:01:03 11/24/11)

     Homepage:            http://intellinuxwireless.org/?p=iwlwifi

     Description:         Intel (R) Wireless WiFi Link 1000BGN ucode

 * Contents of net-wireless/iwl1000-ucode-39.31.5.1:

/lib

/lib/firmware

/lib/firmware/iwlwifi-1000-5.ucode

/usr

/usr/share

/usr/share/doc

/usr/share/doc/iwl1000-ucode-39.31.5.1

/usr/share/doc/iwl1000-ucode-39.31.5.1/README.iwlwifi-1000-ucode.bz2

```

It's, obviously, not a "deal breaker" sort of issue, but it's certainly an annoyance, that after a couple of months has annoyed me enough to post about. 

Hopefully someone else has some insight, this ends up indexed in google, and there's a definitive searchable answer. 

Addendum - indeed ive tried the firmware built into the kernel, no difference. Which makes this all the more curious. The same behaviour can also be seen not only at boot, but if you rmmod, and then modprobe, there's that same ~60 second delay. My usual routine, to get things to start from scratch, is "rmmod iwlwifi ; rmmod mac80211 ; rmmod cfg80211 ; modprobe -v iwlwifi", which, to clarify, also produces this delay. 

TYIA!

----------

## cach0rr0

so, for anyone wondering, I did a bit of haphazard digging

not enough to really give an educated, definitive explanation, but after months, and finally being annoyed enough to try to solve this, it's solved. 

Unfortunately i think my resolution is unlikely to help the user in the Funtoo thread I referenced above. 

The Verdict:

A while back I scrapped udev in favor of mdev. TLDR version, seems - at least from what i can tell - request_firmware() is apparently some kind of kernel hook type thingy, that's responsible for actually doing the loading of the firmware. BUT, userspace must make this call. Presumably, udev would have done this instantly, but I can't recall if the timing of this issue coincides with the mdev migration (i *think* it does, but cant say for certain). Anyway, finding that userspace was responsible for this pointed me to mdev and hotplugging and how all that ties together. mdev being part of busybox. 

So all I had to do in this case, was update busybox:

```

1340167774:  === Unmerging... (sys-apps/busybox-1.19.3-r1)

1340167779:  ::: completed emerge (1 of 1) sys-apps/busybox-1.20.1 to /

```

did that, rebooted, result is now:

```

# dmesg |grep iwl

[    9.821308] iwlwifi 0000:02:00.0: pci_resource_len = 0x00002000

[    9.821311] iwlwifi 0000:02:00.0: pci_resource_base = ffffc90000068000

[    9.821313] iwlwifi 0000:02:00.0: HW Revision ID = 0x0

[    9.821454] iwlwifi 0000:02:00.0: irq 47 for MSI/MSI-X

[    9.821528] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_DEBUG disabled

[    9.821530] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_DEBUGFS disabled

[    9.821532] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_DEVICE_TRACING disabled

[    9.821534] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_DEVICE_TESTMODE enabled

[    9.821536] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_P2P disabled

[    9.821563] iwlwifi 0000:02:00.0: Detected Intel(R) Centrino(R) Wireless-N 1000 BGN, REV=0x6C

[    9.821673] iwlwifi 0000:02:00.0: L1 Enabled; Disabling L0S

[    9.840720] iwlwifi 0000:02:00.0: device EEPROM VER=0x15d, CALIB=0x6

[    9.840722] iwlwifi 0000:02:00.0: Device SKU: 0x50

[    9.840724] iwlwifi 0000:02:00.0: Valid Tx ant: 0x1, Valid Rx ant: 0x3

[    9.840733] iwlwifi 0000:02:00.0: Tunable channels: 13 802.11bg, 0 802.11a channels

[    9.939184] iwlwifi 0000:02:00.0: loaded firmware version 39.31.5.1 build 35138

[    9.942458] ieee80211 phy0: Selected rate control algorithm 'iwl-agn-rs'

```

ergo, jackpot. I'm assuming something in mdev's hotplugging bits has been updated - call it 51% certainty. It's not an educated guess, but it's a decent guess. 

Hope this helps some other poor troubled soul

----------

