mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Wilhelm <alexander.wilhelm@westermo.com>
To: Jeff Johnson <jjohnson@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: linux-wireless@vger.kernel.org, ath12k@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: [PATCH 01/11] wifi: ath12k: fix endianness handling in QMI host capability request
Date: Wed, 16 Jul 2025 09:50:50 +0200	[thread overview]
Message-ID: <20250716075100.1447352-2-alexander.wilhelm@westermo.com> (raw)
In-Reply-To: <20250716075100.1447352-1-alexander.wilhelm@westermo.com>

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@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


  reply	other threads:[~2025-07-16  8:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-16  7:50 [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Alexander Wilhelm
2025-07-16  7:50 ` Alexander Wilhelm [this message]
2025-07-16  7:50 ` [PATCH 02/11] wifi: ath12k: fix endianness handling in QMI phy capability response Alexander Wilhelm
2025-07-16  7:50 ` [PATCH 03/11] wifi: ath12k: fix endianness handling in QMI firmware indication Alexander Wilhelm
2025-07-16  7:50 ` [PATCH 04/11] wifi: ath12k: fix endianness handling in QMI firmware memory indication Alexander Wilhelm
2025-07-16  7:50 ` [PATCH 05/11] wifi: ath12k: fix endianness handling in QMI respond firmware memory Alexander Wilhelm
2025-07-16  7:50 ` [PATCH 06/11] wifi: ath12k: fix endianness handling in QMI firmware capabilities Alexander Wilhelm
2025-07-16  7:50 ` [PATCH 07/11] wifi: ath12k: fix endianness handling in QMI bdf download Alexander Wilhelm
2025-07-17 15:59   ` kernel test robot
2025-07-16  7:50 ` [PATCH 08/11] wifi: ath12k: fix endianness handling in QMI firmware m3 info Alexander Wilhelm
2025-07-16  7:50 ` [PATCH 09/11] wifi: ath12k: fix endianness handling in QMI firmware wlan mode Alexander Wilhelm
2025-07-16  7:50 ` [PATCH 10/11] wifi: ath12k: fix endianness handling in QMI wlan configuration Alexander Wilhelm
2025-07-16  7:51 ` [PATCH 11/11] wifi: ath12k: fix endianness handling in QMI response Alexander Wilhelm
2025-07-17  8:33   ` kernel test robot
2025-07-16 15:13 ` [PATCH 00/11] wifi: ath12k: Fix endianness handling in QMI Jeff Johnson
2025-07-20  4:24   ` Bjorn Andersson
2025-07-21  7:36     ` Alexander Wilhelm

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=20250716075100.1447352-2-alexander.wilhelm@westermo.com \
    --to=alexander.wilhelm@westermo.com \
    --cc=andersson@kernel.org \
    --cc=ath12k@lists.infradead.org \
    --cc=jjohnson@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /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®