# 软件

Source: [https://docs.qualcomm.com/doc/80-70017-14SC/topic/Check_WLAN_host_and_SS_platform_driver_source_codes.html](https://docs.qualcomm.com/doc/80-70017-14SC/topic/Check_WLAN_host_and_SS_platform_driver_source_codes.html)

下表列出了 ath11k 驱动程序组件的源代码位置。

Table : 软件组件的源代码位置

| 组件 | 源代码位置 |
| --- | --- |
| mac80211 | net/mac80211 |
| ath11k 驱动程序 | <ul class="ul" id="bvc1569159747557__ul_jt5_z41_mcc_navyanka_08-22-24-1616-29-903"><br>                                <li class="li"><span class="ph filepath">drivers/net/wireless/ath/ath11k</span></li><br><br>                                <li class="li"><a href="https://github.com/torvalds/linux/tree/master/drivers/net/wireless/ath/ath11k" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://github.com/torvalds/linux/tree/master/drivers/net/wireless/ath/ath11k')">https://github.com/torvalds/linux/tree/master/drivers/net/wireless/ath/ath11k</a></li><br><br>                            </ul> |
| wpa\_supplicant | source: SRC\_URI =<br>                                "git://w1.fi/hostap.git;protocol=https;branch=main" |
| Supplicant 配置文件 | sources/mdm-init/upstream |

关于 ath11k 的更多信息，请参阅： 
- ath11k: [https://wireless.docs.kernel.org/en/latest/en/users/drivers/ath11k.html](https://wireless.docs.kernel.org/en/latest/en/users/drivers/ath11k.html)
- mac80211: [https://wireless.wiki.kernel.org/en/developers/documentation/mac80211](https://wireless.wiki.kernel.org/en/developers/documentation/mac80211)
- cfg80211：[https://wireless.wiki.kernel.org/en/developers/documentation/cfg80211](https://wireless.wiki.kernel.org/en/developers/documentation/cfg80211)

## CLD 驱动程序

Source: [https://docs.qualcomm.com/doc/80-70017-14SC/topic/Check_WLAN_host_and_SS_platform_driver_source_codes.html](https://docs.qualcomm.com/doc/80-70017-14SC/topic/Check_WLAN_host_and_SS_platform_driver_source_codes.html)

默认情况下，Qualcomm Linux 针对所有芯片组通过 **ath11k WLAN 驱动程序** 启用 WLAN 功能。但是，在 **RB3 Gen 2** 中，您可以选择使用 **Convergence Linux 驱动程序 (CLD)**，其可提供增值功能，例如 **Wi-Fi Direct 模式** 和 **4K QAM**。

下表列出了带有 CLD 驱动程序的软件组件的源代码位置：

Table : 具有 CLD 驱动程序的软件组件的源代码位置

| 组件 | 源代码位置 |
| --- | --- |
| Wi-Fi 子系统平台驱动程序 (icnss) | sources/wlan/platform/ |
| Qualcomm Wi-Fi host 驱动程序 | <ul class="ul" id="software-cld-driver__ul_ypp_kkc_mcc_navyanka_08-22-24-2217-37-642"><br>                                        <li class="li"><span class="ph filepath">sources/wlan/qcacld-3.0</span></li><br><br>                                        <li class="li"><span class="ph filepath">sources/wlan/qca-wifi-host-cmn</span></li><br><br>                                    </ul> |
| wpa\_supplicant | sources/wlan/wpa\_supplicant\_8 |
| Supplicant 配置文件 | sources/mdm-init/wlan\_qcm6490/ |

要调试与 CLD 驱动程序相关的任何问题，请参见 [CLD 驱动程序的日志](https://docs.qualcomm.com/doc/80-70017-14SC/topic/report_a_w_fi_issue_to_qualcomm.html#debug-cld-driver)。

### 使用 CLD 驱动程序在软件中设置 WLAN MAC 地址

Source: [https://docs.qualcomm.com/doc/80-70017-14SC/topic/Check_WLAN_host_and_SS_platform_driver_source_codes.html](https://docs.qualcomm.com/doc/80-70017-14SC/topic/Check_WLAN_host_and_SS_platform_driver_source_codes.html)

### 关于此任务

请考虑有关 WLAN MAC 地址的以下几点：

- 默认情况下，出厂时将 WLAN MAC 地址写入到网卡的 OTP 内存中。
- 如果需要，您可以按照以下步骤修改 MAC 地址。您设置的 MAC 地址将一直保留到重新启动或下一次重启。它优先于存储在 OTP 内存中的出厂设置的 MAC 地址。
- 如果没有出厂设置的 MAC 地址可用，则软件会在每个启动周期内生成一个随机 MAC 地址。

在开始之前，请确保设备已通过 UART 连接到主机，如[连接到 UART shell](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#connect-to-a-uart-shell) 中所述。

要使用 CLD 驱动程序在软件中设置唯一的 WLAN MAC 地址，请在调试 UART 串行控制台中执行以下步骤：

### 过程

1. 通过运行以下命令允许读/写访问：
                
mount -o rw,remount /Copy to clipboard
2. 通过运行以下命令在 /lib/firmware/wlan/qca\_cld/ 目录中创建 wlan\_mac.bin 文件：
                
cd /lib/firmware/wlan/qca_cld/Copy to clipboard

注释： 没有默认的 wlan\_mac.bin 文件。
3. 使用文本编辑器打开 wlan\_mac.bin 文件。
                
例如，要在 VI 编辑器中打开 wlan\_mac.bin 文件，可运行以下命令：

        vi /lib/firmware/wlan/qca_cld/wlan_mac.binCopy to clipboard
4. 按照以下格式在 wlan\_mac.bin 文件中输入 MAC 地址：
                
Intf0MacAddress=<IP_0>
                            Intf1MacAddress=<IP_1>
                            Intf2MacAddress=<IP_2>
                            Intf3MacAddress=<IP_3>
                            ENDCopy to clipboard

例如，

        Intf0MacAddress=000AF58989FF
                                Intf1MacAddress=000AF58989FE
                                Intf2MacAddress=000AF58989FD
                                Intf3MacAddress=000AF58989FC
                                ENDCopy to clipboard
5. 保存 wlan\_mac.bin 文件。
6. 通过运行以下命令获取 wlan\_mac.bin 文件的读/写/可执行权限：
                
chmod 777 wlan_mac.binCopy to clipboard

**示例输出**

root@qcm6490:/# mount -o rw, remount /
        root@qcm6490:/# cd /lib/firmware/wlan/qca_cld/
        root@qcm6490:/lib/firmware/wlan/qca_cld# vi wlan mac.bin
        root@qcm6490:/lib/firmware/wlan/qca _cld# chmod 777 wlan_mac.bin
        root@qcm6490:/lib/firmware/wlan/qca_cld# cat wlan_mac.bin
        Intf(MacAddress=000AF58989FF
        IntflMacAddress=000AF58989FE
        Intf2MacAddress=000AF58989FD
        Intf3MacAddress=000AF58989FC
        END
        root@qcm6490:/lib/firmware/wlan/qca_cld#Copy to clipboard
7. 在 /lib/firmware/wlan/qca\_cld/WCNSS\_qcom\_cfg.ini 文件中添加 `read_mac_addr_from_mac_file=1` INI 参数。 
            
有关更新 INI 参数的详细信息，参见[使用 CLD 驱动程序在软件中定制 Wi-Fi 参数](https://docs.qualcomm.com/doc/80-70017-14SC/topic/Check_WLAN_host_and_SS_platform_driver_source_codes.html#son1569159700009)。
8. 重新启动设备。

### 使用 CLD 驱动程序在软件中定制 Wi-Fi 参数

Source: [https://docs.qualcomm.com/doc/80-70017-14SC/topic/Check_WLAN_host_and_SS_platform_driver_source_codes.html](https://docs.qualcomm.com/doc/80-70017-14SC/topic/Check_WLAN_host_and_SS_platform_driver_source_codes.html)

### 关于此任务

可以使用 `WCNSS_qcom_cfg.ini` 文件定制具有各种配置的 CLD Wi-Fi host 驱动程序。

Wi-Fi host 驱动程序在初始化期间读取此 INI 文件。

对 INI 文件进行的任何更改只有在设备重新启动后才会生效。Wi-Fi host 驱动程序使用的 INI 文件位于 /lib/firmware/wlan/qca\_cld/WCNSS\_qcom\_cfg.ini 路径中。

要根据要求定制 Wi-Fi 参数，执行以下步骤：
注释： 确保按照[使用 SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/how_to.html#use-ssh) 中提到的步骤启用 SSH。

### 过程

1. 使用以下命令运行 SSH：
        
ssh root@<device_IP_address>Copy to clipboard

例如，如果设备的 IP 地址为 `192.168.1.22`，可运行以下命令：

        ssh root@192.168.1.22Copy to clipboard

        mount -o remount rw /Copy to clipboard

注释： 确保 RB3 Gen 2 设备和对端客户端设备位于 Wi-Fi 通信范围内。
2. 请运行以下命令，以便从设备拉取默认的 `WCNSS_qcom_cfg.ini` 文件：
        
scp -r root@192.168.1.22:/lib/firmware/wlan/qca_cld/WCNSS_qcom_cfg.ini .Copy to clipboard
3. 修改 `WCNSS_qcom_cfg.ini` 文件。
4. 运行以下命令，以便将 `WCNSS_qcom_cfg.ini` 文件推送至设备：
        
scp -r WCNSS_qcom_cfg.ini  root@192.168.1.22:/lib/firmware/wlan/qca_cld
        reboot
        Copy to clipboard
5. 重启设备。 
        
所有 INI 配置的信息均位于 sources/wlan/qcacld-3.0/core/hdd/inc/hdd\_config.h。使用以下配置进行测试：
    - `gDot11Mode=8` 表示仅支持 11ac 模式。
    - `gEnableBmps=0` 禁用信标模式省电 (bmps)。
    - `gEnableDFSChnlScan=0` 以避免扫描 DFS 信道。

### 切换到 CLD 驱动程序

Source: [https://docs.qualcomm.com/doc/80-70017-14SC/topic/Check_WLAN_host_and_SS_platform_driver_source_codes.html](https://docs.qualcomm.com/doc/80-70017-14SC/topic/Check_WLAN_host_and_SS_platform_driver_source_codes.html)

注释： 仅当 Qualcomm RB3 Gen 2 开发套件具有 WCN6750 Wi-Fi 芯片组时，以下步骤才适用。

请使用以下两个补丁，以便从 ath11k 切换至 CLD 驱动程序。

- 应用以下补丁，其源文件位于 sources/wlan/wlan-devicetree：

        diff --git a/qcm6490-wlan-idp.dtsi b/qcm6490-wlan-idp.dtsi
        index 5a50eda..bb15319 100644
        --- a/qcm6490-wlan-idp.dtsi
        +++ b/qcm6490-wlan-idp.dtsi
        @@ -60,7 +60,6 @@
         		qcom,vdd-1.3-rfa-config = <1256000 1500000 0 0 0>;
         		qcom,smem-states = <&wlan_smp2p_out 0>;
         		qcom,smem-state-names = "wlan-smp2p-out";
        -		status = "disabled";
         
         		icnss_cdev_apss: qcom,icnss_cdev1 {
         				#cooling-cells = <2>;
        diff --git a/qcm6490-wlan-rb3.dtsi b/qcm6490-wlan-rb3.dtsi
        index a716fa2..57f5637 100644
        --- a/qcm6490-wlan-rb3.dtsi
        +++ b/qcm6490-wlan-rb3.dtsi
        @@ -60,7 +60,6 @@
         		qcom,vdd-1.3-rfa-config = <1256000 1500000 0 0 0>;
         		qcom,smem-states = <&wlan_smp2p_out 0>;
         		qcom,smem-state-names = "wlan-smp2p-out";
        -		status = "disabled";
         
         		icnss_cdev_apss: qcom,icnss_cdev1 {
         				#cooling-cells = <2>;
        diff --git a/qcm6490-wlan-upstream.dtsi b/qcm6490-wlan-upstream.dtsi
        index b7f219a..7f81991 100644
        --- a/qcm6490-wlan-upstream.dtsi
        +++ b/qcm6490-wlan-upstream.dtsi
        @@ -4,10 +4,5 @@
          */
         &wifi {
                memory-region = <&wlan_fw_mem>, <&wlan_ce_mem>;
        -       status = "okay";
        -};
        -
        -&remoteproc_wpss {
        -       firmware-name = "ath11k/WCN6750/hw1.0/wpss.mdt";
        -       status = "okay";
        +       status = "disabled";
         };
        diff --git a/qcs5430-wlan-rb3.dtsi b/qcs5430-wlan-rb3.dtsi
        index 0dab35c..f50a644 100644
        --- a/qcs5430-wlan-rb3.dtsi
        +++ b/qcs5430-wlan-rb3.dtsi
        @@ -60,7 +60,6 @@
         		qcom,vdd-1.3-rfa-config = <1256000 1500000 0 0 0>;
         		qcom,smem-states = <&wlan_smp2p_out 0>;
         		qcom,smem-state-names = "wlan-smp2p-out";
        -		status = "disabled";
         
         		icnss_cdev_apss: qcom,icnss_cdev1 {
         				#cooling-cells = <2>;
        diff --git a/qcs5430-wlan-upstream.dtsi b/qcs5430-wlan-upstream.dtsi
        index b7f219a..7f81991 100644
        --- a/qcs5430-wlan-upstream.dtsi
        +++ b/qcs5430-wlan-upstream.dtsi
        @@ -4,10 +4,5 @@
          */
         &wifi {
                memory-region = <&wlan_fw_mem>, <&wlan_ce_mem>;
        -       status = "okay";
        -};
        -
        -&remoteproc_wpss {
        -       firmware-name = "ath11k/WCN6750/hw1.0/wpss.mdt";
        -       status = "okay";
        +       status = "disabled";
         };
        Copy to clipboard
- 还原以下补丁，其源文件位于 sources/mdm-init/wlan\_qcm6490

        diff --git a/wlan_qcm6490/wlan b/wlan_qcm6490/wlan
        index 54059ee..d23fdfd 100644
        --- a/wlan_qcm6490/wlan
        +++ b/wlan_qcm6490/wlan
        @@ -32,7 +32,11 @@
        # SPDX-License-Identifier: BSD-3-Clause-Clear
        export MODULE_BASE=/lib/modules/`uname -r`
        -export MODNAME=wlan
        +#To load qcacld driver make MODNAME=wlan
        +#export MODNAME=wlan
        +
        +#MODNAME=ath11k_ahb indicates upstream ath11k driver is being loaded
        +export MODNAME=ath11k_ahb
        export RETRY_LIMIT=20
        HELP="Usage $0 {start | stop | restart} <ap | sta,ap>"
        DUMP_TO_KMSG=/dev/kmsg
        @@ -65,7 +69,6 @@wpa_supplicant -Dnl80211 -iwlan0 -ddd -c /etc/wpa_supplicant.conf -t -f /tmp/wpa_supplicant-log.txt &
        -	dhcpcd wlan0
                 cnt=0
                 while ! [ -d /var/run/wpa_supplicant ]
        @@ -100,8 +103,9 @@
             stop)
                 echo "Stopping WLAN..." > $DUMP_TO_KMSGkillall wpa_supplicant
        -	killall dhcpcd
        -	rmmod $MODNAME
        +        if [ "$MODNAME" = "wlan" ]; then
        +            rmmod $MODNAME
        +        fi
                 ;;
             restart)Copy to clipboard

应用补丁后，请确保按照 [Qualcomm Linux 编译指南](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/introduction.html)中的说明重新编译并刷写整个镜像。

Last Published: Jan 23, 2025

[Previous Topic
架构](https://docs.qualcomm.com/bundle/publicresource/80-70017-14SC/topics/wlan_sw_overview.md) [Next Topic
配置](https://docs.qualcomm.com/bundle/publicresource/80-70017-14SC/topics/Set_up_and_configure_WLAN_connection.md)