Due to internal endianness handling within the QMI subsystem, all QMI
requests and responses must now be provided in CPU byte order. Replace all
QMI-related data types with CPU-endian types and add the necessary
conversions to ensure correct interpretation across architectures.
Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Alexander Wilhelm <alexander.wilhelm@westermo.com>
---
drivers/net/wireless/ath/ath12k/qmi.c | 24 ++++++++++++++++--------
drivers/net/wireless/ath/ath12k/qmi.h | 16 ++++++++--------
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 7c611a1fd6d0..36325e62aa24 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -3307,20 +3307,28 @@ static int ath12k_qmi_wlanfw_wlan_cfg_send(struct ath12k_base *ab)
/* This is number of CE configs */
req->tgt_cfg_len = ab->qmi.ce_cfg.tgt_ce_len;
for (pipe_num = 0; pipe_num < req->tgt_cfg_len ; pipe_num++) {
- req->tgt_cfg[pipe_num].pipe_num = ce_cfg[pipe_num].pipenum;
- req->tgt_cfg[pipe_num].pipe_dir = ce_cfg[pipe_num].pipedir;
- req->tgt_cfg[pipe_num].nentries = ce_cfg[pipe_num].nentries;
- req->tgt_cfg[pipe_num].nbytes_max = ce_cfg[pipe_num].nbytes_max;
- req->tgt_cfg[pipe_num].flags = ce_cfg[pipe_num].flags;
+ req->tgt_cfg[pipe_num].pipe_num =
+ __le32_to_cpu(ce_cfg[pipe_num].pipenum);
+ req->tgt_cfg[pipe_num].pipe_dir =
+ __le32_to_cpu(ce_cfg[pipe_num].pipedir);
+ req->tgt_cfg[pipe_num].nentries =
+ __le32_to_cpu(ce_cfg[pipe_num].nentries);
+ req->tgt_cfg[pipe_num].nbytes_max =
+ __le32_to_cpu(ce_cfg[pipe_num].nbytes_max);
+ req->tgt_cfg[pipe_num].flags =
+ __le32_to_cpu(ce_cfg[pipe_num].flags);
}
req->svc_cfg_valid = 1;
/* This is number of Service/CE configs */
req->svc_cfg_len = ab->qmi.ce_cfg.svc_to_ce_map_len;
for (pipe_num = 0; pipe_num < req->svc_cfg_len; pipe_num++) {
- req->svc_cfg[pipe_num].service_id = svc_cfg[pipe_num].service_id;
- req->svc_cfg[pipe_num].pipe_dir = svc_cfg[pipe_num].pipedir;
- req->svc_cfg[pipe_num].pipe_num = svc_cfg[pipe_num].pipenum;
+ req->svc_cfg[pipe_num].service_id =
+ __le32_to_cpu(svc_cfg[pipe_num].service_id);
+ req->svc_cfg[pipe_num].pipe_dir =
+ __le32_to_cpu(svc_cfg[pipe_num].pipedir);
+ req->svc_cfg[pipe_num].pipe_num =
+ __le32_to_cpu(svc_cfg[pipe_num].pipenum);
}
/* set shadow v3 configuration */
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index abdaade3b542..4767d9a2e309 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -392,17 +392,17 @@ enum qmi_wlanfw_pipedir_enum_v01 {
};
struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01 {
- __le32 pipe_num;
- __le32 pipe_dir;
- __le32 nentries;
- __le32 nbytes_max;
- __le32 flags;
+ u32 pipe_num;
+ u32 pipe_dir;
+ u32 nentries;
+ u32 nbytes_max;
+ u32 flags;
};
struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01 {
- __le32 service_id;
- __le32 pipe_dir;
- __le32 pipe_num;
+ u32 service_id;
+ u32 pipe_dir;
+ u32 pipe_num;
};
struct qmi_wlanfw_shadow_reg_cfg_s_v01 {
--
2.43.0
On 9/18/2025 1:53 AM, Alexander Wilhelm wrote: > Due to internal endianness handling within the QMI subsystem, all QMI > requests and responses must now be provided in CPU byte order. Replace all > QMI-related data types with CPU-endian types and add the necessary > conversions to ensure correct interpretation across architectures. I think you can break this out into a separate patch, but reword in a manner that doesn't indicate any dependency upon your series (it can be a predecessor) You can do that by noting: 1) currently (before your series) the QMI interface only works on LE systems because of how it encodes and decodes the data 2) however almost all QMI data structures did NOT use endianess-specific types for the data structures 3) the ath12k structs being modified are exceptions 4) the QMI interfaces are being modified to support BE, and that modification requires the QMI data structures to actually be in CPU order 5) So change the two ath12k QMI struct which currently use endianess-specific types 6) This change will work correctly with existing kernels (which only support LE) and will also work on future kernels where BE support is added. Then I can take this patch separately from the QMI changes. /jeff
On Thu, Sep 18, 2025 at 09:31:18AM -0700, Jeff Johnson wrote: > On 9/18/2025 1:53 AM, Alexander Wilhelm wrote: > > Due to internal endianness handling within the QMI subsystem, all QMI > > requests and responses must now be provided in CPU byte order. Replace all > > QMI-related data types with CPU-endian types and add the necessary > > conversions to ensure correct interpretation across architectures. > > I think you can break this out into a separate patch, but reword in a manner > that doesn't indicate any dependency upon your series (it can be a predecessor) Sure, I will do that. I have only two questions: * If I split this patch series, should I start on each one with v1 again, right? * When I mention that BE support will only work on future kernel version, should I better avoid the "Fixed:" tag or not? Best regards Alexander Wilhelm
On 9/19/2025 12:07 AM, Alexander Wilhelm wrote: > On Thu, Sep 18, 2025 at 09:31:18AM -0700, Jeff Johnson wrote: >> On 9/18/2025 1:53 AM, Alexander Wilhelm wrote: >>> Due to internal endianness handling within the QMI subsystem, all QMI >>> requests and responses must now be provided in CPU byte order. Replace all >>> QMI-related data types with CPU-endian types and add the necessary >>> conversions to ensure correct interpretation across architectures. >> >> I think you can break this out into a separate patch, but reword in a manner >> that doesn't indicate any dependency upon your series (it can be a predecessor) > > Sure, I will do that. I have only two questions: > * If I split this patch series, should I start on each one with v1 again, right? for the qmi series use v2 and in the rev history note you dropped the ath12k patch. for the ath12k singleton use v1 > * When I mention that BE support will only work on future kernel version, should > I better avoid the "Fixed:" tag or not? i'd avoid the Fixes tag. If you eventually need this series backported, you can do it yourself rather than have the stable team unnecessarily backport it. /jeff
© 2016 - 2025 Red Hat, Inc.