All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 for 3.19 0/7] Fixes for rtl8192ee
@ 2015-01-20 17:01 ` Larry Finger
  0 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-01-20 17:01 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Larry Finger, netdev

Kalle,

This is V2 of the patches for rtl8192ee to be applied to 3.19. They replace
all the patches submitted under the title '[PATCH for 3.19 0/3] rtlwifi:
Various updates/fixes". All are marked for backporting to 3.18.

The first of these removes a logging statement that is no longer needed.

Patches 1-6 are relatively small and should not be a problem for 3.19.
Patch 7 is quite a bit larger, and adds two new routines to detect
DMA stalls. I will understand if you want to defer that to -next; however,
it does fix a serious problem.

Larry
---
Larry Finger (2):
  rtlwifi: Remove logging statement that is no longer needed
  rtlwifi: rtl8192ee: Fix problems with calculating free space in FIFO

Troy Tan (5):
  rtlwifi: rtl8192ee: Fix handling of new style descriptors
  rtlwifi: rtl8192ee: Fix adhoc fail
  rtlwifi: rtl8192ee: Fix TX hang due to failure to update TX write
    point
  rtlwifi: rtl8192ee: Fix parsing of received packet
  rtlwifi: rtl8192ee: Fix DMA stalls

 drivers/net/wireless/rtlwifi/pci.c           |  36 ++++--
 drivers/net/wireless/rtlwifi/pci.h           |   7 ++
 drivers/net/wireless/rtlwifi/rtl8192ee/fw.c  |   6 +-
 drivers/net/wireless/rtlwifi/rtl8192ee/hw.c  | 166 ++++++++++++++++++++++-----
 drivers/net/wireless/rtlwifi/rtl8192ee/reg.h |   2 +
 drivers/net/wireless/rtlwifi/rtl8192ee/sw.c  |   3 +-
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.c |  36 +++---
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.h |   4 +-
 drivers/net/wireless/rtlwifi/wifi.h          |   1 +
 9 files changed, 192 insertions(+), 69 deletions(-)

-- 
2.1.2


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

* [PATCH V2 for 3.19 0/7] Fixes for rtl8192ee
@ 2015-01-20 17:01 ` Larry Finger
  0 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-01-20 17:01 UTC (permalink / raw)
  To: kvalo-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, Larry Finger,
	netdev-u79uwXL29TY76Z2rM5mHXA

Kalle,

This is V2 of the patches for rtl8192ee to be applied to 3.19. They replace
all the patches submitted under the title '[PATCH for 3.19 0/3] rtlwifi:
Various updates/fixes". All are marked for backporting to 3.18.

The first of these removes a logging statement that is no longer needed.

Patches 1-6 are relatively small and should not be a problem for 3.19.
Patch 7 is quite a bit larger, and adds two new routines to detect
DMA stalls. I will understand if you want to defer that to -next; however,
it does fix a serious problem.

Larry
---
Larry Finger (2):
  rtlwifi: Remove logging statement that is no longer needed
  rtlwifi: rtl8192ee: Fix problems with calculating free space in FIFO

Troy Tan (5):
  rtlwifi: rtl8192ee: Fix handling of new style descriptors
  rtlwifi: rtl8192ee: Fix adhoc fail
  rtlwifi: rtl8192ee: Fix TX hang due to failure to update TX write
    point
  rtlwifi: rtl8192ee: Fix parsing of received packet
  rtlwifi: rtl8192ee: Fix DMA stalls

 drivers/net/wireless/rtlwifi/pci.c           |  36 ++++--
 drivers/net/wireless/rtlwifi/pci.h           |   7 ++
 drivers/net/wireless/rtlwifi/rtl8192ee/fw.c  |   6 +-
 drivers/net/wireless/rtlwifi/rtl8192ee/hw.c  | 166 ++++++++++++++++++++++-----
 drivers/net/wireless/rtlwifi/rtl8192ee/reg.h |   2 +
 drivers/net/wireless/rtlwifi/rtl8192ee/sw.c  |   3 +-
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.c |  36 +++---
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.h |   4 +-
 drivers/net/wireless/rtlwifi/wifi.h          |   1 +
 9 files changed, 192 insertions(+), 69 deletions(-)

-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH V2 for 3.19 1/7] rtlwifi: Remove logging statement that is no longer needed
@ 2015-01-20 17:01   ` Larry Finger
  0 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-01-20 17:01 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Larry Finger, netdev, Stable

In commit e9538cf4f907 ("rtlwifi: Fix error when accessing unmapped memory
in skb"), a printk was included to indicate that the condition had been
reached. There is now enough evidence from other users that the fix is
working. That logging statement can now be removed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> [V3.18]
---
 drivers/net/wireless/rtlwifi/pci.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index c70efb9..e25faac 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -816,11 +816,8 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
 
 		/* get a new skb - if fail, old one will be reused */
 		new_skb = dev_alloc_skb(rtlpci->rxbuffersize);
-		if (unlikely(!new_skb)) {
-			pr_err("Allocation of new skb failed in %s\n",
-			       __func__);
+		if (unlikely(!new_skb))
 			goto no_new;
-		}
 		if (rtlpriv->use_new_trx_flow) {
 			buffer_desc =
 			  &rtlpci->rx_ring[rxring_idx].buffer_desc
-- 
2.1.2


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

* [PATCH V2 for 3.19 1/7] rtlwifi: Remove logging statement that is no longer needed
@ 2015-01-20 17:01   ` Larry Finger
  0 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-01-20 17:01 UTC (permalink / raw)
  To: kvalo-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, Larry Finger,
	netdev-u79uwXL29TY76Z2rM5mHXA, Stable

