[PATCH] wifi: ath12k: fix endianness handling for SRNG ring pointer accesses
Alexander Wilhelm
alexander.wilhelm at westermo.com
Tue Nov 18 01:46:19 PST 2025
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 at westermo.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'll change that in the next version.
Best regards
Alexander Wilhelm
More information about the ath12k
mailing list