[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ddd31f03-8312-4e42-be97-2d2e1b390c76@oss.qualcomm.com>
Date: Tue, 18 Nov 2025 17:53:52 +0800
From: Baochen Qiang <baochen.qiang@....qualcomm.com>
To: Alexander Wilhelm <alexander.wilhelm@...termo.com>
Cc: Jeff Johnson <jjohnson@...nel.org>, linux-wireless@...r.kernel.org,
ath12k@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] wifi: ath12k: fix endianness handling for SRNG ring
pointer accesses
On 11/18/2025 5:46 PM, Alexander Wilhelm wrote:
> On Tue, Nov 18, 2025 at 05:35:09PM +0800, Baochen Qiang wrote:
>>
>>
>> On 11/18/2025 3:21 PM, Alexander Wilhelm wrote:
>>> The SRNG head and tail ring pointers are stored in device memory as
>>> little-endian values. On big-endian systems, direct dereferencing of these
>>> pointers leads to incorrect values being read or written, causing ring
>>> management issues and potentially breaking data flow.
>>>
>>> This patch ensures all accesses to SRNG ring pointers use the appropriate
>>> endianness conversions. This affects both read and write paths for source
>>> and destination rings, as well as debug output. The changes guarantee
>>> correct operation on both little- and big-endian architectures.
>>>
>>> Signed-off-by: Alexander Wilhelm <alexander.wilhelm@...termo.com>
>>> ---
>>> drivers/net/wireless/ath/ath12k/hal.c | 35 +++++++++++++++------------
>>> 1 file changed, 20 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath12k/hal.c b/drivers/net/wireless/ath/ath12k/hal.c
>>> index 6406fcf5d69f..bd4d1de9eb1a 100644
>>> --- a/drivers/net/wireless/ath/ath12k/hal.c
>>> +++ b/drivers/net/wireless/ath/ath12k/hal.c
>>> @@ -2007,7 +2007,7 @@ int ath12k_hal_srng_dst_num_free(struct ath12k_base *ab, struct hal_srng *srng,
>>> tp = srng->u.dst_ring.tp;
>>>
>>> if (sync_hw_ptr) {
>>> - hp = *srng->u.dst_ring.hp_addr;
>>> + hp = le32_to_cpu(*srng->u.dst_ring.hp_addr);
>>
>> should we also need to change its type to '__le32 *'?
>
> I saw that in the 'wifi: ath12k: fix endianness handling while accessing wmi
> service bit' patch where '__le32' was used? Which one should I preferably use?
I mean, should hp_addr in hal_srng structure be declared as '__le32 *' ?
> I'll change that in the next version.
>
>
> Best regards
> Alexander Wilhelm
Powered by blists - more mailing lists