In commit e9538cf4f907 ("rtlwifi: Fix error when accessing unmapped memory
in skb"), a printk was included to indicate that the condition had been
reached. There is now enough evidence from other users that the fix is
working. That logging statement can now be removed.

Signed-off-by: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
Cc: Stable <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> [V3.18]
---
 drivers/net/wireless/rtlwifi/pci.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index c70efb9..e25faac 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -816,11 +816,8 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
 
 		/* get a new skb - if fail, old one will be reused */
 		new_skb = dev_alloc_skb(rtlpci->rxbuffersize);
-		if (unlikely(!new_skb)) {
-			pr_err("Allocation of new skb failed in %s\n",
-			       __func__);
+		if (unlikely(!new_skb))
 			goto no_new;
-		}
 		if (rtlpriv->use_new_trx_flow) {
 			buffer_desc =
 			  &rtlpci->rx_ring[rxring_idx].buffer_desc
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH V2 for 3.19 2/7] rtlwifi: rtl8192ee: Fix handling of new style descriptors
  2015-01-20 17:01 ` Larry Finger
  (?)
  (?)
@ 2015-01-20 17:01 ` Larry Finger
  -1 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-01-20 17:01 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Troy Tan, netdev, Larry Finger, Stable

From: Troy Tan <troy_tan@realsil.com.cn>

The hardware and firmware for the RTL8192EE utilize a FIFO list of
descriptors. There were some problems with the initial implementation.
The worst of these failed to detect that the FIFO was becoming full,
which led to the device needing to be power cycled. As this condition
is not relevant to most of the devices supported by rtlwifi, a callback
routine was added to detect this situation. This patch implements the
necessary changes in the pci handler, and the linkage into the appropriate
rtl8192ee routine.

Signed-off-by: Troy Tan <troy_tan@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> [V3.18]
---
 drivers/net/wireless/rtlwifi/pci.c           | 31 +++++++++++++++++++++-------
 drivers/net/wireless/rtlwifi/rtl8192ee/sw.c  |  3 +--
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.c |  3 ++-
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.h |  2 +-
 drivers/net/wireless/rtlwifi/wifi.h          |  1 +
 5 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index e25faac..a62170e 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -578,6 +578,13 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
 		else
 			entry = (u8 *)(&ring->desc[ring->idx]);
 
+		if (rtlpriv->cfg->ops->get_available_desc &&
+		    rtlpriv->cfg->ops->get_available_desc(hw, prio) <= 1) {
+			RT_TRACE(rtlpriv, (COMP_INTR | COMP_SEND), DBG_DMESG,
+				 "no available desc!\n");
+			return;
+		}
+
 		if (!rtlpriv->cfg->ops->is_tx_desc_closed(hw, prio, ring->idx))
 			return;
 		ring->idx = (ring->idx + 1) % ring->entries;
@@ -641,10 +648,9 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
 
 		ieee80211_tx_status_irqsafe(hw, skb);
 
-		if ((ring->entries - skb_queue_len(&ring->queue))
-				== 2) {
+		if ((ring->entries - skb_queue_len(&ring->queue)) <= 4) {
 
-			RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
+			RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG,
 				 "more desc left, wake skb_queue@%d, ring->idx = %d, skb_queue_len = 0x%x\n",
 				 prio, ring->idx,
 				 skb_queue_len(&ring->queue));
@@ -793,7 +799,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
 			rx_remained_cnt =
 				rtlpriv->cfg->ops->rx_desc_buff_remained_cnt(hw,
 								      hw_queue);
-			if (rx_remained_cnt < 1)
+			if (rx_remained_cnt == 0)
 				return;
 
 		} else {	/* rx descriptor */
@@ -845,18 +851,18 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
 			else
 				skb_reserve(skb, stats.rx_drvinfo_size +
 					    stats.rx_bufshift);
-
 		} else {
 			RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
 				 "skb->end - skb->tail = %d, len is %d\n",
 				 skb->end - skb->tail, len);
-			break;
+			dev_kfree_skb_any(skb);
+			goto new_trx_end;
 		}
 		/* handle command packet here */
 		if (rtlpriv->cfg->ops->rx_command_packet &&
 		    rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) {
 				dev_kfree_skb_any(skb);
-				goto end;
+				goto new_trx_end;
 		}
 
 		/*
@@ -906,6 +912,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
 		} else {
 			dev_kfree_skb_any(skb);
 		}
+new_trx_end:
 		if (rtlpriv->use_new_trx_flow) {
 			rtlpci->rx_ring[hw_queue].next_rx_rp += 1;
 			rtlpci->rx_ring[hw_queue].next_rx_rp %=
@@ -921,7 +928,6 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
 			rtlpriv->enter_ps = false;
 			schedule_work(&rtlpriv->works.lps_change_work);
 		}
-end:
 		skb = new_skb;
 no_new:
 		if (rtlpriv->use_new_trx_flow) {
@@ -1685,6 +1691,15 @@ static int rtl_pci_tx(struct ieee80211_hw *hw,
 		}
 	}
 
+	if (rtlpriv->cfg->ops->get_available_desc &&
+	    rtlpriv->cfg->ops->get_available_desc(hw, hw_queue) == 0) {
+			RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
+				 "get_available_desc fail\n");
+			spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock,
+					       flags);
+			return skb->len;
+	}
+
 	if (ieee80211_is_data_qos(fc)) {
 		tid = rtl_get_tid(skb);
 		if (sta) {
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ee/sw.c
index f30c916..27e28f1 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/sw.c
@@ -113,8 +113,6 @@ int rtl92ee_init_sw_vars(struct ieee80211_hw *hw)
 				  RCR_HTC_LOC_CTRL		|
 				  RCR_AMF			|
 				  RCR_ACF			|
-				  RCR_ADF			|
-				  RCR_AICV			|
 				  RCR_ACRC32			|
 				  RCR_AB			|
 				  RCR_AM			|
@@ -241,6 +239,7 @@ static struct rtl_hal_ops rtl8192ee_hal_ops = {
 	.set_desc = rtl92ee_set_desc,
 	.get_desc = rtl92ee_get_desc,
 	.is_tx_desc_closed = rtl92ee_is_tx_desc_closed,
+	.get_available_desc = rtl92ee_get_available_desc,
 	.tx_polling = rtl92ee_tx_polling,
 	.enable_hw_sec = rtl92ee_enable_hw_security_config,
 	.init_sw_leds = rtl92ee_init_sw_leds,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
index 51806ac..0a006c4 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
@@ -551,7 +551,7 @@ static u16 get_desc_addr_fr_q_idx(u16 queue_index)
 	return desc_address;
 }
 
-void rtl92ee_get_available_desc(struct ieee80211_hw *hw, u8 q_idx)
+u16 rtl92ee_get_available_desc(struct ieee80211_hw *hw, u8 q_idx)
 {
 	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -570,6 +570,7 @@ void rtl92ee_get_available_desc(struct ieee80211_hw *hw, u8 q_idx)
 		       current_tx_read_point));
 
 	rtlpci->tx_ring[q_idx].avl_desc = point_diff;
+	return point_diff;
 }
 
 void rtl92ee_pre_fill_tx_bd_desc(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.h b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.h
index 45fd9db..c56f305 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.h
@@ -829,7 +829,7 @@ void rtl92ee_rx_check_dma_ok(struct ieee80211_hw *hw, u8 *header_desc,
 			     u8 queue_index);
 u16	rtl92ee_rx_desc_buff_remained_cnt(struct ieee80211_hw *hw,
 					  u8 queue_index);
-void rtl92ee_get_available_desc(struct ieee80211_hw *hw, u8 queue_index);
+u16 rtl92ee_get_available_desc(struct ieee80211_hw *hw, u8 queue_index);
 void rtl92ee_pre_fill_tx_bd_desc(struct ieee80211_hw *hw,
 				 u8 *tx_bd_desc, u8 *desc, u8 queue_index,
 				 struct sk_buff *skb, dma_addr_t addr);
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 3b3453a..413c2ab 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -2172,6 +2172,7 @@ struct rtl_hal_ops {
 	void (*add_wowlan_pattern)(struct ieee80211_hw *hw,
 				   struct rtl_wow_pattern *rtl_pattern,
 				   u8 index);
+	u16 (*get_available_desc)(struct ieee80211_hw *hw, u8 q_idx);
 };
 
 struct rtl_intf_ops {
-- 
2.1.2


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

* [PATCH V2 for 3.19 3/7] rtlwifi: rtl8192ee: Fix adhoc fail
@ 2015-01-20 17:01   ` Larry Finger
  0 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-01-20 17:01 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Troy Tan, netdev, Larry Finger, Stable

From: Troy Tan <troy_tan@realsil.com.cn>

When the buffer descriptor index exceeds 2, then a TX HANG condition
will result.

Signed-off-by: Troy Tan <troy_tan@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> [V3.18]
---
 drivers/net/wireless/rtlwifi/rtl8192ee/fw.c |  6 +-----
 drivers/net/wireless/rtlwifi/rtl8192ee/hw.c | 26 --------------------------
 2 files changed, 1 insertion(+), 31 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/fw.c b/drivers/net/wireless/rtlwifi/rtl8192ee/fw.c
index 45c128b..c5d4b80 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/fw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/fw.c
@@ -666,7 +666,6 @@ void rtl92ee_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
 	struct sk_buff *skb = NULL;
 
 	u32 totalpacketlen;
-	bool rtstatus;
 	u8 u1rsvdpageloc[5] = { 0 };
 	bool b_dlok = false;
 
@@ -728,10 +727,7 @@ void rtl92ee_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
 	memcpy((u8 *)skb_put(skb, totalpacketlen),
 	       &reserved_page_packet, totalpacketlen);
 
-	rtstatus = rtl_cmd_send_packet(hw, skb);
-
-	if (rtstatus)
-		b_dlok = true;
+	b_dlok = true;
 
 	if (b_dlok) {
 		RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD ,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c
index 47beb49..9199559 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c
@@ -85,29 +85,6 @@ static void _rtl92ee_enable_bcn_sub_func(struct ieee80211_hw *hw)
 	_rtl92ee_set_bcn_ctrl_reg(hw, 0, BIT(1));
 }
 
-static void _rtl92ee_return_beacon_queue_skb(struct ieee80211_hw *hw)
-{
-	struct rtl_priv *rtlpriv = rtl_priv(hw);
-	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
-	struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[BEACON_QUEUE];
-	unsigned long flags;
-
-	spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
-	while (skb_queue_len(&ring->queue)) {
-		struct rtl_tx_buffer_desc *entry =
-						&ring->buffer_desc[ring->idx];
-		struct sk_buff *skb = __skb_dequeue(&ring->queue);
-
-		pci_unmap_single(rtlpci->pdev,
-				 rtlpriv->cfg->ops->get_desc(
-				 (u8 *)entry, true, HW_DESC_TXBUFF_ADDR),
-				 skb->len, PCI_DMA_TODEVICE);
-		kfree_skb(skb);
-		ring->idx = (ring->idx + 1) % ring->entries;
-	}
-	spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags);
-}
-
 static void _rtl92ee_disable_bcn_sub_func(struct ieee80211_hw *hw)
 {
 	_rtl92ee_set_bcn_ctrl_reg(hw, BIT(1), 0);
@@ -403,9 +380,6 @@ static void _rtl92ee_download_rsvd_page(struct ieee80211_hw *hw)
 		rtl_write_byte(rtlpriv, REG_DWBCN0_CTRL + 2,
 			       bcnvalid_reg | BIT(0));
 
-		/* Return Beacon TCB */
-		_rtl92ee_return_beacon_queue_skb(hw);
-
 		/* download rsvd page */
 		rtl92ee_set_fw_rsvdpagepkt(hw, false);
 
-- 
2.1.2


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

* [PATCH V2 for 3.19 3/7] rtlwifi: rtl8192ee: Fix adhoc fail
@ 2015-01-20 17:01   ` Larry Finger
  0 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-01-20 17:01 UTC (permalink / raw)
  To: kvalo-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, Troy Tan,
	netdev-u79uwXL29TY76Z2rM5mHXA, Larry Finger, Stable

From: Troy Tan <troy_tan-kXabqFNEczNtrwSWzY7KCg@public.gmane.org>

When the buffer descriptor index exceeds 2, then a TX HANG condition
will result.

Signed-off-by: Troy Tan <troy_tan-kXabqFNEczNtrwSWzY7KCg@public.gmane.org>
Signed-off-by: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
Cc: Stable <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> [V3.18]
---
 drivers/net/wireless/rtlwifi/rtl8192ee/fw.c |  6 +-----
 drivers/net/wireless/rtlwifi/rtl8192ee/hw.c | 26 --------------------------
 2 files changed, 1 insertion(+), 31 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/fw.c b/drivers/net/wireless/rtlwifi/rtl8192ee/fw.c
index 45c128b..c5d4b80 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/fw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/fw.c
@@ -666,7 +666,6 @@ void rtl92ee_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
 	struct sk_buff *skb = NULL;
 
 	u32 totalpacketlen;
-	bool rtstatus;
 	u8 u1rsvdpageloc[5] = { 0 };
 	bool b_dlok = false;
 
@@ -728,10 +727,7 @@ void rtl92ee_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
 	memcpy((u8 *)skb_put(skb, totalpacketlen),
 	       &reserved_page_packet, totalpacketlen);
 
-	rtstatus = rtl_cmd_send_packet(hw, skb);
-
-	if (rtstatus)
-		b_dlok = true;
+	b_dlok = true;
 
 	if (b_dlok) {
 		RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD ,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c
index 47beb49..9199559 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c
@@ -85,29 +85,6 @@ static void _rtl92ee_enable_bcn_sub_func(struct ieee80211_hw *hw)
 	_rtl92ee_set_bcn_ctrl_reg(hw, 0, BIT(1));
 }
 
-static void _rtl92ee_return_beacon_queue_skb(struct ieee80211_hw *hw)
-{
-	struct rtl_priv *rtlpriv = rtl_priv(hw);
-	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
-	struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[BEACON_QUEUE];
-	unsigned long flags;
-
-	spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
-	while (skb_queue_len(&ring->queue)) {
-		struct rtl_tx_buffer_desc *entry =
-						&ring->buffer_desc[ring->idx];
-		struct sk_buff *skb = __skb_dequeue(&ring->queue);
-
-		pci_unmap_single(rtlpci->pdev,
-				 rtlpriv->cfg->ops->get_desc(
-				 (u8 *)entry, true, HW_DESC_TXBUFF_ADDR),
-				 skb->len, PCI_DMA_TODEVICE);
-		kfree_skb(skb);
-		ring->idx = (ring->idx + 1) % ring->entries;
-	}
-	spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags);
-}
-
 static void _rtl92ee_disable_bcn_sub_func(struct ieee80211_hw *hw)
 {
 	_rtl92ee_set_bcn_ctrl_reg(hw, BIT(1), 0);
@@ -403,9 +380,6 @@ static void _rtl92ee_download_rsvd_page(struct ieee80211_hw *hw)
 		rtl_write_byte(rtlpriv, REG_DWBCN0_CTRL + 2,
 			       bcnvalid_reg | BIT(0));
 
-		/* Return Beacon TCB */
-		_rtl92ee_return_beacon_queue_skb(hw);

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

* [PATCH V2 for 3.19 4/7] rtlwifi: rtl8192ee: Fix TX hang due to failure to update TX write point
@ 2015-01-20 17:01   ` Larry Finger
  0 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-01-20 17:01 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Troy Tan, netdev, Larry Finger, Stable

From: Troy Tan <troy_tan@realsil.com.cn>

Initially, the routine to update the write point in the FIFO buffer was
coded to save CPU time by not doing the calculation every interrupt. This
was an error and results in TX hangs.

Signed-off-by: Troy Tan <troy_tan@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> [V3.18]
---
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
index 0a006c4..1535680 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
@@ -1049,8 +1049,7 @@ bool rtl92ee_is_tx_desc_closed(struct ieee80211_hw *hw, u8 hw_queue, u16 index)
 	static u8 stop_report_cnt;
 	struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue];
 
-	/*checking Read/Write Point each interrupt wastes CPU */
-	if (stop_report_cnt > 15 || !rtlpriv->link_info.busytraffic) {
+	{
 		u16 point_diff = 0;
 		u16 cur_tx_rp, cur_tx_wp;
 		u32 tmpu32 = 0;
-- 
2.1.2


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

* [PATCH V2 for 3.19 4/7] rtlwifi: rtl8192ee: Fix TX hang due to failure to update TX write point
@ 2015-01-20 17:01   ` Larry Finger
  0 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-01-20 17:01 UTC (permalink / raw)
  To: kvalo-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, Troy Tan,
	netdev-u79uwXL29TY76Z2rM5mHXA, Larry Finger, Stable

From: Troy Tan <troy_tan-kXabqFNEczNtrwSWzY7KCg@public.gmane.org>

Initially, the routine to update the write point in the FIFO buffer was
coded to save CPU time by not doing the calculation every interrupt. This
was an error and results in TX hangs.

Signed-off-by: Troy Tan <troy_tan-kXabqFNEczNtrwSWzY7KCg@public.gmane.org>
Signed-off-by: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
Cc: Stable <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> [V3.18]
---
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
index 0a006c4..1535680 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
@@ -1049,8 +1049,7 @@ bool rtl92ee_is_tx_desc_closed(struct ieee80211_hw *hw, u8 hw_queue, u16 index)
 	static u8 stop_report_cnt;
 	struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue];
 
-	/*checking Read/Write Point each interrupt wastes CPU */
-	if (stop_report_cnt > 15 || !rtlpriv->link_info.busytraffic) {
+	{
 		u16 point_diff = 0;
 		u16 cur_tx_rp, cur_tx_wp;
 		u32 tmpu32 = 0;
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH V2 for 3.19 5/7] rtlwifi: rtl8192ee: Fix parsing of received packet
  2015-01-20 17:01 ` Larry Finger
                   ` (4 preceding siblings ...)
  (?)
@ 2015-01-20 17:01 ` Larry Finger
  -1 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-01-20 17:01 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Troy Tan, netdev, Larry Finger, Stable

From: Troy Tan <troy_tan@realsil.com.cn>

The firmware supplies two kinds of packets via the RX mechanism. Besides the
normal data received over the air, these packets may contain bluetooth status
and other information. The present code fails to detect which kind of
information was received.

Signed-off-by: Troy Tan <troy_tan@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> [V3.18]
---
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.c | 4 ++++
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
index 1535680..cb3cbb6 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
@@ -354,6 +354,10 @@ bool rtl92ee_rx_query_desc(struct ieee80211_hw *hw,
 	struct ieee80211_hdr *hdr;
 	u32 phystatus = GET_RX_DESC_PHYST(pdesc);
 
+	if (GET_RX_STATUS_DESC_RPT_SEL(pdesc) == 0)
+		status->packet_report_type = NORMAL_RX;
+	else
+		status->packet_report_type = C2H_PACKET;
 	status->length = (u16)GET_RX_DESC_PKT_LEN(pdesc);
 	status->rx_drvinfo_size = (u8)GET_RX_DESC_DRV_INFO_SIZE(pdesc) *
 				  RX_DRV_INFO_SIZE_UNIT;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.h b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.h
index c56f305..8f78ac9 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.h
@@ -542,6 +542,8 @@
 	LE_BITS_TO_4BYTE(__pdesc+8, 12, 4)
 #define GET_RX_DESC_RX_IS_QOS(__pdesc)			\
 	LE_BITS_TO_4BYTE(__pdesc+8, 16, 1)
+#define GET_RX_STATUS_DESC_RPT_SEL(__pdesc)		\
+	LE_BITS_TO_4BYTE(__pdesc+8, 28, 1)
 
 #define GET_RX_DESC_RXMCS(__pdesc)			\
 	LE_BITS_TO_4BYTE(__pdesc+12, 0, 7)
-- 
2.1.2


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

* [PATCH V2 for 3.19 6/7] rtlwifi: rtl8192ee: Fix problems with calculating free space in FIFO
  2015-01-20 17:01 ` Larry Finger
                   ` (5 preceding siblings ...)
  (?)
@ 2015-01-20 17:01 ` Larry Finger
  -1 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-01-20 17:01 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Larry Finger, netdev, Stable

This driver utilizes a FIFO buffer for RX descriptors. There are four places
in the code where it calculates the number of free slots. Several of those
locations do the calculation incorrectly. To fix these and to prevent future
mistakes, a common inline routine is created.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> [V3.18]
---
 drivers/net/wireless/rtlwifi/pci.h           |  7 +++++++
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.c | 26 ++++++--------------------
 2 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/pci.h b/drivers/net/wireless/rtlwifi/pci.h
index 5e83230..d4567d1 100644
--- a/drivers/net/wireless/rtlwifi/pci.h
+++ b/drivers/net/wireless/rtlwifi/pci.h
@@ -325,4 +325,11 @@ static inline void pci_write32_async(struct rtl_priv *rtlpriv,
 	writel(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr);
 }
 
+static inline u16 calc_fifo_space(u16 rp, u16 wp)
+{
+	if (rp <= wp)
+		return RTL_PCI_MAX_RX_COUNT - 1 + rp - wp;
+	return rp - wp - 1;
+}
+
 #endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
index cb3cbb6..80658bdf 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/trx.c
@@ -499,14 +499,7 @@ u16 rtl92ee_rx_desc_buff_remained_cnt(struct ieee80211_hw *hw, u8 queue_index)
 	if (!start_rx)
 		return 0;
 
-	if ((last_read_point > (RX_DESC_NUM_92E / 2)) &&
-	    (read_point <= (RX_DESC_NUM_92E / 2))) {
-		remind_cnt = RX_DESC_NUM_92E - write_point;
-	} else {
-		remind_cnt = (read_point >= write_point) ?
-			     (read_point - write_point) :
-			     (RX_DESC_NUM_92E - write_point + read_point);
-	}
+	remind_cnt = calc_fifo_space(read_point, write_point);
 
 	if (remind_cnt == 0)
 		return 0;
@@ -568,10 +561,8 @@ u16 rtl92ee_get_available_desc(struct ieee80211_hw *hw, u8 q_idx)
 	current_tx_read_point = (u16)((tmp_4byte >> 16) & 0x0fff);
 	current_tx_write_point = (u16)((tmp_4byte) & 0x0fff);
 
-	point_diff = ((current_tx_read_point > current_tx_write_point) ?
-		      (current_tx_read_point - current_tx_write_point) :
-		      (TX_DESC_NUM_92E - current_tx_write_point +
-		       current_tx_read_point));
+	point_diff = calc_fifo_space(current_tx_read_point,
+				     current_tx_write_point);
 
 	rtlpci->tx_ring[q_idx].avl_desc = point_diff;
 	return point_diff;
@@ -973,11 +964,8 @@ void rtl92ee_set_desc(struct ieee80211_hw *hw, u8 *pdesc, bool istx,
 
 				ring->cur_tx_wp = cur_tx_wp;
 				ring->cur_tx_rp = cur_tx_rp;
-				point_diff = ((cur_tx_rp > cur_tx_wp) ?
-					      (cur_tx_rp - cur_tx_wp) :
-					      (TX_DESC_NUM_92E - 1 -
-					       cur_tx_wp + cur_tx_rp));
-
+				point_diff = calc_fifo_space(cur_tx_rp,
+							     cur_tx_wp);
 				ring->avl_desc = point_diff;
 			}
 		}
@@ -1066,9 +1054,7 @@ bool rtl92ee_is_tx_desc_closed(struct ieee80211_hw *hw, u8 hw_queue, u16 index)
 
 		ring->cur_tx_wp = cur_tx_wp;
 		ring->cur_tx_rp = cur_tx_rp;
-		point_diff = ((cur_tx_rp > cur_tx_wp) ?
-			      (cur_tx_rp - cur_tx_wp) :
-			      (TX_DESC_NUM_92E - cur_tx_wp + cur_tx_rp));
+		point_diff = calc_fifo_space(cur_tx_rp, cur_tx_wp);
 
 		ring->avl_desc = point_diff;
 	}
-- 
2.1.2


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

* [PATCH V2 for 3.19 7/7] rtlwifi: rtl8192ee: Fix DMA stalls
  2015-01-20 17:01 ` Larry Finger
                   ` (6 preceding siblings ...)
  (?)
@ 2015-01-20 17:01 ` Larry Finger
  -1 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-01-20 17:01 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Troy Tan, netdev, Larry Finger, Stable

From: Troy Tan <troy_tan@realsil.com.cn>

There are instances where the DMA engine stalls. The new code detects
such stalls and restarts DMA without needing a power reset.

Signed-off-by: Troy Tan <troy_tan@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> [3.18]
---
 drivers/net/wireless/rtlwifi/rtl8192ee/hw.c  | 140 +++++++++++++++++++++++++++
 drivers/net/wireless/rtlwifi/rtl8192ee/reg.h |   2 +
 2 files changed, 142 insertions(+)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c
index 9199559..09bc43e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c
@@ -1137,6 +1137,139 @@ void rtl92ee_enable_hw_security_config(struct ieee80211_hw *hw)
 	rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value);
 }
 
+static bool _rtl8192ee_check_pcie_dma_hang(struct rtl_priv *rtlpriv)
+{
+	u8 tmp;
+
+	/* write reg 0x350 Bit[26]=1. Enable debug port. */
+	tmp = rtl_read_byte(rtlpriv, REG_BACKDOOR_DBI_DATA + 3);
+	if (!(tmp & BIT(2))) {
+		rtl_write_byte(rtlpriv, REG_BACKDOOR_DBI_DATA + 3,
+			       tmp | BIT(2));
+		mdelay(100); /* Suggested by DD Justin_tsai. */
+	}
+
+	/* read reg 0x350 Bit[25] if 1 : RX hang
+	 * read reg 0x350 Bit[24] if 1 : TX hang
+	 */
+	tmp = rtl_read_byte(rtlpriv, REG_BACKDOOR_DBI_DATA + 3);
+	if ((tmp & BIT(0)) || (tmp & BIT(1))) {
+		RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
+			 "CheckPcieDMAHang8192EE(): true!!\n");
+		return true;
+	}
+	return false;
+}
+
+static void _rtl8192ee_reset_pcie_interface_dma(struct rtl_priv *rtlpriv,
+						bool mac_power_on)
+{
+	u8 tmp;
+	bool release_mac_rx_pause;
+	u8 backup_pcie_dma_pause;
+
+	RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
+		 "ResetPcieInterfaceDMA8192EE()\n");
+
+	/* Revise Note: Follow the document "PCIe RX DMA Hang Reset Flow_v03"
+	 * released by SD1 Alan.
+	 */
+
+	/* 1. disable register write lock
+	 *	write 0x1C bit[1:0] = 2'h0
+	 *	write 0xCC bit[2] = 1'b1
+	 */
+	tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL);
+	tmp &= ~(BIT(1) | BIT(0));
+	rtl_write_byte(rtlpriv, REG_RSV_CTRL, tmp);
+	tmp = rtl_read_byte(rtlpriv, REG_PMC_DBG_CTRL2);
+	tmp |= BIT(2);
+	rtl_write_byte(rtlpriv, REG_PMC_DBG_CTRL2, tmp);
+
+	/* 2. Check and pause TRX DMA
+	 *	write 0x284 bit[18] = 1'b1
+	 *	write 0x301 = 0xFF
+	 */
+	tmp = rtl_read_byte(rtlpriv, REG_RXDMA_CONTROL);
+	if (tmp & BIT(2)) {
+		/* Already pause before the function for another reason. */
+		release_mac_rx_pause = false;
+	} else {
+		rtl_write_byte(rtlpriv, REG_RXDMA_CONTROL, (tmp | BIT(2)));
+		release_mac_rx_pause = true;
+	}
+
+	backup_pcie_dma_pause = rtl_read_byte(rtlpriv, REG_PCIE_CTRL_REG + 1);
+	if (backup_pcie_dma_pause != 0xFF)
+		rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 1, 0xFF);
+
+	if (mac_power_on) {
+		/* 3. reset TRX function
+		 *	write 0x100 = 0x00
+		 */
+		rtl_write_byte(rtlpriv, REG_CR, 0);
+	}
+
+	/* 4. Reset PCIe DMA
+	 *	write 0x003 bit[0] = 0
+	 */
+	tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
+	tmp &= ~(BIT(0));
+	rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, tmp);
+
+	/* 5. Enable PCIe DMA
+	 *	write 0x003 bit[0] = 1
+	 */
+	tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
+	tmp |= BIT(0);
+	rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, tmp);
+
+	if (mac_power_on) {
+		/* 6. enable TRX function
+		 *	write 0x100 = 0xFF
+		 */
+		rtl_write_byte(rtlpriv, REG_CR, 0xFF);
+
+		/* We should init LLT & RQPN and
+		 * prepare Tx/Rx descrptor address later
+		 * because MAC function is reset.
+		 */
+	}
+
+	/* 7. Restore PCIe autoload down bit
+	 *	write 0xF8 bit[17] = 1'b1
+	 */
+	tmp = rtl_read_byte(rtlpriv, REG_MAC_PHY_CTRL_NORMAL + 2);
+	tmp |= BIT(1);
+	rtl_write_byte(rtlpriv, REG_MAC_PHY_CTRL_NORMAL + 2, tmp);
+
+	/* In MAC power on state, BB and RF maybe in ON state,
+	 * if we release TRx DMA here
+	 * it will cause packets to be started to Tx/Rx,
+	 * so we release Tx/Rx DMA later.
+	 */
+	if (!mac_power_on) {
+		/* 8. release TRX DMA
+		 *	write 0x284 bit[18] = 1'b0
+		 *	write 0x301 = 0x00
+		 */
+		if (release_mac_rx_pause) {
+			tmp = rtl_read_byte(rtlpriv, REG_RXDMA_CONTROL);
+			rtl_write_byte(rtlpriv, REG_RXDMA_CONTROL,
+				       (tmp & (~BIT(2))));
+		}
+		rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 1,
+			       backup_pcie_dma_pause);
+	}
+
+	/* 9. lock system register
+	 *	write 0xCC bit[2] = 1'b0
+	 */
+	tmp = rtl_read_byte(rtlpriv, REG_PMC_DBG_CTRL2);
+	tmp &= ~(BIT(2));
+	rtl_write_byte(rtlpriv, REG_PMC_DBG_CTRL2, tmp);
+}
+
 int rtl92ee_hw_init(struct ieee80211_hw *hw)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -1162,6 +1295,13 @@ int rtl92ee_hw_init(struct ieee80211_hw *hw)
 		rtlhal->fw_ps_state = FW_PS_STATE_ALL_ON_92E;
 	}
 
+	if (_rtl8192ee_check_pcie_dma_hang(rtlpriv)) {
+		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "92ee dma hang!\n");
+		_rtl8192ee_reset_pcie_interface_dma(rtlpriv,
+						    rtlhal->mac_func_enable);
+		rtlhal->mac_func_enable = false;
+	}
+
 	rtstatus = _rtl92ee_init_mac(hw);
 
 	rtl_write_byte(rtlpriv, 0x577, 0x03);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/reg.h b/drivers/net/wireless/rtlwifi/rtl8192ee/reg.h
index 3f2a959..1eaa1fa 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/reg.h
@@ -77,9 +77,11 @@
 #define REG_HIMRE				0x00B8
 #define REG_HISRE				0x00BC
 
+#define REG_PMC_DBG_CTRL2			0x00CC
 #define REG_EFUSE_ACCESS			0x00CF
 #define REG_HPON_FSM				0x00EC
 #define REG_SYS_CFG1				0x00F0
+#define REG_MAC_PHY_CTRL_NORMAL			0x00F8
 #define REG_SYS_CFG2				0x00FC
 
 #define REG_CR					0x0100
-- 
2.1.2


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

* Re: [PATCH V2 for 3.19 0/7] Fixes for rtl8192ee
  2015-01-20 17:01 ` Larry Finger
                   ` (7 preceding siblings ...)
  (?)
@ 2015-01-23 15:26 ` Kalle Valo
  2015-01-23 16:40   ` Larry Finger
  -1 siblings, 1 reply; 19+ messages in thread
From: Kalle Valo @ 2015-01-23 15:26 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless, netdev

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

> This is V2 of the patches for rtl8192ee to be applied to 3.19. They replace
> all the patches submitted under the title '[PATCH for 3.19 0/3] rtlwifi:
> Various updates/fixes". All are marked for backporting to 3.18.
>
> The first of these removes a logging statement that is no longer needed.
>
> Patches 1-6 are relatively small and should not be a problem for 3.19.
> Patch 7 is quite a bit larger, and adds two new routines to detect
> DMA stalls. I will understand if you want to defer that to -next; however,
> it does fix a serious problem.

-rc6 is most likely released on Sunday, I cannot send six patches this
late in the cycle unless our inboxes are filling of bug reports. As my
inbox seems to be pretty empty about rtlwifi problems can you give more
background why you think it's important to get these to 3.19? Are these
all regressions from 3.18 or older bugs which just got fixed now?

>   rtlwifi: Remove logging statement that is no longer needed

I think this is ok.

>   rtlwifi: rtl8192ee: Fix adhoc fail

Ad-Hoc mode is not that popular, IMHO this can easily wait for -next.

>   rtlwifi: rtl8192ee: Fix problems with calculating free space in FIFO
>   rtlwifi: rtl8192ee: Fix handling of new style descriptors
>   rtlwifi: rtl8192ee: Fix TX hang due to failure to update TX write
>     point
>   rtlwifi: rtl8192ee: Fix parsing of received packet
>   rtlwifi: rtl8192ee: Fix DMA stalls

For -rc1 or -rc2 these would have been ok, but without really good
justifications getting these into -rc7 is difficult.

But the patches itself are create, huge improvement compared to v1.

-- 
Kalle Valo

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

* Re: [PATCH V2 for 3.19 0/7] Fixes for rtl8192ee
  2015-01-23 15:26 ` [PATCH V2 for 3.19 0/7] Fixes for rtl8192ee Kalle Valo
@ 2015-01-23 16:40   ` Larry Finger
  2015-01-23 20:24     ` Kalle Valo
  0 siblings, 1 reply; 19+ messages in thread
From: Larry Finger @ 2015-01-23 16:40 UTC (permalink / raw)
  To: Kalle Valo
  Cc: linux-wireless, netdev,
	"troy_tan@realsil.com.cn >>
	谭杭波"

On 01/23/2015 09:26 AM, Kalle Valo wrote:
> Larry Finger <Larry.Finger@lwfinger.net> writes:
>
>> This is V2 of the patches for rtl8192ee to be applied to 3.19. They replace
>> all the patches submitted under the title '[PATCH for 3.19 0/3] rtlwifi:
>> Various updates/fixes". All are marked for backporting to 3.18.
>>
>> The first of these removes a logging statement that is no longer needed.
>>
>> Patches 1-6 are relatively small and should not be a problem for 3.19.
>> Patch 7 is quite a bit larger, and adds two new routines to detect
>> DMA stalls. I will understand if you want to defer that to -next; however,
>> it does fix a serious problem.
>
> -rc6 is most likely released on Sunday, I cannot send six patches this
> late in the cycle unless our inboxes are filling of bug reports. As my
> inbox seems to be pretty empty about rtlwifi problems can you give more
> background why you think it's important to get these to 3.19? Are these
> all regressions from 3.18 or older bugs which just got fixed now?
>
>>    rtlwifi: Remove logging statement that is no longer needed
>
> I think this is ok.
>
>>    rtlwifi: rtl8192ee: Fix adhoc fail
>
> Ad-Hoc mode is not that popular, IMHO this can easily wait for -next.
>
>>    rtlwifi: rtl8192ee: Fix problems with calculating free space in FIFO
>>    rtlwifi: rtl8192ee: Fix handling of new style descriptors
>>    rtlwifi: rtl8192ee: Fix TX hang due to failure to update TX write
>>      point
>>    rtlwifi: rtl8192ee: Fix parsing of received packet
>>    rtlwifi: rtl8192ee: Fix DMA stalls
>
> For -rc1 or -rc2 these would have been ok, but without really good
> justifications getting these into -rc7 is difficult.
>
> But the patches itself are create, huge improvement compared to v1.

Kalle,

It is too bad that it took so long to get these ready. I think the reason that 
there are not a lot of bug reports is because the complaints are all in the 
GitHub issues for the rtlwifi_new repo, or with Ubuntu. If there are any that 
get filed against Bugzilla, I will refer them to that repo.

Driver rtl8192ee was new in 3.18. There had been a previous version in staging, 
but it did not get a lot of usage. I'm not sure if the additional usage after 
3.18 was due to the driver being in the regular tree, or if vendors started 
using the chips, but the problem reports started arriving. All these bugs have 
been part of rtl8192ee since it has been in the kernel, thus they are hard to 
categorize as regressions.

Push all 7 into -next so that they will be in 3.20. If you think it to be 
prudent, please leave the Cc for stable. That way 3.18 and 3.19 will eventually 
get the fixes.

Thanks,

Larry



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

* Re: [PATCH V2 for 3.19 0/7] Fixes for rtl8192ee
  2015-01-23 16:40   ` Larry Finger
@ 2015-01-23 20:24     ` Kalle Valo
  0 siblings, 0 replies; 19+ messages in thread
From: Kalle Valo @ 2015-01-23 20:24 UTC (permalink / raw)
  To: Larry Finger
  Cc: linux-wireless, netdev,
	troy_tan@realsil.com.cn >> 谭杭波

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

> It is too bad that it took so long to get these ready. I think the
> reason that there are not a lot of bug reports is because the
> complaints are all in the GitHub issues for the rtlwifi_new repo, or
> with Ubuntu. If there are any that get filed against Bugzilla, I will
> refer them to that repo.

Ok.

> Driver rtl8192ee was new in 3.18. There had been a previous version in
> staging, but it did not get a lot of usage. I'm not sure if the
> additional usage after 3.18 was due to the driver being in the regular
> tree, or if vendors started using the chips, but the problem reports
> started arriving. All these bugs have been part of rtl8192ee since it
> has been in the kernel, thus they are hard to categorize as
> regressions.

Good. So we are not going backwards in quality, that's most important.

> Push all 7 into -next so that they will be in 3.20. If you think it to
> be prudent, please leave the Cc for stable. That way 3.18 and 3.19
> will eventually get the fixes.

I think that's the best plan, thanks for understanding. The patches are
in my queue and I should apply them within the next few days, unless
anything comes during the review.

-- 
Kalle Valo

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

* Re: [V2,for,3.19,3/7] rtlwifi: rtl8192ee: Fix adhoc fail
  2015-01-20 17:01   ` Larry Finger
  (?)
@ 2015-02-03 13:15   ` Kalle Valo
  2015-02-03 13:23     ` Kalle Valo
  -1 siblings, 1 reply; 19+ messages in thread
From: Kalle Valo @ 2015-02-03 13:15 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless, Troy Tan, netdev, Larry Finger, Stable


> From: Troy Tan <troy_tan@realsil.com.cn>
> 
> When the buffer descriptor index exceeds 2, then a TX HANG condition
> will result.
> 
> Signed-off-by: Troy Tan <troy_tan@realsil.com.cn>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Stable <stable@vger.kernel.org> [V3.18]

Thanks, 4 patches applied to wireless-drivers-next.git:

b661a5da5776 rtlwifi: rtl8192ee: Fix adhoc fail
6e5f44361628 rtlwifi: rtl8192ee: Fix TX hang due to failure to update TX write point
92ff754240b8 rtlwifi: rtl8192ee: Fix parsing of received packet
21b39ddb5bb2 rtlwifi: rtl8192ee: Fix DMA stalls

3 patches skipped:

[V2,for,3.19,1/7] rtlwifi: Remove logging statement that is no longer needed
[V2,for,3.19,2/7] rtlwifi: rtl8192ee: Fix handling of new style descriptors
[V2,for,3.19,6/7] rtlwifi: rtl8192ee: Fix problems with calculating free space in FIFO

Kalle Valo

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

* Re: [V2,for,3.19,3/7] rtlwifi: rtl8192ee: Fix adhoc fail
  2015-02-03 13:15   ` [V2,for,3.19,3/7] " Kalle Valo
@ 2015-02-03 13:23     ` Kalle Valo
  2015-02-03 16:00       ` Larry Finger
  0 siblings, 1 reply; 19+ messages in thread
From: Kalle Valo @ 2015-02-03 13:23 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless, Troy Tan, netdev, Stable

Kalle Valo <kvalo@codeaurora.org> writes:

>> From: Troy Tan <troy_tan@realsil.com.cn>
>> 
>> When the buffer descriptor index exceeds 2, then a TX HANG condition
>> will result.
>> 
>> Signed-off-by: Troy Tan <troy_tan@realsil.com.cn>
>> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
>> Cc: Stable <stable@vger.kernel.org> [V3.18]
>
> Thanks, 4 patches applied to wireless-drivers-next.git:
>
> b661a5da5776 rtlwifi: rtl8192ee: Fix adhoc fail
> 6e5f44361628 rtlwifi: rtl8192ee: Fix TX hang due to failure to update TX write point
> 92ff754240b8 rtlwifi: rtl8192ee: Fix parsing of received packet
> 21b39ddb5bb2 rtlwifi: rtl8192ee: Fix DMA stalls
>
> 3 patches skipped:

I had to skip these three patches because of my mistake. So what I did
was that I had merged ("fast forwarded") the net tree into my
wireless-drivers tree and not realising I should not do that. So now I
can't merge wireless-drivers into wireless-drivers-next anymore, as it
will pull unnecessary net changes.

> [V2,for,3.19,1/7] rtlwifi: Remove logging statement that is no longer
> needed

I'll apply this after 3.20-rc1 is released, it should apply then without
problems (or the conflicts are easy for me to fix). Luckily this is just
a cosmetic error and can wait for 3.20-rc2, right?

> [V2,for,3.19,2/7] rtlwifi: rtl8192ee: Fix handling of new style descriptors
> [V2,for,3.19,6/7] rtlwifi: rtl8192ee: Fix problems with calculating free space in FIFO

Not sure what to do with these one. Should you rebase and send them now?

-- 
Kalle Valo

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

* Re: [V2,for,3.19,3/7] rtlwifi: rtl8192ee: Fix adhoc fail
  2015-02-03 13:23     ` Kalle Valo
@ 2015-02-03 16:00       ` Larry Finger
  0 siblings, 0 replies; 19+ messages in thread
From: Larry Finger @ 2015-02-03 16:00 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, Troy Tan, netdev, Stable

On 02/03/2015 07:23 AM, Kalle Valo wrote:
> Kalle Valo <kvalo@codeaurora.org> writes:
>
>>> From: Troy Tan <troy_tan@realsil.com.cn>
>>>
>>> When the buffer descriptor index exceeds 2, then a TX HANG condition
>>> will result.
>>>
>>> Signed-off-by: Troy Tan <troy_tan@realsil.com.cn>
>>> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
>>> Cc: Stable <stable@vger.kernel.org> [V3.18]
>>
>> Thanks, 4 patches applied to wireless-drivers-next.git:
>>
>> b661a5da5776 rtlwifi: rtl8192ee: Fix adhoc fail
>> 6e5f44361628 rtlwifi: rtl8192ee: Fix TX hang due to failure to update TX write point
>> 92ff754240b8 rtlwifi: rtl8192ee: Fix parsing of received packet
>> 21b39ddb5bb2 rtlwifi: rtl8192ee: Fix DMA stalls
>>
>> 3 patches skipped:
>
> I had to skip these three patches because of my mistake. So what I did
> was that I had merged ("fast forwarded") the net tree into my
> wireless-drivers tree and not realising I should not do that. So now I
> can't merge wireless-drivers into wireless-drivers-next anymore, as it
> will pull unnecessary net changes.
>
>> [V2,for,3.19,1/7] rtlwifi: Remove logging statement that is no longer
>> needed
>
> I'll apply this after 3.20-rc1 is released, it should apply then without
> problems (or the conflicts are easy for me to fix). Luckily this is just
> a cosmetic error and can wait for 3.20-rc2, right?

That is correct. 3.20-rc2 will be OK. I'll probably get a bunch of "your **** 
driver is spamming my logs, but I can ignore them".

>
>> [V2,for,3.19,2/7] rtlwifi: rtl8192ee: Fix handling of new style descriptors
>> [V2,for,3.19,6/7] rtlwifi: rtl8192ee: Fix problems with calculating free space in FIFO
>
> Not sure what to do with these one. Should you rebase and send them now?

These two fix real bugs and need to be in the kernel ASAP. Unfortunately, I saw 
you pass them off to DaveM and I deleted them from my "Submitted Patch" list. I 
can recreate them from my working copy of wireless-drivers, and I will resubmit. 
When I do, please process them as quickly as possible.

Thanks,

Larry




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

* Re: [V2, for, 3.19, 1/7] rtlwifi: Remove logging statement that is no longer needed
  2015-01-20 17:01   ` Larry Finger
  (?)
@ 2015-02-10 14:10   ` Kalle Valo
  -1 siblings, 0 replies; 19+ messages in thread
From: Kalle Valo @ 2015-02-10 14:10 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless, Larry Finger, netdev, Stable


> In commit e9538cf4f907 ("rtlwifi: Fix error when accessing unmapped memory
> in skb"), a printk was included to indicate that the condition had been
> reached. There is now enough evidence from other users that the fix is
> working. That logging statement can now be removed.
> 
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Stable <stable@vger.kernel.org> [V3.18]

Thanks, applied to wireless-drivers.git.

Kalle Valo

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

end of thread, other threads:[~2015-02-10 14:10 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-20 17:01 [PATCH V2 for 3.19 0/7] Fixes for rtl8192ee Larry Finger
2015-01-20 17:01 ` Larry Finger
2015-01-20 17:01 ` [PATCH V2 for 3.19 1/7] rtlwifi: Remove logging statement that is no longer needed Larry Finger
2015-01-20 17:01   ` Larry Finger
2015-02-10 14:10   ` [V2, for, 3.19, " Kalle Valo
2015-01-20 17:01 ` [PATCH V2 for 3.19 2/7] rtlwifi: rtl8192ee: Fix handling of new style descriptors Larry Finger
2015-01-20 17:01 ` [PATCH V2 for 3.19 3/7] rtlwifi: rtl8192ee: Fix adhoc fail Larry Finger
2015-01-20 17:01   ` Larry Finger
2015-02-03 13:15   ` [V2,for,3.19,3/7] " Kalle Valo
2015-02-03 13:23     ` Kalle Valo
2015-02-03 16:00       ` Larry Finger
2015-01-20 17:01 ` [PATCH V2 for 3.19 4/7] rtlwifi: rtl8192ee: Fix TX hang due to failure to update TX write point Larry Finger
2015-01-20 17:01   ` Larry Finger
2015-01-20 17:01 ` [PATCH V2 for 3.19 5/7] rtlwifi: rtl8192ee: Fix parsing of received packet Larry Finger
2015-01-20 17:01 ` [PATCH V2 for 3.19 6/7] rtlwifi: rtl8192ee: Fix problems with calculating free space in FIFO Larry Finger
2015-01-20 17:01 ` [PATCH V2 for 3.19 7/7] rtlwifi: rtl8192ee: Fix DMA stalls Larry Finger
2015-01-23 15:26 ` [PATCH V2 for 3.19 0/7] Fixes for rtl8192ee Kalle Valo
2015-01-23 16:40   ` Larry Finger
2015-01-23 20:24     ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.