linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] rtlwifi: rtl8192de: Fixes for several regressions
@ 2019-11-11 19:40 Larry Finger
  2019-11-11 19:40 ` [PATCH 1/3] rtlwifi: rtl8192de: Fix missing code to retrieve RX buffer address Larry Finger
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Larry Finger @ 2019-11-11 19:40 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, pkshih, Larry Finger

In commit 38506ecefab9 ("rtlwifi: rtl_pci: Start modification for
new drivers"), several changes that should have been applied to
rtl8192de were missed. Even though the driver has not functioned
since kernel 3.17, I found this problem when I was converting the
local bit manipulation macros. To my knowledge, no one has reported
this issue. Obviously, this particular card is not heavily used.

The 3 patches are marked for stable and fix obvious regressions;
however, there is no real need for special handling. They can
be applied to kernel 5.6.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>

Larry Finger (3):
  rtlwifi: rtl8192de: Fix missing code to retrieve RX buffer address
  rtlwifi: rtl8192de: Fix missing callback that tests for hw release of
    buffer
  rtlwifi: rtl8192de: Fix missing enable interrupt flag

 .../wireless/realtek/rtlwifi/rtl8192de/hw.c   |  9 ++++---
 .../wireless/realtek/rtlwifi/rtl8192de/sw.c   |  1 +
 .../wireless/realtek/rtlwifi/rtl8192de/trx.c  | 25 ++++++++++++++++---
 .../wireless/realtek/rtlwifi/rtl8192de/trx.h  |  2 ++
 4 files changed, 30 insertions(+), 7 deletions(-)

-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] rtlwifi: rtl8192de: Fix missing code to retrieve RX buffer address
  2019-11-11 19:40 [PATCH 0/3] rtlwifi: rtl8192de: Fixes for several regressions Larry Finger
@ 2019-11-11 19:40 ` Larry Finger
  2019-11-14 15:10   ` Kalle Valo
  2019-11-11 19:40 ` [PATCH 2/3] rtlwifi: rtl8192de: Fix missing callback that tests for hw release of buffer Larry Finger
  2019-11-11 19:40 ` [PATCH 3/3] rtlwifi: rtl8192de: Fix missing enable interrupt flag Larry Finger
  2 siblings, 1 reply; 6+ messages in thread
From: Larry Finger @ 2019-11-11 19:40 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, pkshih, Larry Finger, Stable

In commit 38506ecefab9 ("rtlwifi: rtl_pci: Start modification for
new drivers"), a callback to get the RX buffer address was added to
the PCI driver. Unfortunately, driver rtl8192de was not modified
appropriately and the code runs into a WARN_ONCE() call. The use
of an incorrect array is also fixed.

Fixes: 38506ecefab9 ("rtlwifi: rtl_pci: Start modification for new drivers")
Cc: Stable <stable@vger.kernel.org> # 3.18+
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
index 2494e1f118f8..b4561923a70a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
@@ -804,13 +804,15 @@ u64 rtl92de_get_desc(struct ieee80211_hw *hw,
 			break;
 		}
 	} else {
-		struct rx_desc_92c *pdesc = (struct rx_desc_92c *)p_desc;
 		switch (desc_name) {
 		case HW_DESC_OWN:
-			ret = GET_RX_DESC_OWN(pdesc);
+			ret = GET_RX_DESC_OWN(p_desc);
 			break;
 		case HW_DESC_RXPKT_LEN:
-			ret = GET_RX_DESC_PKT_LEN(pdesc);
+			ret = GET_RX_DESC_PKT_LEN(p_desc);
+			break;
+		case HW_DESC_RXBUFF_ADDR:
+			ret = GET_RX_DESC_BUFF_ADDR(p_desc);
 			break;
 		default:
 			WARN_ONCE(true, "rtl8192de: ERR rxdesc :%d not processed\n",
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] rtlwifi: rtl8192de: Fix missing callback that tests for hw release of buffer
  2019-11-11 19:40 [PATCH 0/3] rtlwifi: rtl8192de: Fixes for several regressions Larry Finger
  2019-11-11 19:40 ` [PATCH 1/3] rtlwifi: rtl8192de: Fix missing code to retrieve RX buffer address Larry Finger
@ 2019-11-11 19:40 ` Larry Finger
       [not found]   ` <20191122070014.BA0492070A@mail.kernel.org>
  2019-11-11 19:40 ` [PATCH 3/3] rtlwifi: rtl8192de: Fix missing enable interrupt flag Larry Finger
  2 siblings, 1 reply; 6+ messages in thread
From: Larry Finger @ 2019-11-11 19:40 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, pkshih, Larry Finger, Stable

In commit 38506ecefab9 ("rtlwifi: rtl_pci: Start modification for
new drivers"), a callback needed to check if the hardware has released
a buffer indicating that a DMA operation is completed was not added.

Fixes: 38506ecefab9 ("rtlwifi: rtl_pci: Start modification for new drivers")
Cc: Stable <stable@vger.kernel.org>	# v3.18+
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 .../net/wireless/realtek/rtlwifi/rtl8192de/sw.c |  1 +
 .../wireless/realtek/rtlwifi/rtl8192de/trx.c    | 17 +++++++++++++++++
 .../wireless/realtek/rtlwifi/rtl8192de/trx.h    |  2 ++
 3 files changed, 20 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c
index 99e5cd9a5c86..1dbdddce0823 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c
@@ -216,6 +216,7 @@ static struct rtl_hal_ops rtl8192de_hal_ops = {
 	.led_control = rtl92de_led_control,
 	.set_desc = rtl92de_set_desc,
 	.get_desc = rtl92de_get_desc,
+	.is_tx_desc_closed = rtl92de_is_tx_desc_closed,
 	.tx_polling = rtl92de_tx_polling,
 	.enable_hw_sec = rtl92de_enable_hw_security_config,
 	.set_key = rtl92de_set_key,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
index b4561923a70a..92c9fb45f800 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
@@ -823,6 +823,23 @@ u64 rtl92de_get_desc(struct ieee80211_hw *hw,
 	return ret;
 }
 
+bool rtl92de_is_tx_desc_closed(struct ieee80211_hw *hw,
+			       u8 hw_queue, u16 index)
+{
+	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
+	struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue];
+	u8 *entry = (u8 *)(&ring->desc[ring->idx]);
+	u8 own = (u8)rtl92de_get_desc(hw, entry, true, HW_DESC_OWN);
+
+	/* a beacon packet will only use the first
+	 * descriptor by defaut, and the own bit may not
+	 * be cleared by the hardware
+	 */
+	if (own)
+		return false;
+	return true;
+}
+
 void rtl92de_tx_polling(struct ieee80211_hw *hw, u8 hw_queue)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h
index 36820070fd76..635989e15282 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h
@@ -715,6 +715,8 @@ void rtl92de_set_desc(struct ieee80211_hw *hw, u8 *pdesc, bool istx,
 		      u8 desc_name, u8 *val);
 u64 rtl92de_get_desc(struct ieee80211_hw *hw,
 		     u8 *p_desc, bool istx, u8 desc_name);
+bool rtl92de_is_tx_desc_closed(struct ieee80211_hw *hw,
+			       u8 hw_queue, u16 index);
 void rtl92de_tx_polling(struct ieee80211_hw *hw, u8 hw_queue);
 void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
 			     bool b_firstseg, bool b_lastseg,
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] rtlwifi: rtl8192de: Fix missing enable interrupt flag
  2019-11-11 19:40 [PATCH 0/3] rtlwifi: rtl8192de: Fixes for several regressions Larry Finger
  2019-11-11 19:40 ` [PATCH 1/3] rtlwifi: rtl8192de: Fix missing code to retrieve RX buffer address Larry Finger
  2019-11-11 19:40 ` [PATCH 2/3] rtlwifi: rtl8192de: Fix missing callback that tests for hw release of buffer Larry Finger
@ 2019-11-11 19:40 ` Larry Finger
  2 siblings, 0 replies; 6+ messages in thread
From: Larry Finger @ 2019-11-11 19:40 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, pkshih, Larry Finger, Stable

