[PATCH 01/11] wifi: ath12k: fix endianness handling in QMI host capability request
Alexander Wilhelm
alexander.wilhelm at westermo.com
Wed Jul 16 00:50:50 PDT 2025
Ensure proper endianness support for big-endian platforms by correcting
data types in the QMI host capability request message and its associated
structures. Add missing byte swaps wherever these structures are
accessed or modified.
Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Alexander Wilhelm <alexander.wilhelm at westermo.com>
---
drivers/net/wireless/ath/ath12k/qmi.c | 9 +++++----
drivers/net/wireless/ath/ath12k/qmi.h | 24 ++++++++++++------------
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 7c611a1fd6d0..2287ed87dae8 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -2073,14 +2073,14 @@ static int ath12k_host_cap_parse_mlo(struct ath12k_base *ab,
req->mlo_capable_valid = 1;
req->mlo_capable = 1;
req->mlo_chip_id_valid = 1;
- req->mlo_chip_id = ab->device_id;
+ req->mlo_chip_id = cpu_to_le16(ab->device_id);
req->mlo_group_id_valid = 1;
req->mlo_group_id = ag->id;
req->max_mlo_peer_valid = 1;
/* Max peer number generally won't change for the same device
* but needs to be synced with host driver.
*/
- req->max_mlo_peer = ab->hw_params->max_mlo_peer;
+ req->max_mlo_peer = cpu_to_le16(ab->hw_params->max_mlo_peer);
req->mlo_num_chips_valid = 1;
req->mlo_num_chips = ag->num_devices;
@@ -2164,7 +2164,7 @@ int ath12k_qmi_host_cap_send(struct ath12k_base *ab)
int ret = 0;
req.num_clients_valid = 1;
- req.num_clients = 1;
+ req.num_clients = cpu_to_le32(1);
req.mem_cfg_mode = ab->qmi.target_mem_mode;
req.mem_cfg_mode_valid = 1;
req.bdf_support_valid = 1;
@@ -2182,7 +2182,8 @@ int ath12k_qmi_host_cap_send(struct ath12k_base *ab)
if (ab->hw_params->qmi_cnss_feature_bitmap) {
req.feature_list_valid = 1;
- req.feature_list = ab->hw_params->qmi_cnss_feature_bitmap;
+ req.feature_list =
+ cpu_to_le64(ab->hw_params->qmi_cnss_feature_bitmap);
}
/* BRINGUP: here we are piggybacking a lot of stuff using
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index abdaade3b542..ed7808fe2b71 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -164,8 +164,8 @@ struct ath12k_qmi {
#define QMI_WLANFW_MAX_HOST_DDR_RANGE_SIZE_V01 3
struct qmi_wlanfw_host_ddr_range {
- u64 start;
- u64 size;
+ __le64 start;
+ __le64 size;
};
enum ath12k_qmi_target_mem {
@@ -205,12 +205,12 @@ enum ath12k_qmi_cnss_feature {
struct qmi_wlanfw_host_cap_req_msg_v01 {
u8 num_clients_valid;
- u32 num_clients;
+ __le32 num_clients;
u8 wake_msi_valid;
- u32 wake_msi;
+ __le32 wake_msi;
u8 gpios_valid;
- u32 gpios_len;
- u32 gpios[QMI_WLFW_MAX_NUM_GPIO_V01];
+ __le32 gpios_len;
+ __le32 gpios[QMI_WLFW_MAX_NUM_GPIO_V01];
u8 nm_modem_valid;
u8 nm_modem;
u8 bdf_support_valid;
@@ -228,31 +228,31 @@ struct qmi_wlanfw_host_cap_req_msg_v01 {
u8 cal_done_valid;
u8 cal_done;
u8 mem_bucket_valid;
- u32 mem_bucket;
+ __le32 mem_bucket;
u8 mem_cfg_mode_valid;
u8 mem_cfg_mode;
u8 cal_duration_valid;
- u16 cal_duraiton;
+ __le16 cal_duraiton;
u8 platform_name_valid;
char platform_name[QMI_WLANFW_MAX_PLATFORM_NAME_LEN_V01 + 1];
u8 ddr_range_valid;
struct qmi_wlanfw_host_ddr_range ddr_range[QMI_WLANFW_MAX_HOST_DDR_RANGE_SIZE_V01];
u8 host_build_type_valid;
- enum qmi_wlanfw_host_build_type host_build_type;
+ __le32 host_build_type;
u8 mlo_capable_valid;
u8 mlo_capable;
u8 mlo_chip_id_valid;
- u16 mlo_chip_id;
+ __le16 mlo_chip_id;
u8 mlo_group_id_valid;
u8 mlo_group_id;
u8 max_mlo_peer_valid;
- u16 max_mlo_peer;
+ __le16 max_mlo_peer;
u8 mlo_num_chips_valid;
u8 mlo_num_chips;
u8 mlo_chip_info_valid;
struct wlfw_host_mlo_chip_info_s_v01 mlo_chip_info[QMI_WLFW_MAX_NUM_MLO_CHIPS_V01];
u8 feature_list_valid;
- u64 feature_list;
+ __le64 feature_list;
};
--
2.34.1
More information about the ath12k
mailing list