ath11k: add read variant from SMBIOS for download board data
PATCH 1/1 ath11k: add read variant from SMBIOS for download board data
This is to read variant from SMBIOS such as read from DT, the variant string will be used to one part of string which used to search board data from board-2.bin.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/core.c | 74 ++++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/core.h | 11 ++++ drivers/net/wireless/ath/ath11k/qmi.c | 4 ++ 3 files changed, 89 insertions(+)
drivers/net/wireless/ath/ath11k/core.c +74 -0
@@ -8,6 +8,9 @@#include <linux/remoteproc.h> #include <linux/firmware.h> #include <linux/of.h> +#include <linux/dmi.h> +#include <linux/ctype.h> +#include "core.h" #include "dp_tx.h" #include "dp_rx.h"
@@ -372,6 +375,77 @@ int ath11k_core_resume(struct ath11k_base *ab) }EXPORT_SYMBOL (ath11k_core_resume); +static void ath11k_core_check_bdfext (const struct dmi_header *hdr,void *data) +{ +struct ath11k_base *ab = data; +const char *bdf_ext; +const char *magic =ATH11K_SMBIOS_BDF_EXT_MAGIC ; +u8 bdf_enabled; +int i; +size_t len; + +if (ab->qmi.target.bdf_ext[0 ] !='\0' ) +return ; + +if (hdr->type !=ATH11K_SMBIOS_BDF_EXT_TYPE ) +return ; + +if (hdr->length !=ATH11K_SMBIOS_BDF_EXT_LENGTH ) { +ath11k_dbg (ab,ATH11K_DBG_BOOT , +"wrong smbios bdf ext type length (%d).\n" , + hdr->length); +return ; + } + + bdf_enabled = *((u8 *)hdr +ATH11K_SMBIOS_BDF_EXT_OFFSET ); +if (!bdf_enabled) { +ath11k_dbg (ab,ATH11K_DBG_BOOT ,"bdf variant name not found.\n" ); +return ; + } + +/* Only one string exists (per spec) */ + bdf_ext = (char *)hdr + hdr->length; + +if (memcmp (bdf_ext, magic,strlen (magic)) !=0 ) { +ath11k_dbg (ab,ATH11K_DBG_BOOT , +"bdf variant magic does not match.\n" ); +return ; + } + + len =strlen (bdf_ext); +for (i =0 ; i < len; i++) { +if (!isascii (bdf_ext[i]) || !isprint (bdf_ext[i])) { +ath11k_dbg (ab,ATH11K_DBG_BOOT , +"bdf variant name contains non ascii chars.\n" ); +return ; + } + } + +/* Copy extension name without magic prefix */ +if (strscpy (ab->qmi.target.bdf_ext, bdf_ext +strlen (magic), +sizeof (ab->qmi.target.bdf_ext)) <0 ) { +ath11k_dbg (ab,ATH11K_DBG_BOOT , +"bdf variant string is longer than the buffer can accommodate (variant: %s)\n" , + bdf_ext); +return ; + } + +ath11k_dbg (ab,ATH11K_DBG_BOOT , +"found and validated bdf variant smbios_type 0x%x bdf %s\n" , +ATH11K_SMBIOS_BDF_EXT_TYPE , bdf_ext); +} + +int ath11k_core_check_smbios (struct ath11k_base *ab) +{ + ab->qmi.target.bdf_ext[0 ] ='\0' ; +dmi_walk (ath11k_core_check_bdfext, ab); + +if (ab->qmi.target.bdf_ext[0 ] =='\0' ) +return -ENODATA ; + +return 0 ; +} +int ath11k_core_check_dt (struct ath11k_base *ab) {size_t max_len =sizeof (ab->qmi.target.bdf_ext);
drivers/net/wireless/ath/ath11k/core.h +11 -0
@@ -1044,7 +1044,18 @@ int ath11k_core_fetch_board_data_api_1(struct ath11k_base *ab, char *name);void ath11k_core_free_bdf (struct ath11k_base *ab,struct ath11k_board_data *bd);int ath11k_core_check_dt (struct ath11k_base *ath11k); +/* SMBIOS type containing Board Data File Name Extension */ +#define ATH11K_SMBIOS_BDF_EXT_TYPE 0xF8 +/* SMBIOS type structure length (excluding strings-set) */ +#define ATH11K_SMBIOS_BDF_EXT_LENGTH 0x9 + +/* Offset pointing to Board Data File Name Extension */ +#define ATH11K_SMBIOS_BDF_EXT_OFFSET 0x8 + +/* The magic used by QCA spec */ +#define ATH11K_SMBIOS_BDF_EXT_MAGIC "BDF_" +int ath11k_core_check_smbios (struct ath11k_base *ab);void ath11k_core_halt (struct ath11k *ar);int ath11k_core_resume (struct ath11k_base *ab);int ath11k_core_suspend (struct ath11k_base *ab);
drivers/net/wireless/ath/ath11k/qmi.c +4 -0
@@ -2089,6 +2089,10 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab) ab->qmi.target.fw_build_timestamp, ab->qmi.target.fw_build_id); + r =ath11k_core_check_smbios (ab); +if (r) +ath11k_dbg (ab,ATH11K_DBG_QMI ,"SMBIOS bdf variant name not set.\n" ); + r =ath11k_core_check_dt (ab);if (r)ath11k_dbg (ab,ATH11K_DBG_QMI ,"DT bdf variant name not set.\n" );
Signature · 1 line
2.31.1
Quoted 7 lines · Wen Gong
This is to read variant from SMBIOS such as read from DT, the variant string will be used to one part of string which used to search board data from board-2.bin.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
Signed-off-by Wen Gong <[email protected]>
I'm dropping all patches listed below in one go. I didn't manage to apply any of these without conflicts, please remember to always use ath.git master branch as the baseline to avoid conflicts.
9 patches set to Changes Requested.
12549401 ath11k: add read variant from SMBIOS for download board data 12549415 ath11k: add wait operation for tx management packets for flush from mac80211 12549419 ath11k: change to treat alpha code na as world wide regdomain 12549431 ath11k: report rssi of each chain to mac80211
12549433 ath11k: Add signal report to mac80211 for QCA6390 and WCN6855 12549449 ath11k: report tx bitrate for iw wlan station dump
12554953 ath11k: add support for hardware rfkill for QCA6390
12583807 ath11k: add 11d scan offload support
12583809 ath11k: calculate the correct NSS of peer for HE capabilities
Signature · 9 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Quoted 16 lines · Kalle Valo
Quoted 7 lines · Wen Gong
This is to read variant from SMBIOS such as read from DT, the variant string will be used to one part of string which used to search board data from board-2.bin.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
Signed-off-by Wen Gong <[email protected]>I'm dropping all patches listed below in one go. I didn't manage to apply any of these without conflicts, please remember to always use ath.git master branch as the baseline to avoid conflicts.
9 patches set to Changes Requested.
Quoted 10 lines
12549401 ath11k: add read variant from SMBIOS for download board data 12549415 ath11k: add wait operation for tx management packets for flush from mac80211
12549419 ath11k: change to treat alpha code na as world wide regdomain 12549431 ath11k: report rssi of each chain to mac80211 12549433 ath11k: Add signal report to mac80211 for QCA6390 and WCN6855 12549449 ath11k: report tx bitrate for iw wlan station dump 12554953 ath11k: add support for hardware rfkill for QCA6390 12583807 ath11k: add 11d scan offload support
12583809 ath11k: calculate the correct NSS of peer for HE capabilities
I have rebased to latest ath.git master ath-202111170737 and resend v2 for below patches:
[v2] ath11k: report rssi of each chain to mac80211
[v2,0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855
[v2] ath11k: add read variant from SMBIOS for download board data
[v2] ath11k: skip sending vdev down for channel switch
[v2] ath11k: fix read fail for htt_stats and htt_peer_stats for single pdev [v2] ath11k: calculate the correct NSS of peer for HE capabilities
[v2] ath11k: add wait operation for tx management packets for flush from mac80211 [v2] ath11k: change to treat alpha code na as world wide regdomain
I will rebase the left patches after these patches upstream, otherwise the left patches will have conflict with these patches because they change same location but actually have no logic relation.
Quoted 40 lines · Wen Gong
Quoted 16 lines · Kalle Valo
Quoted 7 lines · Wen Gong
This is to read variant from SMBIOS such as read from DT, the variant string will be used to one part of string which used to search board data from board-2.bin.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
Signed-off-by Wen Gong <[email protected]>I'm dropping all patches listed below in one go. I didn't manage to apply any of these without conflicts, please remember to always use ath.git master branch as the baseline to avoid conflicts.
9 patches set to Changes Requested.
Quoted 10 lines
12549401 ath11k: add read variant from SMBIOS for download board data 12549415 ath11k: add wait operation for tx management packets for flush from mac80211
12549419 ath11k: change to treat alpha code na as world wide regdomain 12549431 ath11k: report rssi of each chain to mac80211 12549433 ath11k: Add signal report to mac80211 for QCA6390 and WCN6855 12549449 ath11k: report tx bitrate for iw wlan station dump 12554953 ath11k: add support for hardware rfkill for QCA6390 12583807 ath11k: add 11d scan offload support
12583809 ath11k: calculate the correct NSS of peer for HE capabilitiesI have rebased to latest ath.git master ath-202111170737 and resend v2 for below patches:
[v2] ath11k: report rssi of each chain to mac80211
[v2,0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855 [v2] ath11k: add read variant from SMBIOS for download board data [v2] ath11k: skip sending vdev down for channel switch
[v2] ath11k: fix read fail forhtt_statsandhtt_peer_statsfor single pdev [v2] ath11k: calculate the correct NSS of peer for HE capabilities [v2] ath11k: add wait operation for tx management packets for flush from mac80211
[v2] ath11k: change to treat alpha code na as world wide regdomain
Quoted 3 lines
I will rebase the left patches after these patches upstream, otherwise the left patches will have conflict with these patches because they change same location but actually have no logic relation.
Hi Kalle,
I have tested in my local git, all the above v2 patches only have one conflict between "[v2,2/2] ath11k: add 11d scan offload support"
and "[v2] ath11k: report rssi of each chain to mac80211"
in wmi_tlv_policies of wmi.c because they both add a item in the struct. patch -p1 -i xxx.patch will auto fix this type conflict.
+ [WMI_TAG_11D_NEW_COUNTRY_EVENT] = {
+ .min_len = sizeof(struct wmi_11d_new_cc_ev) },
+ [WMI_TAG_PER_CHAIN_RSSI_STATS] = {
+ .min_len = sizeof(struct wmi_per_chain_rssi_stats) },
Quoted 56 lines · Wen Gong
Quoted 42 lines · Wen Gong
Quoted 17 lines · Kalle Valo
Quoted 8 lines · Wen Gong
This is to read variant from SMBIOS such as read from DT, the variant string will be used to one part of string which used to search board data from board-2.bin.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
Signed-off-by Wen Gong <[email protected]>I'm dropping all patches listed below in one go. I didn't manage to apply any of these without conflicts, please remember to always use ath.git master branch as the baseline to avoid conflicts.
9 patches set to Changes Requested.
Quoted 10 lines
12549401 ath11k: add read variant from SMBIOS for download board data 12549415 ath11k: add wait operation for tx management packets for flush from mac80211
12549419 ath11k: change to treat alpha code na as world wide regdomain 12549431 ath11k: report rssi of each chain to mac80211 12549433 ath11k: Add signal report to mac80211 for QCA6390 and WCN6855 12549449 ath11k: report tx bitrate for iw wlan station dump 12554953 ath11k: add support for hardware rfkill for QCA6390 12583807 ath11k: add 11d scan offload support
12583809 ath11k: calculate the correct NSS of peer for HE capabilitiesI have rebased to latest ath.git master ath-202111170737 and resend v2 for below patches:
[v2] ath11k: report rssi of each chain to mac80211
[v2,0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855 [v2] ath11k: add read variant from SMBIOS for download board data [v2] ath11k: skip sending vdev down for channel switch
[v2] ath11k: fix read fail forhtt_statsandhtt_peer_statsfor single pdev
[v2] ath11k: calculate the correct NSS of peer for HE capabilities [v2] ath11k: add wait operation for tx management packets for flush from mac80211
[v2] ath11k: change to treat alpha code na as world wide regdomainQuoted 3 lines
I will rebase the left patches after these patches upstream, otherwise the left patches will have conflict with these patches because they change same location but actually have no logic relation.
Hi Kalle,
I have tested in my local git, all the above v2 patches only have one conflict
between "[v2,2/2] ath11k: add 11d scan offload support"
and "[v2] ath11k: report rssi of each chain to mac80211"
inwmi_tlv_policiesofwmi.cbecause they both add a item in the struct. patch -p1 -i xxx.patch will auto fix this type conflict.
Review
Quoted 5 lines
(quoted diff) +4
-0+ [WMI_TAG_11D_NEW_COUNTRY_EVENT] = { + .min_len = sizeof(struct wmi_11d_new_cc_ev) }, + [WMI_TAG_PER_CHAIN_RSSI_STATS] = { + .min_len = sizeof(struct wmi_per_chain_rssi_stats) },
Thanks, this was very helpful. I have the patches now in the pending branch, I'll test and review them next week.
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches