Re: [PATCH v3] wifi: ath12k: fix endianness handling for SRNG ring pointer accesses

From: Alexander Wilhelm

Date: Wed Mar 11 2026 - 02:59:36 EST


On Tue, Mar 10, 2026 at 10:55:37AM -0700, Jeff Johnson wrote:
> On 1/18/2026 11:39 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@xxxxxxxxxxxx>
> > ---
> > Changes in v3:
> > - Rebase on latest 'ath' master
> > - Use always 'le32_to_cpu()' macro for conversions
> >
> > Changes in v2:
> > - Set '__le32 *' type for 'hp_addr/tp_addr' in both 'dst_ring' and 'src_ring'
> > ---
> > drivers/net/wireless/ath/ath12k/hal.c | 37 +++++++++++++++------------
> > drivers/net/wireless/ath/ath12k/hal.h | 8 +++---
> > 2 files changed, 25 insertions(+), 20 deletions(-)
>
> I really hope to get your changes in.
>
> With your changes sparse reports:
> drivers/net/wireless/ath/ath12k/wifi7/hal.c:322:50: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/ath/ath12k/wifi7/hal.c:322:50: expected restricted __le32 [usertype] *hp_addr
> drivers/net/wireless/ath/ath12k/wifi7/hal.c:322:50: got unsigned int [usertype] *
> drivers/net/wireless/ath/ath12k/wifi7/hal.c:333:50: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/ath/ath12k/wifi7/hal.c:333:50: expected restricted __le32 [usertype] *tp_addr
> drivers/net/wireless/ath/ath12k/wifi7/hal.c:333:50: got unsigned int [usertype] *
> drivers/net/wireless/ath/ath12k/wifi7/hal.c:387:42: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/ath/ath12k/wifi7/hal.c:387:42: expected restricted __le32 [usertype] *tp_addr
> drivers/net/wireless/ath/ath12k/wifi7/hal.c:387:42: got unsigned int [usertype] *
> drivers/net/wireless/ath/ath12k/wifi7/hal.c:390:42: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/ath/ath12k/wifi7/hal.c:390:42: expected restricted __le32 [usertype] *hp_addr
> drivers/net/wireless/ath/ath12k/wifi7/hal.c:390:42: got unsigned int [usertype] *
>
> I'm also getting checkpatch issues:
> drivers/net/wireless/ath/ath12k/hal.c:503: Lines should not end with a '('
> drivers/net/wireless/ath/ath12k/hal.c:531: Lines should not end with a '('
> drivers/net/wireless/ath/ath12k/hal.c:551: Lines should not end with a '('
>
> Can you address these issues?

Hi Jeff,

Sure. It looks like I missed something. I’ll fix it as soon as possible.


Best regards
Alexander Wilhelm