In commit 38506ecefab9 ("rtlwifi: rtl_pci: Start modification for
new drivers"), the flag that indicates that interrupts are enabled was
never set.

In addition, there are several places when enable/disable interrupts
were commented out are restored. A sychronize_interrupts() call is
removed.

Fixes: 38506ecefab9 ("rtlwifi: rtl_pci: Start modification for new drivers")
Cc: Stable <stable@vger.kernel.org>	# v3.18+
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c
index c7f29a9be50d..146fe144f5f5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c
@@ -1176,6 +1176,7 @@ void rtl92de_enable_interrupt(struct ieee80211_hw *hw)
 
 	rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF);
 	rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF);
+	rtlpci->irq_enabled = true;
 }
 
 void rtl92de_disable_interrupt(struct ieee80211_hw *hw)
@@ -1185,7 +1186,7 @@ void rtl92de_disable_interrupt(struct ieee80211_hw *hw)
 
 	rtl_write_dword(rtlpriv, REG_HIMR, IMR8190_DISABLED);
 	rtl_write_dword(rtlpriv, REG_HIMRE, IMR8190_DISABLED);
-	synchronize_irq(rtlpci->pdev->irq);
+	rtlpci->irq_enabled = false;
 }
 
 static void _rtl92de_poweroff_adapter(struct ieee80211_hw *hw)
@@ -1351,7 +1352,7 @@ void rtl92de_set_beacon_related_registers(struct ieee80211_hw *hw)
 
 	bcn_interval = mac->beacon_interval;
 	atim_window = 2;
-	/*rtl92de_disable_interrupt(hw);  */
+	rtl92de_disable_interrupt(hw);
 	rtl_write_word(rtlpriv, REG_ATIMWND, atim_window);
 	rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval);
 	rtl_write_word(rtlpriv, REG_BCNTCFG, 0x660f);
@@ -1371,9 +1372,9 @@ void rtl92de_set_beacon_interval(struct ieee80211_hw *hw)
 
 	RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG,
 		 "beacon_interval:%d\n", bcn_interval);
-	/* rtl92de_disable_interrupt(hw); */
+	rtl92de_disable_interrupt(hw);
 	rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval);
-	/* rtl92de_enable_interrupt(hw); */
+	rtl92de_enable_interrupt(hw);
 }
 
 void rtl92de_update_interrupt_mask(struct ieee80211_hw *hw,
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] rtlwifi: rtl8192de: Fix missing code to retrieve RX buffer address
  2019-11-11 19:40 ` [PATCH 1/3] rtlwifi: rtl8192de: Fix missing code to retrieve RX buffer address Larry Finger
@ 2019-11-14 15:10   ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2019-11-14 15:10 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless, pkshih, Larry Finger, Stable

Larry Finger <Larry.Finger@lwfinger.net> wrote:

> In commit 38506ecefab9 ("rtlwifi: rtl_pci: Start modification for
> new drivers"), a callback to get the RX buffer address was added to
> the PCI driver. Unfortunately, driver rtl8192de was not modified
> appropriately and the code runs into a WARN_ONCE() call. The use
> of an incorrect array is also fixed.
> 
> Fixes: 38506ecefab9 ("rtlwifi: rtl_pci: Start modification for new drivers")
> Cc: Stable <stable@vger.kernel.org> # 3.18+
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>

3 patches applied to wireless-drivers-next.git, thanks.

0e531cc575c4 rtlwifi: rtl8192de: Fix missing code to retrieve RX buffer address
3155db7613ed rtlwifi: rtl8192de: Fix missing callback that tests for hw release of buffer
330bb7117101 rtlwifi: rtl8192de: Fix missing enable interrupt flag

-- 
https://patchwork.kernel.org/patch/11237573/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] rtlwifi: rtl8192de: Fix missing callback that tests for hw release of buffer
       [not found]   ` <20191122070014.BA0492070A@mail.kernel.org>
@ 2019-11-22 17:59     ` Larry Finger
  0 siblings, 0 replies; 6+ messages in thread
From: Larry Finger @ 2019-11-22 17:59 UTC (permalink / raw)
  To: Sasha Levin, kvalo; +Cc: linux-wireless, pkshih, stable

On 11/22/19 1:00 AM, Sasha Levin wrote:
> Hi,
> 
> [This is an automated email]
> 
> This commit has been processed because it contains a "Fixes:" tag,
> fixing commit: 38506ecefab9 ("rtlwifi: rtl_pci: Start modification for new drivers").
> 
> The bot has tested the following trees: v5.3.11, v4.19.84, v4.14.154, v4.9.201, v4.4.201.
> 
> v5.3.11: Build OK!
> v4.19.84: Build OK!
> v4.14.154: Failed to apply! Possible dependencies:
>      0c07bd745760 ("rtlwifi: rtl8192ee: Make driver support 64bits DMA.")
> 
> v4.9.201: Failed to apply! Possible dependencies:
>      004a1e167905 ("rtlwifi: rtl8821ae: Remove all instances of DBG_EMERG")
>      02527a73beb3 ("rtlwifi: rtl8188ee: Remove all instances of DBG_EMERG")
>      0c07bd745760 ("rtlwifi: rtl8192ee: Make driver support 64bits DMA.")
>      102e295ed5a4 ("rtlwifi: Redo debugging macros RTPRINT and RT_PRINT_DATA")
>      2d15acac2354 ("rtlwifi: rtl8192se: Remove all instances of DBG_EMERG")
>      4e2b4378f9d7 ("rtlwifi: rtl8723be: Remove all instances of DBG_EMERG")
>      a44f59d60365 ("rtlwifi: rtl8192ee: Remove all instances of DBG_EMERG")
>      a67005bc46d9 ("rtlwifi: rtl8723ae: Remove all instances of DBG_EMERG")
>      b8c79f454880 ("rtlwifi: rtl8192de: Remove all instances of DBG_EMERG")
>      c34df318ec9f ("rtlwifi: Convert COMP_XX entries into a proper debugging mask")
>      c38af3f06af4 ("rtlwifi: rtl8192cu: Remove all instances of DBG_EMERG")
>      e40a005652ad ("rtlwifi: rtl8192ce: Remove all instances of DBG_EMERG")
> 
> v4.4.201: Failed to apply! Possible dependencies:
>      02527a73beb3 ("rtlwifi: rtl8188ee: Remove all instances of DBG_EMERG")
>      0c07bd745760 ("rtlwifi: rtl8192ee: Make driver support 64bits DMA.")
>      102e295ed5a4 ("rtlwifi: Redo debugging macros RTPRINT and RT_PRINT_DATA")
>      4713bd1c7407 ("rtlwifi: Add missing newlines to RT_TRACE calls")
>      5345ea6a4bfb ("rtlwifi: fix error handling in *_read_adapter_info()")
>      9ce221915a94 ("rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size")
>      ad5748893b27 ("rtlwifi: Add switch variable to 'switch case not processed' messages")
>      b8c79f454880 ("rtlwifi: rtl8192de: Remove all instances of DBG_EMERG")
>      c34df318ec9f ("rtlwifi: Convert COMP_XX entries into a proper debugging mask")
>      c38af3f06af4 ("rtlwifi: rtl8192cu: Remove all instances of DBG_EMERG")
>      e40a005652ad ("rtlwifi: rtl8192ce: Remove all instances of DBG_EMERG")
> 
> 
> NOTE: The patch will not be queued to stable trees until it is upstream.
> 
> How should we proceed with this patch?

Sasha,

The underlying directories were moved from drivers/net/wireless/rtlwifi/ to 
drivers/net/wireless/realtek/rtlwifi/. I can refactor the patches to account for 
this change. How should I annotate them, and where should I send them?

Larry


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-22 17:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 19:40 [PATCH 0/3] rtlwifi: rtl8192de: Fixes for several regressions Larry Finger
2019-11-11 19:40 ` [PATCH 1/3] rtlwifi: rtl8192de: Fix missing code to retrieve RX buffer address Larry Finger
2019-11-14 15:10   ` Kalle Valo
2019-11-11 19:40 ` [PATCH 2/3] rtlwifi: rtl8192de: Fix missing callback that tests for hw release of buffer Larry Finger
     [not found]   ` <20191122070014.BA0492070A@mail.kernel.org>
2019-11-22 17:59     ` Larry Finger
2019-11-11 19:40 ` [PATCH 3/3] rtlwifi: rtl8192de: Fix missing enable interrupt flag Larry Finger

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).