“WLAN overview”的版本间的差异
(未显示2个用户的13个中间版本) | |||
第1行: | 第1行: | ||
− | [[ | + | 本文介绍了WLAN框架的组成方式,配置方法以及使用方法。 |
− | + | ||
− | + | == Purpose == | |
− | + | ||
+ | 无线局域网(WLAN)是一种无线计算机网络,它使用无线通信链接两个或多个设备以在有限的区域内形成局域网(LAN),例如家庭,学校,计算机实验室,校园,办公楼等。 这使用户能够在该区域内四处移动,但仍可以连接到网络。通过网关,WLAN还可以提供与更广泛的Internet的连接。<br /> | ||
+ | Linux<sup>®</sup> 无线子系统包含两个主要模块:cfg80211和mac80211,它们帮助WiFi驱动程序与内核的其余部分和用户空间建立接口。 <br /> | ||
+ | 特别是,cfg80211在内核中提供配置管理服务。它还通过nl80211在内核和用户空间之间提供管理接口。 <br /> | ||
+ | 软MAC(soft MAC)设备和完整MAC设备都需要与cfg80211一起使用。 Mac80211是仅支持软件MAC设备的驱动程序API<br /> | ||
+ | |||
+ | WLAN可以在许多不同的用例中使用,如[[#How to use WLAN|How to use WLAN]]部分所述: | ||
+ | * 如何在客户端模式下配置无线接口: [[How to configure a wlan interface on client mode|How to configure a wlan interface on client mode]] | ||
+ | * 如何在热点模式下配置无线接口:[[How to configure a wlan interface on hotspot mode|How to configure a wlan interface on hotspot mode]] | ||
+ | |||
+ | ==System overview== | ||
+ | [[File:wlan_overview.png|thumb|center|766px|link=|alt=Alternate text|WLAN Overview]] | ||
+ | |||
+ | ===Description of the components=== | ||
+ | ''从用户空间到硬件'' | ||
+ | *'''应用''' (用户空间) | ||
+ | 有许多使用WLAN的应用程序:例如Internet浏览器, | ||
+ | 流应用程序,FTP应用程序。 | ||
+ | |||
+ | *'''WLAN工具''' (用户空间) | ||
+ | 有一组实用程序可以管理WLAN网络: [[Network_tools| Network tools]] | ||
+ | |||
+ | *'''CFG80211 API''' (内核空间) | ||
+ | cfg80211<ref>[https://wireless.wiki.kernel.org/en/developers/Documentation/cfg80211], cfg80211</ref> 是Linux中的IEEE 802.11<ref>[https://en.wikipedia.org/wiki/IEEE_802.11], IEEE_802.11</ref> 设备的配置API。<br /> | ||
+ | - 它桥接了用户空间和驱动程序,并提供了与IEEE 802.11相关的某些实用程序功能。<br /> | ||
+ | -Linux中的所有现代无线驱动程序都必须通过mac80211直接或间接地使用它,以便它们通过nl80211提供一致的API<ref> | ||
+ | [https://wireless.wiki.kernel.org/en/developers/Documentation/nl80211], nl80211</ref>.<br /> | ||
+ | - 它与 Netlink<ref>[https://en.wikipedia.org/wiki/Netlink], Netlink</ref> socket 连接。 | ||
+ | |||
+ | *'''MAC80211框架''' (内核空间) | ||
+ | MAC80211是Linux内核的一个子系统,它实现了软MAC/半MAC无线共享代码<ref>[https://wireless.wiki.kernel.org/en/developers/Documentation/mac80211], mac80211</ref> | ||
+ | |||
+ | *'''WLAN配套驱动程序''' (内核空间) | ||
+ | WLAN配套驱动程序注册和控制WLAN设备。 | ||
+ | |||
+ | *'''MMC框架:MMC核心''' (内核空间) | ||
+ | '''MMC内核”'确保与MultiMediaCard('''MMC''')嵌入式<ref>[https://www.jedec.org/standards-documents/technology-focus-areas/flash-memory-ssds-ufs-emmc/e-mmc MultiMediaCard], MultiMediaCard规范安全数字('''SD''')</ref> / <ref>[https://www.sdcard.org/ Secure Digital], </ref> / 安全数字规范安全数字输入/输出('''SDIO ''')<ref>[https://www.sdcard.org/ Secure Digital Input Output], 安全数字输入输出规范</ref>.<br /> | ||
+ | MP1和WLAN设备之间的通信链接是SDIO总线。 | ||
+ | |||
+ | *'''SDMMC驱动程序''' (内核空间) | ||
+ | 有关更多信息,请参阅 [[MMC overview]] | ||
+ | |||
+ | *'''STM32: SDMMC''' (硬件) | ||
+ | 有关更多信息,请参阅 [[MMC overview]] | ||
+ | |||
+ | *'''外部设备''' (硬件) | ||
+ | WLAN配套芯片 | ||
+ | |||
+ | ===APIs description=== | ||
+ | |||
+ | MAC80211是新的无线驱动程序API,它为soft-MAC / half-MAC无线设备实现共享代码<ref>[https://wireless.wiki.kernel.org/en/developers/Documentation/mac80211], mac80211</ref> | ||
+ | |||
+ | cfg80211<ref>[https://wireless.wiki.kernel.org/en/developers/Documentation/cfg80211], cfg80211</ref> 是IEEE 802.11的新驱动程序配置API<ref>[https://en.wikipedia.org/wiki/IEEE_802.11], IEEE_802.11</ref> 在Linux中<br /> | ||
+ | |||
+ | ==Configuration == | ||
+ | 默认情况下,在ST传送中不会激活WLAN API。 要激活它,可以使用Linux Menuconfig工具: [[Menuconfig or how to configure kernel | Menuconfig or how to configure kernel ]] 然后选择: | ||
+ | |||
+ | 对于网络功能: | ||
+ | <pre> | ||
+ | [*] Networking support ---> | ||
+ | [*] Networking options ---> | ||
+ | [*] Packet socket | ||
+ | [*] TCP/IP networking | ||
+ | [*] IP: kernel level autoconfiguration | ||
+ | [*] IP: DHCP support | ||
+ | [*] IP: BOOTP support | ||
+ | [*] IP: RARP support | ||
+ | [*] INET: socket monitoring interface | ||
+ | [*] The IPv6 protocol | ||
+ | [*] DNS Resolver support | ||
+ | [*] Wireless ---> | ||
+ | [*] cfg80211 - wireless configuration API | ||
+ | [*] cfg80211 wireless extensions compatibility | ||
+ | [*] Generic IEEE 802.11 Networking Stack (mac80211) | ||
+ | </pre> | ||
+ | |||
+ | 例如,如果配套芯片是Murata芯片1DX<ref>[http://wireless.murata.com/datasheet?/RFM/data/lbee5kl1dx.pdf], 1DX</ref> | ||
+ | <pre> | ||
+ | [*] Device Drivers ---> | ||
+ | [*] Network device support ---> | ||
+ | [*] Wireless LAN ---> | ||
+ | [*] Broadcom devices | ||
+ | [*] Broadcom FullMAC WLAN driver | ||
+ | </pre> | ||
+ | |||
+ | 对于STM32 SDMMC: | ||
+ | 请参阅[[MMC_overview#Kernel_configuration | SDMMC configuration]] | ||
+ | |||
+ | ===Device tree=== | ||
+ | DT绑定文档处理所有必需的或可选的 [[Device tree|device tree]] 属性。 | ||
+ | |||
+ | STM32外设的详细DT配置: [[WLAN device tree configuration|WLAN device tree configuration]]. | ||
+ | |||
+ | == How to use WLAN == | ||
+ | |||
+ | === How to use the WLAN user space interface === | ||
+ | 请根据以下用例查看示例: | ||
+ | * 如何设置wifi连接: [[How_to_setup_wifi_connection|How to setup wifi connection]] | ||
+ | * 如何在客户端模式下配置无线接口: [[How to configure a wlan interface on client mode|How to configure a wlan interface on client mode]] | ||
+ | * 如何在热点模式下配置无线接口: [[How to configure a wlan interface on hotspot mode|How to configure a wlan interface on hotspot mode]] | ||
+ | |||
+ | ==How to trace and debug the framework== | ||
+ | === How to monitor === | ||
+ | 请给出说明以帮助开发人员/用户在Linux文件系统中获取有关此框架的信息。 | ||
+ | ==== How to watch link quality ==== | ||
+ | Proc文件系统提供有关Quality链接的信息: | ||
+ | {{Board$}} cat /proc/net/wireless | ||
+ | Inter-| sta-| Quality | Discarded packets | Missed | WE | ||
+ | face | tus | link level noise | nwid crypt frag retry misc | beacon | 22 | ||
+ | wlan0: 0000 0 0 0 0 0 0 0 0 0 | ||
+ | |||
+ | STAT示例: | ||
+ | {{Board$}} watch -d -n 3 "iw dev wlan0 station dump; iwconfig wlan0; cat /proc/net/wireless" | ||
+ | |||
+ | Every 3.0s: iw dev wlan0 station dump; iwconfig wlan0; cat /proc/net/wir... stm32mp1: Sun Nov 4 16:32:52 2018 | ||
+ | |||
+ | Station 00:16:b6:2c:47:36 (on wlan0) | ||
+ | inactive time: 0 ms | ||
+ | rx bytes: 11001 | ||
+ | rx packets: 37 | ||
+ | tx bytes: 13077 | ||
+ | tx packets: 83 | ||
+ | tx failed: 0 | ||
+ | signal: -72 [-72] dBm | ||
+ | tx bitrate: 12.0 MBit/s | ||
+ | rx bitrate: 1.0 MBit/s | ||
+ | authorized: yes | ||
+ | authenticated: yes | ||
+ | associated: yes | ||
+ | WMM/WME: no | ||
+ | TDLS peer: yes | ||
+ | DTIM period: 1 | ||
+ | beacon interval:100 | ||
+ | short preamble: yes | ||
+ | short slot time:yes | ||
+ | connected time: 55 seconds | ||
+ | wlan0 IEEE 802.11 ESSID:"NETWORK1" | ||
+ | Mode:Managed Frequency:2.462 GHz Access Point: 00:16:B6:2C:47:36 | ||
+ | Bit Rate=12 Mb/s Tx-Power=31 dBm | ||
+ | Retry short limit:7 RTS thr:off Fragment thr:off | ||
+ | Encryption key:off | ||
+ | Power Management:on | ||
+ | Link Quality=38/70 Signal level=-72 dBm | ||
+ | Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 | ||
+ | Tx excessive retries:0 Invalid misc:0 Missed beacon:0 | ||
+ | |||
+ | Inter-| sta-| Quality | Discarded packets | Missed | WE | ||
+ | face | tus | link level noise | nwid crypt frag retry misc | beacon | 22 | ||
+ | wlan0: 0000 38. -72. -256 0 0 0 0 0 0 | ||
+ | |||
+ | === How to trace === | ||
+ | |||
+ | 本部分以村田芯片(Murata chip)为配套芯片为例 | ||
+ | |||
+ | ==== How to verify than the WLAN driver is well probed ==== | ||
+ | * 在dmesg日志中,检查“ brcmfmac”日志 : | ||
+ | <pre> | ||
+ | [ 67.306154] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Aug 6 2017 23:19:25 version 7.45.98.30 (r666241 CY) FWID 01-f0b000 | ||
+ | [ 67.326146] brcmfmac: brcmf_c_preinit_dcmds: CLM version = API: 12.2 Data: 7.11.15 Compiler: 1.24.2 ClmImport: 1.24.1 Creation: 2014-05 | ||
+ | [ 67.676323] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code (0x30 0x30) | ||
+ | </pre> | ||
+ | |||
+ | ==== How to debug the WLAN driver ==== | ||
+ | |||
+ | ===== Add dynamic debug firmware traces ===== | ||
+ | |||
+ | 需要在内核配置中激活:CONFIG_DYNAMIC_DEBUG,有关动态调试的更多信息请参阅 [[How_to_use_the_kernel_dynamic_debug]] | ||
+ | |||
+ | # cd /sys/kernel/debug/dynamic_debug/ | ||
+ | |||
+ | 检查用于管理固件的所有功能: | ||
+ | |||
+ | <pre> | ||
+ | # cat control | grep firmware | ||
+ | drivers/base/firmware_class.c:339 [firmware_class]__fw_free_buf =_ "%s: fw-%s buf=%p data=%p size=%u\012" | ||
+ | drivers/base/firmware_class.c:462 [firmware_class]fw_set_page_data =_ "%s: fw-%s buf=%p data=%p size=%u\012" | ||
+ | drivers/base/firmware_class.c:1102 [firmware_class]_request_firmware_prepare =_ "using built-in %s\012" | ||
+ | drivers/base/firmware_class.c:290 [firmware_class]__allocate_fw_buf =_ "%s: fw-%s buf=%p\012" | ||
+ | drivers/base/firmware_class.c:1194 [firmware_class]_request_firmware =_ "firmware: %s loading timed out\012" | ||
+ | drivers/base/firmware_class.c:423 [firmware_class]fw_get_filesystem_firmware =_ "loading %s failed with error %d\012" | ||
+ | drivers/base/firmware_class.c:429 [firmware_class]fw_get_filesystem_firmware =_ "direct-loading %s\012" | ||
+ | </pre> | ||
+ | |||
+ | 在所有固件功能中添加打印信息“ + p”(p:导致将printk()消息发送到dmesg) | ||
+ | # echo "file drivers/base/firmware_class.c +p" > control | ||
+ | |||
+ | 现在,在所有固件功能中都添加了“ p”选项。 | ||
+ | |||
+ | <pre> | ||
+ | # cat control | grep firmware | ||
+ | drivers/base/firmware_class.c:339 [firmware_class]__fw_free_buf =p "%s: fw-%s buf=%p data=%p size=%u\012" | ||
+ | drivers/base/firmware_class.c:462 [firmware_class]fw_set_page_data =p "%s: fw-%s buf=%p data=%p size=%u\012" | ||
+ | drivers/base/firmware_class.c:1102 [firmware_class]_request_firmware_prepare =p "using built-in %s\012" | ||
+ | drivers/base/firmware_class.c:290 [firmware_class]__allocate_fw_buf =p "%s: fw-%s buf=%p\012" | ||
+ | drivers/base/firmware_class.c:1194 [firmware_class]_request_firmware =p "firmware: %s loading timed out\012" | ||
+ | drivers/base/firmware_class.c:423 [firmware_class]fw_get_filesystem_firmware =p "loading %s failed with error %d\012" | ||
+ | drivers/base/firmware_class.c:429 [firmware_class]fw_get_filesystem_firmware =p "direct-loading %s\012" | ||
+ | </pre> | ||
+ | |||
+ | ===== FMAC debug ===== | ||
+ | |||
+ | ====== Enable debug features in the defconfig file ====== | ||
+ | |||
+ | * 启用CPTCFG_BRCMDBG和CONFIG_DEBUG_FS | ||
+ | * 重新构建内核 | ||
+ | |||
+ | ====== Enable brcmfmac debug log ====== | ||
+ | |||
+ | * 消息级别在' '''drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h'''中列出 | ||
+ | <pre> | ||
+ | /* message levels */ | ||
+ | #define BRCMF_TRACE_VAL 0x00000002 | ||
+ | #define BRCMF_INFO_VAL 0x00000004 | ||
+ | #define BRCMF_DATA_VAL 0x00000008 | ||
+ | #define BRCMF_CTL_VAL 0x00000010 | ||
+ | #define BRCMF_TIMER_VAL 0x00000020 | ||
+ | #define BRCMF_HDRS_VAL 0x00000040 | ||
+ | #define BRCMF_BYTES_VAL 0x00000080 | ||
+ | #define BRCMF_INTR_VAL 0x00000100 | ||
+ | #define BRCMF_GLOM_VAL 0x00000200 | ||
+ | #define BRCMF_EVENT_VAL 0x00000400 | ||
+ | #define BRCMF_BTA_VAL 0x00000800 | ||
+ | #define BRCMF_FIL_VAL 0x00001000 | ||
+ | #define BRCMF_USB_VAL 0x00002000 | ||
+ | #define BRCMF_SCAN_VAL 0x00004000 | ||
+ | #define BRCMF_CONN_VAL 0x00008000 | ||
+ | #define BRCMF_BCDC_VAL 0x00010000 | ||
+ | #define BRCMF_SDIO_VAL 0x00020000 | ||
+ | #define BRCMF_MSGBUF_VAL 0x00040000 | ||
+ | #define BRCMF_PCIE_VAL 0x00080000 | ||
+ | #define BRCMF_FWCON_VAL 0x00100000 | ||
+ | </pre> | ||
+ | |||
+ | $ modprobe brcmfmac debug=${BRCMF_Message_Level} | ||
+ | $ dmesg -n 8 | ||
+ | |||
+ | ====== Examples ====== | ||
+ | * 添加TRACE和INFO | ||
+ | $ modprobe brcmfmac debug=0x6 | ||
+ | |||
+ | * 添加TRACE,INFO和SDIO | ||
+ | $ modprobe brcmfmac debug=0x20006 | ||
+ | |||
+ | * 添加TRACE,INFO和WIFI_FW_LOG | ||
+ | $ modprobe brcmfmac debug=0x00100006 | ||
+ | |||
+ | ====== How to check wlreg_on status and voltage setting ====== | ||
+ | $ cat /sys/kernel/debug/regulator/regulator_summary | ||
+ | |||
+ | ==Source code location== | ||
+ | |||
+ | 源文件位于Linux内核中。 | ||
+ | |||
+ | *'''Broadcom WLAN驱动程序''': of.c<ref>[https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | ||
+ | ],of.c</ref> | ||
+ | |||
+ | ==References== | ||
+ | <noinclude><references /></noinclude> |
2020年11月6日 (五) 09:59的最新版本
本文介绍了WLAN框架的组成方式,配置方法以及使用方法。
目录
Purpose
无线局域网(WLAN)是一种无线计算机网络,它使用无线通信链接两个或多个设备以在有限的区域内形成局域网(LAN),例如家庭,学校,计算机实验室,校园,办公楼等。 这使用户能够在该区域内四处移动,但仍可以连接到网络。通过网关,WLAN还可以提供与更广泛的Internet的连接。
Linux® 无线子系统包含两个主要模块:cfg80211和mac80211,它们帮助WiFi驱动程序与内核的其余部分和用户空间建立接口。
特别是,cfg80211在内核中提供配置管理服务。它还通过nl80211在内核和用户空间之间提供管理接口。
软MAC(soft MAC)设备和完整MAC设备都需要与cfg80211一起使用。 Mac80211是仅支持软件MAC设备的驱动程序API
WLAN可以在许多不同的用例中使用,如How to use WLAN部分所述:
- 如何在客户端模式下配置无线接口: How to configure a wlan interface on client mode
- 如何在热点模式下配置无线接口:如何将无线网卡配置为热点模式
System overview
Description of the components
从用户空间到硬件
- 应用 (用户空间)
有许多使用WLAN的应用程序:例如Internet浏览器, 流应用程序,FTP应用程序。
- WLAN工具 (用户空间)
有一组实用程序可以管理WLAN网络: Network tools
- CFG80211 API (内核空间)
cfg80211[1] 是Linux中的IEEE 802.11[2] 设备的配置API。
- 它桥接了用户空间和驱动程序,并提供了与IEEE 802.11相关的某些实用程序功能。
-Linux中的所有现代无线驱动程序都必须通过mac80211直接或间接地使用它,以便它们通过nl80211提供一致的API[3].
- 它与 Netlink[4] socket 连接。
- MAC80211框架 (内核空间)
MAC80211是Linux内核的一个子系统,它实现了软MAC/半MAC无线共享代码[5]
- WLAN配套驱动程序 (内核空间)
WLAN配套驱动程序注册和控制WLAN设备。
- MMC框架:MMC核心 (内核空间)
MMC内核”'确保与MultiMediaCard(MMC)嵌入式[6] / [7] / 安全数字规范安全数字输入/输出(SDIO )[8].
MP1和WLAN设备之间的通信链接是SDIO总线。
- SDMMC驱动程序 (内核空间)
有关更多信息,请参阅 MMC overview
- STM32: SDMMC (硬件)
有关更多信息,请参阅 MMC overview
- 外部设备 (硬件)
WLAN配套芯片
Configuration
默认情况下,在ST传送中不会激活WLAN API。 要激活它,可以使用Linux Menuconfig工具: Menuconfig or how to configure kernel 然后选择:
对于网络功能:
[*] Networking support ---> [*] Networking options ---> [*] Packet socket [*] TCP/IP networking [*] IP: kernel level autoconfiguration [*] IP: DHCP support [*] IP: BOOTP support [*] IP: RARP support [*] INET: socket monitoring interface [*] The IPv6 protocol [*] DNS Resolver support [*] Wireless ---> [*] cfg80211 - wireless configuration API [*] cfg80211 wireless extensions compatibility [*] Generic IEEE 802.11 Networking Stack (mac80211)
例如,如果配套芯片是Murata芯片1DX[12]
[*] Device Drivers ---> [*] Network device support ---> [*] Wireless LAN ---> [*] Broadcom devices [*] Broadcom FullMAC WLAN driver
对于STM32 SDMMC: 请参阅 SDMMC configuration
How to use WLAN
How to use the WLAN user space interface
请根据以下用例查看示例:
- 如何设置wifi连接: 如何设置WiFi连接
- 如何在客户端模式下配置无线接口: How to configure a wlan interface on client mode
- 如何在热点模式下配置无线接口: 如何将无线网卡配置为热点模式
How to trace and debug the framework
How to monitor
请给出说明以帮助开发人员/用户在Linux文件系统中获取有关此框架的信息。
How to watch link quality
Proc文件系统提供有关Quality链接的信息:
Board $> cat /proc/net/wireless Inter-| sta-| Quality | Discarded packets | Missed | WE face | tus | link level noise | nwid crypt frag retry misc | beacon | 22 wlan0: 0000 0 0 0 0 0 0 0 0 0
STAT示例:
Board $> watch -d -n 3 "iw dev wlan0 station dump; iwconfig wlan0; cat /proc/net/wireless"
Every 3.0s: iw dev wlan0 station dump; iwconfig wlan0; cat /proc/net/wir... stm32mp1: Sun Nov 4 16:32:52 2018 Station 00:16:b6:2c:47:36 (on wlan0) inactive time: 0 ms rx bytes: 11001 rx packets: 37 tx bytes: 13077 tx packets: 83 tx failed: 0 signal: -72 [-72] dBm tx bitrate: 12.0 MBit/s rx bitrate: 1.0 MBit/s authorized: yes authenticated: yes associated: yes WMM/WME: no TDLS peer: yes DTIM period: 1 beacon interval:100 short preamble: yes short slot time:yes connected time: 55 seconds wlan0 IEEE 802.11 ESSID:"NETWORK1" Mode:Managed Frequency:2.462 GHz Access Point: 00:16:B6:2C:47:36 Bit Rate=12 Mb/s Tx-Power=31 dBm Retry short limit:7 RTS thr:off Fragment thr:off Encryption key:off Power Management:on Link Quality=38/70 Signal level=-72 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0 Inter-| sta-| Quality | Discarded packets | Missed | WE face | tus | link level noise | nwid crypt frag retry misc | beacon | 22 wlan0: 0000 38. -72. -256 0 0 0 0 0 0
How to trace
本部分以村田芯片(Murata chip)为配套芯片为例
How to verify than the WLAN driver is well probed
- 在dmesg日志中,检查“ brcmfmac”日志 :
[ 67.306154] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Aug 6 2017 23:19:25 version 7.45.98.30 (r666241 CY) FWID 01-f0b000 [ 67.326146] brcmfmac: brcmf_c_preinit_dcmds: CLM version = API: 12.2 Data: 7.11.15 Compiler: 1.24.2 ClmImport: 1.24.1 Creation: 2014-05 [ 67.676323] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code (0x30 0x30)
How to debug the WLAN driver
Add dynamic debug firmware traces
需要在内核配置中激活:CONFIG_DYNAMIC_DEBUG,有关动态调试的更多信息请参阅 How_to_use_the_kernel_dynamic_debug
# cd /sys/kernel/debug/dynamic_debug/
检查用于管理固件的所有功能:
# cat control | grep firmware drivers/base/firmware_class.c:339 [firmware_class]__fw_free_buf =_ "%s: fw-%s buf=%p data=%p size=%u\012" drivers/base/firmware_class.c:462 [firmware_class]fw_set_page_data =_ "%s: fw-%s buf=%p data=%p size=%u\012" drivers/base/firmware_class.c:1102 [firmware_class]_request_firmware_prepare =_ "using built-in %s\012" drivers/base/firmware_class.c:290 [firmware_class]__allocate_fw_buf =_ "%s: fw-%s buf=%p\012" drivers/base/firmware_class.c:1194 [firmware_class]_request_firmware =_ "firmware: %s loading timed out\012" drivers/base/firmware_class.c:423 [firmware_class]fw_get_filesystem_firmware =_ "loading %s failed with error %d\012" drivers/base/firmware_class.c:429 [firmware_class]fw_get_filesystem_firmware =_ "direct-loading %s\012"
在所有固件功能中添加打印信息“ + p”(p:导致将printk()消息发送到dmesg)
# echo "file drivers/base/firmware_class.c +p" > control
现在,在所有固件功能中都添加了“ p”选项。
# cat control | grep firmware drivers/base/firmware_class.c:339 [firmware_class]__fw_free_buf =p "%s: fw-%s buf=%p data=%p size=%u\012" drivers/base/firmware_class.c:462 [firmware_class]fw_set_page_data =p "%s: fw-%s buf=%p data=%p size=%u\012" drivers/base/firmware_class.c:1102 [firmware_class]_request_firmware_prepare =p "using built-in %s\012" drivers/base/firmware_class.c:290 [firmware_class]__allocate_fw_buf =p "%s: fw-%s buf=%p\012" drivers/base/firmware_class.c:1194 [firmware_class]_request_firmware =p "firmware: %s loading timed out\012" drivers/base/firmware_class.c:423 [firmware_class]fw_get_filesystem_firmware =p "loading %s failed with error %d\012" drivers/base/firmware_class.c:429 [firmware_class]fw_get_filesystem_firmware =p "direct-loading %s\012"
FMAC debug
Enable debug features in the defconfig file
- 启用CPTCFG_BRCMDBG和CONFIG_DEBUG_FS
- 重新构建内核
Enable brcmfmac debug log
- 消息级别在' drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h中列出
/* message levels */ #define BRCMF_TRACE_VAL 0x00000002 #define BRCMF_INFO_VAL 0x00000004 #define BRCMF_DATA_VAL 0x00000008 #define BRCMF_CTL_VAL 0x00000010 #define BRCMF_TIMER_VAL 0x00000020 #define BRCMF_HDRS_VAL 0x00000040 #define BRCMF_BYTES_VAL 0x00000080 #define BRCMF_INTR_VAL 0x00000100 #define BRCMF_GLOM_VAL 0x00000200 #define BRCMF_EVENT_VAL 0x00000400 #define BRCMF_BTA_VAL 0x00000800 #define BRCMF_FIL_VAL 0x00001000 #define BRCMF_USB_VAL 0x00002000 #define BRCMF_SCAN_VAL 0x00004000 #define BRCMF_CONN_VAL 0x00008000 #define BRCMF_BCDC_VAL 0x00010000 #define BRCMF_SDIO_VAL 0x00020000 #define BRCMF_MSGBUF_VAL 0x00040000 #define BRCMF_PCIE_VAL 0x00080000 #define BRCMF_FWCON_VAL 0x00100000
$ modprobe brcmfmac debug=${BRCMF_Message_Level} $ dmesg -n 8
Examples
- 添加TRACE和INFO
$ modprobe brcmfmac debug=0x6
- 添加TRACE,INFO和SDIO
$ modprobe brcmfmac debug=0x20006
- 添加TRACE,INFO和WIFI_FW_LOG
$ modprobe brcmfmac debug=0x00100006
How to check wlreg_on status and voltage setting
$ cat /sys/kernel/debug/regulator/regulator_summary
References
- ↑ [1], cfg80211
- ↑ [2], IEEE_802.11
- ↑ [3], nl80211
- ↑ [4], Netlink
- ↑ [5], mac80211
- ↑ MultiMediaCard, MultiMediaCard规范安全数字(SD)
- ↑ Secure Digital,
- ↑ Secure Digital Input Output, 安全数字输入输出规范
- ↑ [6], mac80211
- ↑ [7], cfg80211
- ↑ [8], IEEE_802.11
- ↑ [9], 1DX
- ↑ [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c ],of.c