From: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
To: Jonathan Wolf <wolf@pi0.com>, ath12k@lists.infradead.org
Cc: jjohnson@kernel.org, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH ath-current v2] wifi: ath12k: parse nested DBS/SBS capability TLVs
Date: Thu, 19 Nov 2026 11:14:28 +0800 [thread overview]
Message-ID: <616c30c0-8152-46a1-899b-e41b28b195cd@oss.qualcomm.com> (raw)
In-Reply-To: <20261118204307.3154270-1-wolf@pi0.com>
On 11/19/2026 4:43 AM, Jonathan Wolf wrote:
> The DBS/SBS capabilities in WMI_SERVICE_READY_EXT2_EVENTID are carried
> in a WMI_TAG_ARRAY_STRUCT containing nested TLVs. The array pointer
> therefore points to an inner TLV header, not directly to struct
> ath12k_wmi_dbs_or_sbs_cap_params.
>
> Casting the array pointer to that structure reads hw_mode_id as
> sbs_lower_band_end_freq. On WCN7850 firmware advertising hardware mode
> 5 and a 5900 MHz cutoff, the driver consequently records 5 MHz as the
> cutoff. This produces invalid SBS ranges such as 4900-5 MHz and makes
> a 5/6 GHz MLO pair appear to occupy the same hardware MAC, triggering
> partner-link deactivation.
>
> Iterate the nested capability TLVs with ath12k_wmi_tlv_iter() and reject
> unexpected tags and payloads shorter than the capability structure.
> Use the first record, matching the vendor host extractor, and leave
hmm, I don't think firmware can send more than one records. The firmware api clearly
documents there is only one TLV embedded:
typedef struct {
...
/* Followed by next TLVs:
* WMI_DMA_RING_CAPABILITIES dma_ring_caps[];
* wmi_spectral_bin_scaling_params wmi_bin_scaling_params[];
* WMI_MAC_PHY_CAPABILITIES_EXT mac_phy_caps[];
...
* wmi_dbs_or_sbs_cap_ext dbs_or_sbs_cap_ext; <== this one
...
} wmi_service_ready_ext2_event_fixed_param;
> the cutoff at zero when the array is empty. Only store the cutoff
> after the complete array has been validated. This leaves the existing
> hardware-mode and link-selection policy unchanged.
>
> Tested on a Steam Frame with WCN7850 hw2.0 using Valve's matching 7.2
> kernel source. MLO advertisement and radio-mapping diagnostics were
> enabled separately. The revised parser reported a 5900 MHz cutoff and
> the driver mapped the associated 5260/6295 MHz links to separate MACs.
> An unmodified upstream kernel was not boot-tested.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.IOE_HMT.1.1-00018-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1
>
> Fixes: 241d130f1419 ("wifi: ath12k: parse and save sbs_lower_band_end_freq from WMI_SERVICE_READY_EXT2_EVENTID event")
> Signed-off-by: Jonathan Wolf <wolf@pi0.com>
> ---
> Changes in v2:
> - Separate Tested-on from the official trailers, as requested.
> - Log DBS/SBS capability parsing failures before returning the error.
> - Move cutoff storage and debug output into a dedicated DBS/SBS parsing
> helper, following the existing capability-helper pattern. Commit the
> first record only after the complete nested array validates.
> - Remove the evidence link to the repository that is now private.
>
> Local validation: 15 SERVICE_READY_EXT2 parser cases pass with ASan and
> UBSan, including malformed later entries preserving the previous cutoff.
> The failure cases also check that a parser warning is emitted. Strict
> checkpatch on the code diff reports no errors, warnings, or checks.
>
> v1: https://lore.kernel.org/ath12k/20261118012321.2861920-1-wolf@pi0.com/
>
> drivers/net/wireless/ath/ath12k/wmi.c | 47 +++++++++++++++++++++++----
> drivers/net/wireless/ath/ath12k/wmi.h | 1 +
> 2 files changed, 41 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
> index 75b259990..0cf6e1eab 100644
> --- a/drivers/net/wireless/ath/ath12k/wmi.c
> +++ b/drivers/net/wireless/ath/ath12k/wmi.c
> @@ -5781,11 +5781,47 @@ static int ath12k_wmi_update_hw_mode_list(struct ath12k_base *ab)
> return 0;
> }
>
> +static int ath12k_wmi_tlv_dbs_sbs_caps(struct ath12k_base *ab, u16 tag,
> + u16 len, const void *ptr, void *data)
> +{
> + const struct ath12k_wmi_dbs_or_sbs_cap_params **first = data;
> +
> + if (tag != WMI_TAG_DBS_OR_SBS_CAP_EXT || len < sizeof(**first))
> + return -EPROTO;
> +
> + if (!*first)
> + *first = ptr;
> +
> + return 0;
> +}
> +
> +static int ath12k_wmi_dbs_sbs_caps(struct ath12k_base *ab, u16 len,
> + const void *ptr)
> +{
> + const struct ath12k_wmi_dbs_or_sbs_cap_params *caps = NULL;
> + int ret;
> +
> + ret = ath12k_wmi_tlv_iter(ab, ptr, len,
> + ath12k_wmi_tlv_dbs_sbs_caps, &caps);
> + if (ret) {
> + ath12k_warn(ab, "failed to parse DBS/SBS capabilities WMI TLV: %d\n",
> + ret);
> + return ret;
> + }
> +
> + ab->wmi_ab.sbs_lower_band_end_freq =
> + caps ? le32_to_cpu(caps->sbs_lower_band_end_freq) : 0;
> +
> + ath12k_dbg(ab, ATH12K_DBG_WMI, "sbs_lower_band_end_freq %u\n",
> + ab->wmi_ab.sbs_lower_band_end_freq);
> +
> + return 0;
> +}
> +
as stated above, maybe we can simply have:
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index f41138a7c68e..f7ac9def9213 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -5831,11 +5831,28 @@ static int ath12k_wmi_update_hw_mode_list(struct ath12k_base *ab)
return 0;
}
+static int ath12k_wmi_tlv_dbs_sbs_caps(struct ath12k_base *ab, u16 tag,
+ u16 len, const void *ptr, void *data)
+{
+ const struct ath12k_wmi_dbs_or_sbs_cap_params *caps = ptr;
+
+ if (tag != WMI_TAG_DBS_OR_SBS_CAP_EXT || len < sizeof(*caps))
+ return -EPROTO;
+
+ ab->wmi_ab.sbs_lower_band_end_freq =
+ le32_to_cpu(caps->sbs_lower_band_end_freq);
+
+ ath12k_dbg(ab, ATH12K_DBG_WMI, "sbs_lower_band_end_freq %u\n",
+ ab->wmi_ab.sbs_lower_band_end_freq);
+
+ return 0;
+}
+
static int ath12k_wmi_svc_rdy_ext2_parse(struct ath12k_base *ab,
u16 tag, u16 len,
const void *ptr, void *data)
{
- const struct ath12k_wmi_dbs_or_sbs_cap_params *dbs_or_sbs_caps;
struct ath12k_wmi_pdev *wmi_handle = &ab->wmi_ab.wmi[0];
struct ath12k_wmi_svc_rdy_ext2_parse *parse = data;
int ret;
@@ -5890,12 +5907,13 @@ static int ath12k_wmi_svc_rdy_ext2_parse(struct ath12k_base *ab,
} else if (!parse->htt_msdu_idx_to_qtype_map_done) {
parse->htt_msdu_idx_to_qtype_map_done = true;
} else if (!parse->dbs_or_sbs_cap_ext_done) {
- dbs_or_sbs_caps = ptr;
- ab->wmi_ab.sbs_lower_band_end_freq =
- __le32_to_cpu(dbs_or_sbs_caps->sbs_lower_band_end_freq);
-
- ath12k_dbg(ab, ATH12K_DBG_WMI, "sbs_lower_band_end_freq %u\n",
- ab->wmi_ab.sbs_lower_band_end_freq);
+ ab->wmi_ab.sbs_lower_band_end_freq = 0;
+ ret = ath12k_wmi_tlv_iter(ab, ptr, len,
+ ath12k_wmi_tlv_dbs_sbs_caps, NULL);
+ if (ret) {
+ ath12k_warn(ab, "failed to parse DBS/SBS capabilities WMI
TLV: %d\n", ret);
+ return ret;
+ }
ret = ath12k_wmi_update_hw_mode_list(ab);
if (ret) {
prev parent reply other threads:[~2026-11-19 3:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 20:43 Jonathan Wolf
2026-11-19 3:14 ` Baochen Qiang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=616c30c0-8152-46a1-899b-e41b28b195cd@oss.qualcomm.com \
--to=baochen.qiang@oss.qualcomm.com \
--cc=ath12k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=wolf@pi0.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®