Search Linux Wireless

[PATCH] wifi: ath10k: convert msecs to jiffies where needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since 'mod_timer()' assumes expire time in jiffies and not milliseconds,
'msecs_to_jiffies()' should be used in 'ath10k_pci_rx_post_pipe()' and
'ath10k_snoc_rx_post_pipe()'.

This patch also introduces a minor refactoring and fixes number of loop
iterations in 'ath10k_pci_rx_post_pipe()' (I assume that the number of
calls of '__ath10k_pci_rx_post_buf()' should be equal to number of buffers
returned by '__ath10k_ce_rx_num_free_bufs()' and not plus one).

Fixes: a6e149a9ff03 ("ath10k: add hif start/stop methods for wcn3990 snoc layer")
Fixes: 728f95eef523 ("ath10k: rework posting pci rx buffers")

Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx>
---
 drivers/net/wireless/ath/ath10k/pci.c  | 20 ++++++++++----------
 drivers/net/wireless/ath/ath10k/snoc.c | 18 ++++++++++--------
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index a7f44f6335fb..18eca7a2154a 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -818,17 +818,17 @@ static void ath10k_pci_rx_post_pipe(struct ath10k_pci_pipe *pipe)
 	num = __ath10k_ce_rx_num_free_bufs(ce_pipe);
 	spin_unlock_bh(&ce->ce_lock);
 
-	while (num >= 0) {
+	while (num--) {
 		ret = __ath10k_pci_rx_post_buf(pipe);
-		if (ret) {
-			if (ret == -ENOSPC)
-				break;
-			ath10k_warn(ar, "failed to post pci rx buf: %d\n", ret);
-			mod_timer(&ar_pci->rx_post_retry, jiffies +
-				  ATH10K_PCI_RX_POST_RETRY_MS);
-			break;
-		}
-		num--;
+		if (unlikely(ret))
+			goto err;
+	}
+	return;
+err:
+	if (ret != -ENOSPC) {
+		ath10k_warn(ar, "failed to post pci rx buf: %d\n", ret);
+		mod_timer(&ar_pci->rx_post_retry, jiffies +
+			  msecs_to_jiffies(ATH10K_PCI_RX_POST_RETRY_MS));
 	}
 }
 
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
index 26214c00cd0d..9d180d02cc7c 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -544,16 +544,18 @@ static void ath10k_snoc_rx_post_pipe(struct ath10k_snoc_pipe *pipe)
 	spin_lock_bh(&ce->ce_lock);
 	num = __ath10k_ce_rx_num_free_bufs(ce_pipe);
 	spin_unlock_bh(&ce->ce_lock);
+
 	while (num--) {
 		ret = __ath10k_snoc_rx_post_buf(pipe);
-		if (ret) {
-			if (ret == -ENOSPC)
-				break;
-			ath10k_warn(ar, "failed to post rx buf: %d\n", ret);
-			mod_timer(&ar_snoc->rx_post_retry, jiffies +
-				  ATH10K_SNOC_RX_POST_RETRY_MS);
-			break;
-		}
+		if (unlikely(ret))
+			goto err;
+	}
+	return;
+err:
+	if (ret != -ENOSPC) {
+		ath10k_warn(ar, "failed to post rx buf: %d\n", ret);
+		mod_timer(&ar_snoc->rx_post_retry, jiffies +
+			  msecs_to_jiffies(ATH10K_SNOC_RX_POST_RETRY_MS));
 	}
 }
 
-- 
2.41.0




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux