Skip to contentSkip to conversation

rtlwifi: rtl8192de: Fixes for several regressions

PATCH In review Larry Finger 2 participants 6 messages Nov 11, 2019 – Nov 22, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover rtlwifi: rtl8192de: Fixes for several regressions

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.

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(-)
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/3 rtlwifi: rtl8192de: Fix missing code to retrieve RX buffer address

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 <[email protected]> # 3.18+
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c +5 -3
index 2494e1f118f8..b4561923a70a 100644
@@ -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",
Signature · 1 line
2.23.0
#2 lore raw

Re: [PATCH 1/3] rtlwifi: rtl8192de: Fix missing code to retrieve RX buffer address

Quoted 9 lines · Larry Finger

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 <[email protected]> # 3.18+

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

Signature · 3 lines
https://patchwork.kernel.org/patch/11237573/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw

PATCH 2/3 rtlwifi: rtl8192de: Fix missing callback that tests for hw release of buffer

In reply to Larry Finger

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 <[email protected]> # v3.18+
---
 .../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(+)
drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c +1 -0
index 99e5cd9a5c86..1dbdddce0823 100644
@@ -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,
drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c +17 -0
index b4561923a70a..92c9fb45f800 100644
@@ -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);
drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h +2 -0
index 36820070fd76..635989e15282 100644
@@ -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,
Signature · 1 line
2.23.0

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [PATCH 2/3] rtlwifi: rtl8192de: Fix missing callback that tests for hw release of buffer

Quoted 42 lines · Sasha Levin

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

Quoted 3 lines

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

#6 lore raw

PATCH 3/3 rtlwifi: rtl8192de: Fix missing enable interrupt flag

In reply to Larry Finger

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 <[email protected]> # v3.18+
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c +5 -4
index c7f29a9be50d..146fe144f5f5 100644
@@ -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,
Signature · 1 line
2.23.0