Iwlwifi
iwlwifi 是Intel 现有无线芯片的无线驱动。正确操作需要内核的 WiFi 栈支持以及在运行时加载特定芯片的固件。
内核
为了使其工作,需要进行一些内核配置。该驱动支持 802.11a/b/g/n/ac(取决于设备),因此应启用 IEEE 802.11。
IEEE 802.11
至少启用 cfg80211 (CONFIG_CFG80211) 和 mac80211 (CONFIG_MAC80211)。详情请参见 Wi-Fi 文章的 IEEE 802.11 部分。
设备驱动 iwlwifi
Use this driver for Intel's current wireless chips. Set it as a module <M>
as shown here. Also the correct DVM or MVM firmware option according to the Module column of the firmware table is needed.
Device Drivers --->
[*] Network device support --->
[*] Wireless LAN --->
[*] Intel devices
<M> Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi)
<M> Intel Wireless WiFi DVM Firmware support
<M> Intel Wireless WiFi MVM Firmware support
In case the driver is built into the kernel (
<*>
) instead as a module (<M>
), also the firmware needs to be built into the kernel. See the section When using built-in configuration.
After changes on kernel configuration do not forget to rebuild the kernel.
After rebuilding the kernel and rebooting with this kernel, the selected options can be verified as follows:
user $
zgrep 'IWLWIFI\|IWLDVM\|IWLMVM' /proc/config.gz
硬件
Additional firmware for the individual device is needed as listed in this table. Contemporary firmware is always available in the sys-kernel/linux-firmware package. In case it is not in linux-firmware it might be found in device-specific sys-firmware/iwlxxxx-*ucode packages.
Upstream Intel instructions recommend[1] adding all iwlwifi ucode to the kernel image. This is recommended for convenience, however it will bloat the kernel slightly.
root #
emerge --ask sys-kernel/linux-firmware
When using built-in configuration
In case the driver is built into the kernel (<*>
) instead as a module (<M>
), also the firmware needs to be built into the kernel.
Device Drivers --->
Generic Driver Options --->
Firmware loader --->
-*- Firmware loading facility
(iwlwifi-xxxx.ucode) Build named firmware blobs into the kernel binary
(/lib/firmware) Firmware blobs root directory
[ ] Enable the firmware sysfs fallback mechanism
In this case replace iwlwifi-xxxx.ucode
with the exact firmware name. Some attention seems to be needed for FW_LOADER_USER_HELPER_FALLBACK.
Optional: savedconfig
The savedconfig
USE flag could be set for Linux firmware in order to avoid unneeded stuff in /lib/firmware/.
As for example the Intel® Centrino® Advanced-N 6205 needs iwlwifi-6000g2a-ucode while anything else may be commented out or deleted.
iwlwifi-6000g2a-5.ucode
iwlwifi-6000g2a-6.ucode
In order to not lose these settings on next firmware update the version number needs to be removed:
user $
cd /etc/portage/savedconfig/sys-kernel
root #
mv linux-firmware{-20200316,}
Latest firmware version supporting device
Below is an incomplete list of the latest known firmware blob supporting a given chipset. Device names are retrieved using lspci.
Device name | Firmware blob filename | Firmware version |
---|---|---|
Intel Corporation Wi-Fi 6 AX200 (rev 1a) | iwlwifi-cc-a0-77.ucode | 77.ad46c98b.0
|
网络设备名称
This section is obsolete. See Udev#Optional: Disable_or_override_predictable_network_interface_naming for updated instructions.
内核提供的网络设备名称列入eth0 或 wlan0 等通常可以通过 /lib/udev/rules.d/80-net-name-slot.rules udev 规则在系统启动时更改参见 dmesg 。
为了保持传统命名,这个规则可以用 /etc/udev/rules.d 目录中用同样命名的空文件覆盖:
root #
touch /etc/udev/rules.d/80-net-name-slot.rules
测试
使用新内核重新引导后或加载模块后,可以使用以下方法检查设备的可用性:
- Using the /sys 文件系统
- Using the ip 命令
- Using the ifconfig 命令
- Using the iw 命令
/sys 文件系统
通过使用 ls -al 或 tree 命令(由app-text/tree 包提供))列出 /sys/class/net 目录内容来获取设备名称:
user $
tree /sys/class/net
/sys/class/net/ ├── enp2s14 -> ../../devices/pci0000:00/0000:00:1e.0/0000:02:0e.0/net/enp2s14 ├── lo -> ../../devices/virtual/net/lo ├── sit0 -> ../../devices/virtual/net/sit0 └── wlp8s0 -> ../../devices/pci0000:00/0000:00:1c.0/0000:08:00.0/net/wlp8s0
ip命令
要获取设备名称并验证是否检测到无线网卡,执行下面的 ip 命令:
user $
ip addr
3: wlan0: ...
ifconfig 命令
ifconfig 命令是 sys-apps/net-tools 包提供的。使用 ifconfig -a 列出所有检测到的网卡,包括那些尚未启用/尚未活动的网卡:
user $
ifconfig -a
wlan0 ...
网卡可以用下面的方法激活:
root #
ifconfig -v wlan0 up
SIOCSIFFLAGS: Operation not possible due to RF-kill WARNING: at least one error occurred. (-1)
在此示例中,启用无线网卡失败,因为设置了禁止无线电频率状态(通常是为了控制功耗并避免意外连接到无线网络)。
iw命令
如果无线网卡支持 nl80211 stack,net-wireless/iw 软件包提供的 iw 命令可以显示检测到的无线卡:
root #
iw dev
phy#0 Interface wlan0 ifindex 4 type managed
modprobe and modinfo
modprobe 应该没有任何输出:
root #
modprobe iwlwifi
Most information about the driver module can be obtained by modinfo iwlwifi:
user $
modinfo iwlwifi
lspci
lspci should display iwlwifi
for both Kernel driver in use:
and Kernel modules:
.
root #
lspci -nnkv | sed -n '/Network/,/^$/p'
03:00.0 Network controller [0280]: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] [8086:0082] (rev 34) Subsystem: Intel Corporation Centrino Advanced-N 6205 AGN [8086:1321] Flags: bus master, fast devsel, latency 0, IRQ 33 Memory at f7d00000 (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 confidential Kernel driver in use: iwlwifi Kernel modules: iwlwifi
The xx:xx.x
identifier will be useful for grepping specific information from dmesg.
dmesg
Check the output of dmesg. Replace 03:00.0
with the identifier from lspci and wlp
with the network interface name.
user $
dmesg | grep -i -E '03:00.0|wlp|iwl|80211'
[ 1.200902] pci 0000:03:00.0: [8086:0082] type 00 class 0x028000 [ 1.201065] pci 0000:03:00.0: reg 0x10: [mem 0xf7d00000-0xf7d01fff 64bit] [ 1.201776] pci 0000:03:00.0: PME# supported from D0 D3hot D3cold [ 1.201999] pci 0000:03:00.0: System wakeup disabled by ACPI [ 18.260461] iwlwifi 0000:03:00.0: enabling device (0100 -> 0102) [ 18.260598] iwlwifi 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control [ 18.419884] iwlwifi 0000:03:00.0: loaded firmware version 18.168.6.1 op_mode iwldvm [ 18.671329] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEBUG enabled [ 18.671330] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEBUGFS enabled [ 18.671330] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEVICE_TRACING disabled [ 18.671332] iwlwifi 0000:03:00.0: Detected Intel(R) Centrino(R) Advanced-N 6205 AGN, REV=0xB0 [ 18.673421] iwlwifi 0000:03:00.0: L1 Enabled - LTR Disabled [ 18.705882] ieee80211 phy0: Selected rate control algorithm 'iwl-agn-rs' [ 18.706468] iwlwifi 0000:03:00.0 wlp3s0: renamed from wlan0 [ 23.286871] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready ......... snip ......... [ 48.176954] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready [ 92.720710] wlp3s0: authenticate with my WLAN AP [ 92.724440] wlp3s0: send auth to my WLAN AP (try 1/3) [ 92.728436] wlp3s0: authenticated [ 92.728646] wlp3s0: waiting for beacon from my WLAN AP [ 92.821389] wlp3s0: associate with my WLAN AP (try 1/3) [ 92.828148] wlp3s0: RX AssocResp from my WLAN AP (capab=0x431 status=0 aid=4) [ 92.853124] wlp3s0: associated [ 92.853173] IPv6: ADDRCONF(NETDEV_CHANGE): wlp3s0: link becomes ready
故障排除
内核未加载
检查是否加载了正确的内核。这可以如下完成(取决于IKCONFIG feature):
user $
zgrep CONFIG_IWL /proc/config.gz
固件问题
- For systems using udev or systemd, it is imperative to configure the kernel to load binary blobs. In this case the wireless card's firmware is the firmware that needs loaded. More information on configuring the kernel in this manner can be found in the following thread on the Gentoo forums: FW_LOADER_USER_HELPER_FALLBACK.
无线网不工作
- Intel Corporation Wireless 8260 (rev 3a) can't access the RSA semaphore it is write protected
Device Drivers --->
[*] PCI support --->
[*] Network device support --->
[*] Message Signaled Interrupts (MSI and MSI-X)
No internet connection
If it is possible to connect to an access point, but not possible to connect to any server or get any connection to the Internet, it may be worth trying to disable 802.11n and/or enable software encryption. To do so, it is necessary to pass the parameter iwlwifi.11n_disable=1
or iwlwifi.11n_disable=8
and/or iwlwifi.swcrypto=1
to the kernel. In order to pass the parameter automatically on module load, the following file should be created:
options iwlwifi 11n_disable=1 swcrypto=1
In newer kernels, inspected as of 5.3.7, setting 11n_disable=1 (or masked with 0x01) will result in 802.11ac being disabled. This will limit the device to a maximum of 54Mbit throughput.
Network crashes under heavy load
On some wireless cards (e.g. Intel® Wi-Fi 6 AX201), under heavy load, the network crashes with a similar error:
root #
dmesg
[ 367.411551] iwlwifi 0000:00:14.3: reached 20 old SN frames from 77:77:77:77:77:77 on queue 2, stopping BA session on TID 3
As a workaround, RX aggregation should be disabled using the kernel parameter iwlwifi.11n_disable=4
:
options iwlwifi 11n_disable=4
"Microcode SW error detected. Restarting 0x0" message in kernel logs
root #
dmesg | grep iwlwifi
(... redacted ...) [ 5711.326985] iwlwifi 0000:28:00.0: Microcode SW error detected. Restarting 0x0. [ 5711.326987] iwlwifi 0000:28:00.0: Start IWL Error Log Dump: [ 5711.326990] iwlwifi 0000:28:00.0: Transport status: 0x0000004A, valid: 6 [ 5711.326992] iwlwifi 0000:28:00.0: Loaded firmware version: 71.058653f6.0 ty-a0-gf-a0-71.ucode [ 5711.326993] iwlwifi 0000:28:00.0: 0x00000071 | NMI_INTERRUPT_UMAC_FATAL [ 5711.326995] iwlwifi 0000:28:00.0: 0x00008210 | trm_hw_status0 [ 5711.326998] iwlwifi 0000:28:00.0: 0x00000000 | trm_hw_status1 [ 5711.327001] iwlwifi 0000:28:00.0: 0x004DAEA2 | branchlink2 [ 5711.327003] iwlwifi 0000:28:00.0: 0x004D9974 | interruptlink1 [ 5711.327004] iwlwifi 0000:28:00.0: 0x004D9974 | interruptlink2 [ 5711.327006] iwlwifi 0000:28:00.0: 0x0000C314 | data1 [ 5711.327008] iwlwifi 0000:28:00.0: 0x00000010 | data2 [ 5711.327009] iwlwifi 0000:28:00.0: 0x00000000 | data3 (... redacted ...) [ 5711.329587] iwlwifi 0000:28:00.0: ieee80211 phy0: Hardware restart was requested
This indicates that a severe error has been encountered by the WiFi adapter's micro-controller which led it to be reset. Consequences might be network drop outs and/and severe slow downs even after the connection to the AP has been restored. The root cause might be difficult to point out (platform own radio noise/buggy firmware/etc) however one of the very first things to try, even if the power management has been disabled for the iwlwifi module, is to prevent the WiFi adapter PCIe link to go in power save mode. This is accomplished by changing the power_scheme
value used by the iwlmvm module to 1 (active):
options iwlmvm power_scheme=1
Amongst additional countermeasures suggested on https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi disabling 40 MHz channels usage on the 2.4GHz band might also help:
options cfg80211 cfg80211_disable_40mhz_24ghz=Y
另请参阅
- Handbook:AMD64/Networking/Wireless
- wifi
- wpa_supplicant — 一个处理网络认证的 wifi 请求者程序(supplicant)。
- Network management using DHCPCD
- netifrc
- Troubleshooting