All of lore.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 11:09:45 +0100	[thread overview]
Message-ID: <aRxF6S72ffPclf6n@FUE-ALEWI-WINX> (raw)
In-Reply-To: <ddd31f03-8312-4e42-be97-2d2e1b390c76@oss.qualcomm.com>

On Tue, Nov 18, 2025 at 05:53:52PM +0800, Baochen Qiang wrote:
> 
> 
> 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@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 mean, should hp_addr in hal_srng structure be declared as '__le32 *' ?

Oh, you're right. I'll do that in v2. I'll set '__le32 *' for 'hp_addr/tp_addr'
for both 'dst_ring' and 'src_ring'. Thank you for the found issue.


Best regards
Alexander Wilhelm


      reply	other threads:[~2025-11-18 10:10 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
2025-11-18  9:53     ` Baochen Qiang
2025-11-18 10:09       ` Alexander Wilhelm [this message]

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=aRxF6S72ffPclf6n@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.