ath11k.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
To: ath11k@lists.infradead.org
Subject: [PATCH 1/2] ath11k/hal: Fix few bugs in ath11k_hal_srng_dst_num_free()
Date: Thu, 18 Jul 2019 09:54:14 +0530	[thread overview]
Message-ID: <1563423855-32397-1-git-send-email-vthiagar@codeaurora.org> (raw)

The logic to compute the number of available buffers in destination
ring is wrong. It should be just the different between head and
tail pointers in terms of the entry size. This functions currently
unused, this is fixed to make use of this function in follow-up
patches. Also make destination ring head pointer volatile because
it is independently updated by HW.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/hal.c | 7 +++----
 drivers/net/wireless/ath/ath11k/hal.h | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/ath/ath11k/hal.c
index 7da42a1..9eac311 100644
--- a/drivers/net/wireless/ath/ath11k/hal.c
+++ b/drivers/net/wireless/ath/ath11k/hal.c
@@ -745,9 +745,9 @@ int ath11k_hal_srng_dst_num_free(struct ath11k_base *ab, struct hal_srng *srng,
 	}
 
 	if (hp >= tp)
-		return ((hp - tp) / srng->entry_size) - 1;
+		return (hp - tp) / srng->entry_size;
 	else
-		return ((srng->ring_size - tp + hp) / srng->entry_size) - 1;
+		return (srng->ring_size - tp + hp) / srng->entry_size;
 }
 
 /* Returns number of available entries in src ring */
@@ -862,8 +862,7 @@ void ath11k_hal_srng_access_begin(struct ath11k_base *ab, struct hal_srng *srng)
 		srng->u.src_ring.cached_tp =
 			*(volatile u32 *)srng->u.src_ring.tp_addr;
 	else
-		srng->u.dst_ring.cached_hp =
-			*(volatile u32 *)srng->u.dst_ring.hp_addr;
+		srng->u.dst_ring.cached_hp = *srng->u.dst_ring.hp_addr;
 }
 
 /* Update cached ring head/tail pointers to HW. ath11k_hal_srng_access_begin()
diff --git a/drivers/net/wireless/ath/ath11k/hal.h b/drivers/net/wireless/ath/ath11k/hal.h
index a1e917e..d580acf 100644
--- a/drivers/net/wireless/ath/ath11k/hal.h
+++ b/drivers/net/wireless/ath/ath11k/hal.h
@@ -538,7 +538,7 @@ struct hal_srng {
 			u32 tp;
 
 			/* Shadow head pointer location to be updated by HW */
-			u32 *hp_addr;
+			volatile u32 *hp_addr;
 
 			/* Cached head pointer */
 			u32 cached_hp;
-- 
1.9.1


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

             reply	other threads:[~2019-07-18  4:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18  4:24 Vasanthakumar Thiagarajan [this message]
2019-07-18  4:24 ` [PATCH 2/2] ath11k/dp_rx: Fix possible REO ring desc overwrite Vasanthakumar Thiagarajan
2019-07-18 11:37 ` [PATCH 1/2] ath11k/hal: Fix few bugs in ath11k_hal_srng_dst_num_free() Kalle Valo
2019-07-18 12:13   ` Vasanthakumar Thiagarajan
2019-07-31 15:06 ` Kalle Valo

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=1563423855-32397-1-git-send-email-vthiagar@codeaurora.org \
    --to=vthiagar@codeaurora.org \
    --cc=ath11k@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).