linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maya Erez <merez@codeaurora.org>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: Maya Erez <merez@codeaurora.org>,
	linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com
Subject: [PATCH 20/20] wil6210: fix eDMA RX chaining
Date: Sun, 22 Jul 2018 10:47:45 +0300	[thread overview]
Message-ID: <1532245665-15249-21-git-send-email-merez@codeaurora.org> (raw)
In-Reply-To: <1532245665-15249-1-git-send-email-merez@codeaurora.org>

HW requires Rx buffers to be 4 bytes aligned. Modify the driver to
meet this requirement.
Enable OFU rdy valid bug fix, to prevent hang in oful34_rx while
there is back-pressure from host during RX.

Signed-off-by: Maya Erez <merez@codeaurora.org>
---
 drivers/net/wireless/ath/wil6210/main.c      |  7 +++++++
 drivers/net/wireless/ath/wil6210/txrx_edma.c | 13 ++++++-------
 drivers/net/wireless/ath/wil6210/wil6210.h   |  2 ++
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c
index 1d4ce8e..7debed6 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -1614,6 +1614,13 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
 
 		wil->txrx_ops.configure_interrupt_moderation(wil);
 
+		/* Enable OFU rdy valid bug fix, to prevent hang in oful34_rx
+		 * while there is back-pressure from Host during RX
+		 */
+		if (wil->hw_version >= HW_VER_TALYN_MB)
+			wil_s(wil, RGF_DMA_MISC_CTL,
+			      BIT_OFUL34_RDY_VALID_BUG_FIX_EN);
+
 		rc = wil_restore_vifs(wil);
 		if (rc) {
 			wil_err(wil, "failed to restore vifs, rc %d\n", rc);
diff --git a/drivers/net/wireless/ath/wil6210/txrx_edma.c b/drivers/net/wireless/ath/wil6210/txrx_edma.c
index 9ef2b66..bca61cb 100644
--- a/drivers/net/wireless/ath/wil6210/txrx_edma.c
+++ b/drivers/net/wireless/ath/wil6210/txrx_edma.c
@@ -27,6 +27,8 @@
 #include "trace.h"
 
 #define WIL_EDMA_MAX_DATA_OFFSET (2)
+/* RX buffer size must be aligned to 4 bytes */
+#define WIL_EDMA_RX_BUF_LEN_DEFAULT (2048)
 
 static void wil_tx_desc_unmap_edma(struct device *dev,
 				   union wil_tx_desc *desc,
@@ -158,8 +160,7 @@ static int wil_ring_alloc_skb_edma(struct wil6210_priv *wil,
 				   struct wil_ring *ring, u32 i)
 {
 	struct device *dev = wil_to_dev(wil);
-	unsigned int sz = wil->rx_buf_len + ETH_HLEN +
-		WIL_EDMA_MAX_DATA_OFFSET;
+	unsigned int sz = ALIGN(wil->rx_buf_len, 4);
 	dma_addr_t pa;
 	u16 buff_id;
 	struct list_head *active = &wil->rx_buff_mgmt.active;
@@ -600,7 +601,7 @@ static bool wil_is_rx_idle_edma(struct wil6210_priv *wil)
 static void wil_rx_buf_len_init_edma(struct wil6210_priv *wil)
 {
 	wil->rx_buf_len = rx_large_buf ?
-		WIL_MAX_ETH_MTU : TXRX_BUF_LEN_DEFAULT - WIL_MAX_MPDU_OVERHEAD;
+		WIL_MAX_ETH_MTU : WIL_EDMA_RX_BUF_LEN_DEFAULT;
 }
 
 static int wil_rx_init_edma(struct wil6210_priv *wil, u16 desc_ring_size)
@@ -633,8 +634,7 @@ static int wil_rx_init_edma(struct wil6210_priv *wil, u16 desc_ring_size)
 
 	wil_rx_buf_len_init_edma(wil);
 
-	max_rx_pl_per_desc = wil->rx_buf_len + ETH_HLEN +
-		WIL_EDMA_MAX_DATA_OFFSET;
+	max_rx_pl_per_desc = ALIGN(wil->rx_buf_len, 4);
 
 	/* Use debugfs dbg_num_rx_srings if set, reserve one sring for TX */
 	if (wil->num_rx_status_rings > WIL6210_MAX_STATUS_RINGS - 1)
@@ -869,8 +869,7 @@ static struct sk_buff *wil_sring_reap_rx_edma(struct wil6210_priv *wil,
 	struct sk_buff *skb;
 	dma_addr_t pa;
 	struct wil_ring_rx_data *rxdata = &sring->rx_data;
-	unsigned int sz = wil->rx_buf_len + ETH_HLEN +
-		WIL_EDMA_MAX_DATA_OFFSET;
+	unsigned int sz = ALIGN(wil->rx_buf_len, 4);
 	struct wil_net_stats *stats = NULL;
 	u16 dmalen;
 	int cid;
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h
index 28aa4a7..a683087 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -302,6 +302,8 @@ struct RGF_ICR {
 	#define BIT_DMA_ITR_RX_IDL_CNT_CTL_FOREVER		BIT(2)
 	#define BIT_DMA_ITR_RX_IDL_CNT_CTL_CLR			BIT(3)
 	#define BIT_DMA_ITR_RX_IDL_CNT_CTL_REACHED_TRESH	BIT(4)
+#define RGF_DMA_MISC_CTL				(0x881d6c)
+	#define BIT_OFUL34_RDY_VALID_BUG_FIX_EN			BIT(7)
 
 #define RGF_DMA_PSEUDO_CAUSE		(0x881c68)
 #define RGF_DMA_PSEUDO_CAUSE_MASK_SW	(0x881c6c)
-- 
1.9.1

      parent reply	other threads:[~2018-07-22  8:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-22  7:47 [PATCH 00/20] wil6210 patches Maya Erez
2018-07-22  7:47 ` [PATCH 01/20] wil6210: Rx multicast packets duplicate detection Maya Erez
2018-07-22  7:47 ` [PATCH 02/20] wil6210: drop Rx packets with L2 error indication from HW Maya Erez
2018-07-22  7:47 ` [PATCH 03/20] wil6210: add TX latency statistics Maya Erez
2018-07-22  7:47 ` [PATCH 04/20] wil6210: fix temperature debugfs Maya Erez
2018-07-22  7:47 ` [PATCH 05/20] wil6210: fix RX checksum report to network stack Maya Erez
2018-07-22  7:47 ` [PATCH 06/20] wil6210: support Talyn specific FW file Maya Erez
2018-07-22  7:47 ` [PATCH 07/20] wil6210: align to latest auto generated wmi.h Maya Erez
2018-07-22  7:47 ` [PATCH 08/20] wil6210: add 3-MSI support Maya Erez
2018-07-22  7:47 ` [PATCH 09/20] wil6210: fix min() compilation errors Maya Erez
2018-07-22  7:47 ` [PATCH 10/20] wil6210: add support for link statistics Maya Erez
2018-07-22  7:47 ` [PATCH 11/20] wil6210: send L2UF on behalf of newly associated station Maya Erez
2018-07-22 20:01   ` Johannes Berg
2018-07-23 15:27     ` merez
2018-07-22  7:47 ` [PATCH 12/20] wil6210: allow scan on AP interface Maya Erez
2018-07-22  7:47 ` [PATCH 13/20] wil6210: support max aggregation window size 64 Maya Erez
2018-07-22  7:47 ` [PATCH 14/20] wil6210: increase firmware ready timeout Maya Erez
2018-07-22  7:47 ` [PATCH 15/20] wil6210: support Talyn specific board file Maya Erez
2018-07-22  7:47 ` [PATCH 16/20] wil6210: set default 3-MSI Maya Erez
2018-07-22  7:47 ` [PATCH 17/20] wil6210: align to latest auto generated wmi.h Maya Erez
2018-07-22  7:47 ` [PATCH 18/20] wil6210: off channel transmit management frames in AP mode Maya Erez
2018-07-22  7:47 ` [PATCH 19/20] wil6210: prevent FW download if HW is configured for secured boot Maya Erez
2018-07-22  7:47 ` Maya Erez [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=1532245665-15249-21-git-send-email-merez@codeaurora.org \
    --to=merez@codeaurora.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=wil6210@qti.qualcomm.com \
    /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).