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 07/11] wifi: ath12k: fix endianness handling in QMI bdf download
Date: Wed, 16 Jul 2025 09:50:56 +0200 [thread overview]
Message-ID: <20250716075100.1447352-8-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 board data file download request message. Add
missing byte swaps wherever this structure is 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 | 18 +++++++++---------
drivers/net/wireless/ath/ath12k/qmi.h | 8 ++++----
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 0bcfb9281d01..d18ffb86f7bc 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -2934,9 +2934,9 @@ static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab,
while (remaining) {
req->valid = 1;
req->file_id_valid = 1;
- req->file_id = ab->qmi.target.board_id;
+ req->file_id = cpu_to_le32(ab->qmi.target.board_id);
req->total_size_valid = 1;
- req->total_size = remaining;
+ req->total_size = cpu_to_le32(remaining);
req->seg_id_valid = 1;
req->data_valid = 1;
req->bdf_type = type;
@@ -2945,18 +2945,18 @@ static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab,
req->end = 0;
if (remaining > QMI_WLANFW_MAX_DATA_SIZE_V01) {
- req->data_len = QMI_WLANFW_MAX_DATA_SIZE_V01;
+ req->data_len = cpu_to_le32(QMI_WLANFW_MAX_DATA_SIZE_V01);
} else {
- req->data_len = remaining;
+ req->data_len = cpu_to_le32(remaining);
req->end = 1;
}
if (type == ATH12K_QMI_FILE_TYPE_EEPROM) {
req->data_valid = 0;
req->end = 1;
- req->data_len = ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE;
+ req->data_len = cpu_to_le32(ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE);
} else {
- memcpy(req->data, temp, req->data_len);
+ memcpy(req->data, temp, le32_to_cpu(req->data_len));
}
ret = qmi_txn_init(&ab->qmi.handle, &txn,
@@ -2991,9 +2991,9 @@ static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab,
if (type == ATH12K_QMI_FILE_TYPE_EEPROM) {
remaining = 0;
} else {
- remaining -= req->data_len;
- temp += req->data_len;
- req->seg_id++;
+ remaining -= le32_to_cpu(req->data_len);
+ temp += le32_to_cpu(req->data_len);
+ req->seg_id += cpu_to_le32(1);
ath12k_dbg(ab, ATH12K_DBG_QMI,
"qmi bdf download request remaining %i\n",
remaining);
diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h
index 114324157e84..a48850ec0296 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.h
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
@@ -504,13 +504,13 @@ struct qmi_wlanfw_cap_req_msg_v01 {
struct qmi_wlanfw_bdf_download_req_msg_v01 {
u8 valid;
u8 file_id_valid;
- enum qmi_wlanfw_cal_temp_id_enum_v01 file_id;
+ __le32 file_id;
u8 total_size_valid;
- u32 total_size;
+ __le32 total_size;
u8 seg_id_valid;
- u32 seg_id;
+ __le32 seg_id;
u8 data_valid;
- u32 data_len;
+ __le32 data_len;
u8 data[QMI_WLANFW_MAX_DATA_SIZE_V01];
u8 end_valid;
u8 end;
--
2.34.1
next prev parent 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 ` [PATCH 01/11] wifi: ath12k: fix endianness handling in QMI host capability request Alexander Wilhelm
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 ` Alexander Wilhelm [this message]
2025-07-17 15:59 ` [PATCH 07/11] wifi: ath12k: fix endianness handling in QMI bdf download 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-8-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®