public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Wilhelm <alexander.wilhelm@westermo.com>
To: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Cc: Jeff Johnson <jjohnson@kernel.org>,
	linux-wireless@vger.kernel.org, ath12k@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wifi: ath12k: fix endianness handling for SRNG ring pointer accesses
Date: Tue, 18 Nov 2025 10:46:19 +0100	[thread overview]
Message-ID: <aRxAa8OYCZqEx7Da@FUE-ALEWI-WINX> (raw)
In-Reply-To: <5a308d21-d463-4d6f-b5d3-95a0c2ede2c1@oss.qualcomm.com>

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

  reply	other threads:[~2025-11-18  9:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18  7:21 [PATCH] wifi: ath12k: fix endianness handling for SRNG ring pointer accesses Alexander Wilhelm
2025-11-18  9:35 ` Baochen Qiang
2025-11-18  9:46   ` Alexander Wilhelm [this message]
2025-11-18  9:53     ` Baochen Qiang
2025-11-18 10:09       ` 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=aRxAa8OYCZqEx7Da@FUE-ALEWI-WINX \
    --to=alexander.wilhelm@westermo.com \
    --cc=ath12k@lists.infradead.org \
    --cc=baochen.qiang@oss.qualcomm.com \
    --cc=jjohnson@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