All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] rt2800 patches 06.01.2017
@ 2017-01-06 13:05 Stanislaw Gruszka
  2017-01-06 13:05 ` [PATCH 1/9] rt2800usb: remove watchdog Stanislaw Gruszka
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Stanislaw Gruszka @ 2017-01-06 13:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: Helmut Schaa, Mathias Kresin

Random fixes for rt2800 driver.

Stanislaw Gruszka (9):
  rt2800usb: remove watchdog
  rt2800: increase TX timeout
  rt2x00: save conf settings before reset tuner
  rt2800: change default retry settings
  rt2800: tune TX_RTS_CFG config
  rt2800: fallback from mcs8 to mcs7
  rt2800usb: mark tx failure on timeout
  rt2x00: do not flush empty queue
  rt2800: set max_psdu to 3 on usb devices

 drivers/net/wireless/ralink/rt2x00/rt2800lib.c    | 28 ++++++++-----
 drivers/net/wireless/ralink/rt2x00/rt2800usb.c    | 49 ++---------------------
 drivers/net/wireless/ralink/rt2x00/rt2x00config.c | 32 +++++++--------
 drivers/net/wireless/ralink/rt2x00/rt2x00mac.c    |  3 +-
 drivers/net/wireless/ralink/rt2x00/rt2x00mmio.c   |  2 +-
 drivers/net/wireless/ralink/rt2x00/rt2x00usb.c    |  2 +-
 6 files changed, 41 insertions(+), 75 deletions(-)

-- 
2.7.4

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

* [PATCH 1/9] rt2800usb: remove watchdog
  2017-01-06 13:05 [PATCH 0/9] rt2800 patches 06.01.2017 Stanislaw Gruszka
@ 2017-01-06 13:05 ` Stanislaw Gruszka
  2017-01-17 11:59   ` [1/9] " Kalle Valo
  2017-01-06 13:05 ` [PATCH 2/9] rt2800: increase TX timeout Stanislaw Gruszka
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Stanislaw Gruszka @ 2017-01-06 13:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: Helmut Schaa, Mathias Kresin

On rt2800usb, if we do not get TX status from HW, we assume frames were
posted and after entry->last_action timeout, we forcibly provide TX
status to mac80211. So it's not possible to detect hardware TX hung
based on the timeout. Additionally TXRQ_PCNT tells on number of frames
in the Packet Buffer (buffer between bus interface and chip MAC
subsystem), which can be non zero on normal conditions. To check HW hung
we will need provide some different mechanism, for now remove watchdog
as current implementation is wrong and not useful.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800usb.c | 42 --------------------------
 1 file changed, 42 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
index f38c440..8ec22c0 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
@@ -436,47 +436,6 @@ static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev,
 }
 
 /*
- * Watchdog handlers
- */
-static void rt2800usb_watchdog(struct rt2x00_dev *rt2x00dev)
-{
-	unsigned int i;
-	u32 reg;
-
-	rt2x00usb_register_read(rt2x00dev, TXRXQ_PCNT, &reg);
-	if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q)) {
-		rt2x00_warn(rt2x00dev, "TX HW queue 0 timed out, invoke forced kick\n");
-
-		rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40012);
-
-		for (i = 0; i < 10; i++) {
-			udelay(10);
-			if (!rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q))
-				break;
-		}
-
-		rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40006);
-	}
-
-	rt2x00usb_register_read(rt2x00dev, TXRXQ_PCNT, &reg);
-	if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q)) {
-		rt2x00_warn(rt2x00dev, "TX HW queue 1 timed out, invoke forced kick\n");
-
-		rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf4000a);
-
-		for (i = 0; i < 10; i++) {
-			udelay(10);
-			if (!rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q))
-				break;
-		}
-
-		rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40006);
-	}
-
-	rt2x00usb_watchdog(rt2x00dev);
-}
-
-/*
  * TX descriptor initialization
  */
 static __le32 *rt2800usb_get_txwi(struct queue_entry *entry)
@@ -877,7 +836,6 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
 	.link_tuner		= rt2800_link_tuner,
 	.gain_calibration	= rt2800_gain_calibration,
 	.vco_calibration	= rt2800_vco_calibration,
-	.watchdog		= rt2800usb_watchdog,
 	.start_queue		= rt2800usb_start_queue,
 	.kick_queue		= rt2x00usb_kick_queue,
 	.stop_queue		= rt2800usb_stop_queue,
-- 
2.7.4

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

* [PATCH 2/9] rt2800: increase TX timeout
  2017-01-06 13:05 [PATCH 0/9] rt2800 patches 06.01.2017 Stanislaw Gruszka
  2017-01-06 13:05 ` [PATCH 1/9] rt2800usb: remove watchdog Stanislaw Gruszka
@ 2017-01-06 13:05 ` Stanislaw Gruszka
  2017-01-06 15:15   ` Felix Fietkau
  2017-01-06 13:05 ` [PATCH 3/9] rt2x00: save conf settings before reset tuner Stanislaw Gruszka
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Stanislaw Gruszka @ 2017-01-06 13:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: Helmut Schaa, Mathias Kresin

When medium is busy or frames have to be resend, it takes time to send
the frames and get TX status from hardware. For some really bad medium
conditions it can take seconds. Patch change TX status timeout to give
HW more time to provide it, however 500ms is not enough for bad
conditions. In the future this timeout should be removed and replaced
with proper watchdog mechanism.

Increase flush timeout accordingly as well.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800usb.c  | 2 +-
 drivers/net/wireless/ralink/rt2x00/rt2x00mmio.c | 2 +-
 drivers/net/wireless/ralink/rt2x00/rt2x00usb.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
index 8ec22c0..400f074 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
@@ -123,7 +123,7 @@ static inline bool rt2800usb_entry_txstatus_timeout(struct queue_entry *entry)
 	if (!test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
 		return false;
 
-	tout = time_after(jiffies, entry->last_action + msecs_to_jiffies(100));
+	tout = time_after(jiffies, entry->last_action + msecs_to_jiffies(500));
 	if (unlikely(tout))
 		rt2x00_dbg(entry->queue->rt2x00dev,
 			   "TX status timeout for entry %d in queue %d\n",
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.c b/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.c
index f0178fd..da38d25 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.c
@@ -101,7 +101,7 @@ void rt2x00mmio_flush_queue(struct data_queue *queue, bool drop)
 	unsigned int i;
 
 	for (i = 0; !rt2x00queue_empty(queue) && i < 10; i++)
-		msleep(10);
+		msleep(50);
 }
 EXPORT_SYMBOL_GPL(rt2x00mmio_flush_queue);
 
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
index 6005e14..838ca58 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
@@ -517,7 +517,7 @@ void rt2x00usb_flush_queue(struct data_queue *queue, bool drop)
 		 * Wait for a little while to give the driver
 		 * the oppurtunity to recover itself.
 		 */
-		msleep(10);
+		msleep(50);
 	}
 }
 EXPORT_SYMBOL_GPL(rt2x00usb_flush_queue);
-- 
2.7.4

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

* [PATCH 3/9] rt2x00: save conf settings before reset tuner
  2017-01-06 13:05 [PATCH 0/9] rt2800 patches 06.01.2017 Stanislaw Gruszka
  2017-01-06 13:05 ` [PATCH 1/9] rt2800usb: remove watchdog Stanislaw Gruszka
  2017-01-06 13:05 ` [PATCH 2/9] rt2800: increase TX timeout Stanislaw Gruszka
@ 2017-01-06 13:05 ` Stanislaw Gruszka
  2017-01-06 13:05 ` [PATCH 4/9] rt2800: change default retry settings Stanislaw Gruszka
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Stanislaw Gruszka @ 2017-01-06 13:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: Helmut Schaa, Mathias Kresin

Reset tuner use curr_band value, make sure it is updated.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2x00config.c | 32 +++++++++++------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
index 6a1f508..3505074 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
@@ -249,6 +249,22 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
 	 */
 	rt2x00dev->ops->lib->config(rt2x00dev, &libconf, ieee80211_flags);
 
+	if (conf->flags & IEEE80211_CONF_PS)
+		set_bit(CONFIG_POWERSAVING, &rt2x00dev->flags);
+	else
+		clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags);
+
+	if (conf->flags & IEEE80211_CONF_MONITOR)
+		set_bit(CONFIG_MONITORING, &rt2x00dev->flags);
+	else
+		clear_bit(CONFIG_MONITORING, &rt2x00dev->flags);
+
+	rt2x00dev->curr_band = conf->chandef.chan->band;
+	rt2x00dev->curr_freq = conf->chandef.chan->center_freq;
+	rt2x00dev->tx_power = conf->power_level;
+	rt2x00dev->short_retry = conf->short_frame_max_tx_count;
+	rt2x00dev->long_retry = conf->long_frame_max_tx_count;
+
 	/*
 	 * Some configuration changes affect the link quality
 	 * which means we need to reset the link tuner.
@@ -271,20 +287,4 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
 				   &rt2x00dev->autowakeup_work,
 				   autowake_timeout - 15);
 	}
-
-	if (conf->flags & IEEE80211_CONF_PS)
-		set_bit(CONFIG_POWERSAVING, &rt2x00dev->flags);
-	else
-		clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags);
-
-	if (conf->flags & IEEE80211_CONF_MONITOR)
-		set_bit(CONFIG_MONITORING, &rt2x00dev->flags);
-	else
-		clear_bit(CONFIG_MONITORING, &rt2x00dev->flags);
-
-	rt2x00dev->curr_band = conf->chandef.chan->band;
-	rt2x00dev->curr_freq = conf->chandef.chan->center_freq;
-	rt2x00dev->tx_power = conf->power_level;
-	rt2x00dev->short_retry = conf->short_frame_max_tx_count;
-	rt2x00dev->long_retry = conf->long_frame_max_tx_count;
 }
-- 
2.7.4

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

* [PATCH 4/9] rt2800: change default retry settings
  2017-01-06 13:05 [PATCH 0/9] rt2800 patches 06.01.2017 Stanislaw Gruszka
                   ` (2 preceding siblings ...)
  2017-01-06 13:05 ` [PATCH 3/9] rt2x00: save conf settings before reset tuner Stanislaw Gruszka
@ 2017-01-06 13:05 ` Stanislaw Gruszka
  2017-01-06 13:05 ` [PATCH 5/9] rt2800: tune TX_RTS_CFG config Stanislaw Gruszka
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Stanislaw Gruszka @ 2017-01-06 13:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: Helmut Schaa, Mathias Kresin

We do not have option to set per frame retry count. We have only global
TX_RTY_CFG registers which specify the number or retries. Set setting
of that register to value that correspond rate control algorithm number
of frame post (number of retries + 1), which is 3 for aggregated frames.
This should help with big amount of retries on bad conditions, hence
mitigate buffer-bloat like problems.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 5436cdb..4833ec6 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -4769,8 +4769,8 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
 	rt2800_register_write(rt2x00dev, PBF_MAX_PCNT, 0x1f3fbf9f);
 
 	rt2800_register_read(rt2x00dev, TX_RTY_CFG, &reg);
-	rt2x00_set_field32(&reg, TX_RTY_CFG_SHORT_RTY_LIMIT, 15);
-	rt2x00_set_field32(&reg, TX_RTY_CFG_LONG_RTY_LIMIT, 31);
+	rt2x00_set_field32(&reg, TX_RTY_CFG_SHORT_RTY_LIMIT, 2);
+	rt2x00_set_field32(&reg, TX_RTY_CFG_LONG_RTY_LIMIT, 2);
 	rt2x00_set_field32(&reg, TX_RTY_CFG_LONG_RTY_THRE, 2000);
 	rt2x00_set_field32(&reg, TX_RTY_CFG_NON_AGG_RTY_MODE, 0);
 	rt2x00_set_field32(&reg, TX_RTY_CFG_AGG_RTY_MODE, 0);
@@ -7514,6 +7514,13 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
 
 	/*
+	 * Change default retry settings to values corresponding more closely
+	 * to rate[0].count setting of minstrel rate control algorithm.
+	 */
+	rt2x00dev->hw->wiphy->retry_short = 2;
+	rt2x00dev->hw->wiphy->retry_long = 2;
+
+	/*
 	 * Initialize all hw fields.
 	 */
 	ieee80211_hw_set(rt2x00dev->hw, REPORTS_TX_ACK_STATUS);
-- 
2.7.4

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

* [PATCH 5/9] rt2800: tune TX_RTS_CFG config
  2017-01-06 13:05 [PATCH 0/9] rt2800 patches 06.01.2017 Stanislaw Gruszka
                   ` (3 preceding siblings ...)
  2017-01-06 13:05 ` [PATCH 4/9] rt2800: change default retry settings Stanislaw Gruszka
@ 2017-01-06 13:05 ` Stanislaw Gruszka
  2017-01-06 13:05 ` [PATCH 6/9] rt2800: fallback from mcs8 to mcs7 Stanislaw Gruszka
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Stanislaw Gruszka @ 2017-01-06 13:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: Helmut Schaa, Mathias Kresin

Enable RTS frame retry fall-back and limit number of RTS retries to 7
what is default number of retries for small frames. As RTS/CTS is used
for TXOP protection, those settings prevent posting lots of RTS
frames when remote station do not response with CTS at the moment. After
sending 7 RTS's the HW will start back-off mechanism and after it will
start posing RTS again to get access to the medium.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 4833ec6..1f4a120 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -4902,10 +4902,10 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
 	rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg);
 
 	rt2800_register_read(rt2x00dev, TX_RTS_CFG, &reg);
-	rt2x00_set_field32(&reg, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 32);
+	rt2x00_set_field32(&reg, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 7);
 	rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_THRES,
 			   IEEE80211_MAX_RTS_THRESHOLD);
-	rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_FBK_EN, 0);
+	rt2x00_set_field32(&reg, TX_RTS_CFG_RTS_FBK_EN, 1);
 	rt2800_register_write(rt2x00dev, TX_RTS_CFG, reg);
 
 	rt2800_register_write(rt2x00dev, EXP_ACK_TIME, 0x002400ca);
-- 
2.7.4

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

* [PATCH 6/9] rt2800: fallback from mcs8 to mcs7
  2017-01-06 13:05 [PATCH 0/9] rt2800 patches 06.01.2017 Stanislaw Gruszka
                   ` (4 preceding siblings ...)
  2017-01-06 13:05 ` [PATCH 5/9] rt2800: tune TX_RTS_CFG config Stanislaw Gruszka
@ 2017-01-06 13:05 ` Stanislaw Gruszka
  2017-01-12 11:10   ` Felix Fietkau
  2017-01-13 10:11   ` [6/9] " Kalle Valo
  2017-01-06 13:05 ` [PATCH 7/9] rt2800usb: mark tx failure on timeout Stanislaw Gruszka
                   ` (2 subsequent siblings)
  8 siblings, 2 replies; 16+ messages in thread
From: Stanislaw Gruszka @ 2017-01-06 13:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: Helmut Schaa, Mathias Kresin

If we do not fallback to lower rate, we are unable to calculate
correctly number of retries in TX status code.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 1f4a120..6cac311 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -4968,7 +4968,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
 	rt2800_register_write(rt2x00dev, HT_FBK_CFG0, reg);
 
 	rt2800_register_read(rt2x00dev, HT_FBK_CFG1, &reg);
-	rt2x00_set_field32(&reg, HT_FBK_CFG1_HTMCS8FBK, 8);
+	rt2x00_set_field32(&reg, HT_FBK_CFG1_HTMCS8FBK, 7);
 	rt2x00_set_field32(&reg, HT_FBK_CFG1_HTMCS9FBK, 8);
 	rt2x00_set_field32(&reg, HT_FBK_CFG1_HTMCS10FBK, 9);
 	rt2x00_set_field32(&reg, HT_FBK_CFG1_HTMCS11FBK, 10);
-- 
2.7.4

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

* [PATCH 7/9] rt2800usb: mark tx failure on timeout
  2017-01-06 13:05 [PATCH 0/9] rt2800 patches 06.01.2017 Stanislaw Gruszka
                   ` (5 preceding siblings ...)
  2017-01-06 13:05 ` [PATCH 6/9] rt2800: fallback from mcs8 to mcs7 Stanislaw Gruszka
@ 2017-01-06 13:05 ` Stanislaw Gruszka
  2017-01-06 13:05 ` [PATCH 8/9] rt2x00: do not flush empty queue Stanislaw Gruszka
  2017-01-06 13:05 ` [PATCH 9/9] rt2800: set max_psdu to 3 on usb devices Stanislaw Gruszka
  8 siblings, 0 replies; 16+ messages in thread
From: Stanislaw Gruszka @ 2017-01-06 13:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: Helmut Schaa, Mathias Kresin

If we do not get TX status in reasonable time, we most likely fail to
send frame hence mark it as so.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800usb.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
index 400f074..205a7b8 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
@@ -602,10 +602,9 @@ static void rt2800usb_txdone_nostatus(struct rt2x00_dev *rt2x00dev)
 			    !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
 				break;
 
-			if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags))
+			if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags) ||
+			    rt2800usb_entry_txstatus_timeout(entry))
 				rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE);
-			else if (rt2800usb_entry_txstatus_timeout(entry))
-				rt2x00lib_txdone_noinfo(entry, TXDONE_UNKNOWN);
 			else
 				break;
 		}
-- 
2.7.4

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

* [PATCH 8/9] rt2x00: do not flush empty queue
  2017-01-06 13:05 [PATCH 0/9] rt2800 patches 06.01.2017 Stanislaw Gruszka
                   ` (6 preceding siblings ...)
  2017-01-06 13:05 ` [PATCH 7/9] rt2800usb: mark tx failure on timeout Stanislaw Gruszka
@ 2017-01-06 13:05 ` Stanislaw Gruszka
  2017-01-06 13:05 ` [PATCH 9/9] rt2800: set max_psdu to 3 on usb devices Stanislaw Gruszka
  8 siblings, 0 replies; 16+ messages in thread
From: Stanislaw Gruszka @ 2017-01-06 13:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: Helmut Schaa, Mathias Kresin

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2x00mac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
index 3cc1384..ecc9631 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
@@ -743,7 +743,8 @@ void rt2x00mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		return;
 
 	tx_queue_for_each(rt2x00dev, queue)
-		rt2x00queue_flush_queue(queue, drop);
+		if (!rt2x00queue_empty(queue))
+			rt2x00queue_flush_queue(queue, drop);
 }
 EXPORT_SYMBOL_GPL(rt2x00mac_flush);
 
-- 
2.7.4

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

* [PATCH 9/9] rt2800: set max_psdu to 3 on usb devices
  2017-01-06 13:05 [PATCH 0/9] rt2800 patches 06.01.2017 Stanislaw Gruszka
                   ` (7 preceding siblings ...)
  2017-01-06 13:05 ` [PATCH 8/9] rt2x00: do not flush empty queue Stanislaw Gruszka
@ 2017-01-06 13:05 ` Stanislaw Gruszka
  8 siblings, 0 replies; 16+ messages in thread
From: Stanislaw Gruszka @ 2017-01-06 13:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: Helmut Schaa, Mathias Kresin

All Ralink USB devices I have, including old ones, work well with
max_psdu = 3 (64kB tx AMPDUs).

Fix indent on the way.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 6cac311..de7a564 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -4743,15 +4743,16 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
 
 	rt2800_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
 	rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
-	if (rt2x00_rt_rev_gte(rt2x00dev, RT2872, REV_RT2872E) ||
-	    rt2x00_rt(rt2x00dev, RT2883) ||
-	    rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070E)) {
+	if (rt2x00_is_usb(rt2x00dev)) {
+		drv_data->max_psdu = 3;
+	} else if (rt2x00_rt_rev_gte(rt2x00dev, RT2872, REV_RT2872E) ||
+		   rt2x00_rt(rt2x00dev, RT2883) ||
+		   rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070E)) {
 		drv_data->max_psdu = 2;
-		rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
 	} else {
 		drv_data->max_psdu = 1;
-		rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
 	}
+	rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, drv_data->max_psdu);
 	rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_PSDU, 10);
 	rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_MPDU, 10);
 	rt2800_register_write(rt2x00dev, MAX_LEN_CFG, reg);
-- 
2.7.4

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

* Re: [PATCH 2/9] rt2800: increase TX timeout
  2017-01-06 13:05 ` [PATCH 2/9] rt2800: increase TX timeout Stanislaw Gruszka
@ 2017-01-06 15:15   ` Felix Fietkau
  2017-01-06 15:34     ` Stanislaw Gruszka
  0 siblings, 1 reply; 16+ messages in thread
From: Felix Fietkau @ 2017-01-06 15:15 UTC (permalink / raw)
  To: Stanislaw Gruszka, linux-wireless; +Cc: Helmut Schaa, Mathias Kresin

On 2017-01-06 14:05, Stanislaw Gruszka wrote:
> When medium is busy or frames have to be resend, it takes time to send
> the frames and get TX status from hardware. For some really bad medium
> conditions it can take seconds. Patch change TX status timeout to give
> HW more time to provide it, however 500ms is not enough for bad
> conditions. In the future this timeout should be removed and replaced
> with proper watchdog mechanism.
> 
> Increase flush timeout accordingly as well.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
By the way, to make tx status reporting more robust, I would suggest
mapping tx fifo status to skb only for frames where
IEEE80211_TX_CTL_REQ_TX_STATUS is set. For all other frames, set PID=0
and return the status using ieee80211_tx_status_noskb.
I did the same in mt76 and it works quite well.

- Felix

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

* Re: [PATCH 2/9] rt2800: increase TX timeout
  2017-01-06 15:15   ` Felix Fietkau
@ 2017-01-06 15:34     ` Stanislaw Gruszka
  0 siblings, 0 replies; 16+ messages in thread
From: Stanislaw Gruszka @ 2017-01-06 15:34 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, Helmut Schaa, Mathias Kresin

On Fri, Jan 06, 2017 at 04:15:40PM +0100, Felix Fietkau wrote:
> On 2017-01-06 14:05, Stanislaw Gruszka wrote:
> > When medium is busy or frames have to be resend, it takes time to send
> > the frames and get TX status from hardware. For some really bad medium
> > conditions it can take seconds. Patch change TX status timeout to give
> > HW more time to provide it, however 500ms is not enough for bad
> > conditions. In the future this timeout should be removed and replaced
> > with proper watchdog mechanism.
> > 
> > Increase flush timeout accordingly as well.
> > 
> > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> By the way, to make tx status reporting more robust, I would suggest
> mapping tx fifo status to skb only for frames where
> IEEE80211_TX_CTL_REQ_TX_STATUS is set. For all other frames, set PID=0
> and return the status using ieee80211_tx_status_noskb.
> I did the same in mt76 and it works quite well.

Good idea, thanks!

Stanislaw

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

* Re: [PATCH 6/9] rt2800: fallback from mcs8 to mcs7
  2017-01-06 13:05 ` [PATCH 6/9] rt2800: fallback from mcs8 to mcs7 Stanislaw Gruszka
@ 2017-01-12 11:10   ` Felix Fietkau
  2017-01-13  9:09     ` Stanislaw Gruszka
  2017-01-13 10:11   ` [6/9] " Kalle Valo
  1 sibling, 1 reply; 16+ messages in thread
From: Felix Fietkau @ 2017-01-12 11:10 UTC (permalink / raw)
  To: Stanislaw Gruszka, linux-wireless; +Cc: Helmut Schaa, Mathias Kresin

On 2017-01-06 14:05, Stanislaw Gruszka wrote:
> If we do not fallback to lower rate, we are unable to calculate
> correctly number of retries in TX status code.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
I think falling back from the lowest dual-stream to the highest
single-stream rate is a really bad idea.
Instead you should get rid of the assumption that fallback rates are
ordered by their MCS index.

- Felix

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

* Re: [PATCH 6/9] rt2800: fallback from mcs8 to mcs7
  2017-01-12 11:10   ` Felix Fietkau
@ 2017-01-13  9:09     ` Stanislaw Gruszka
  0 siblings, 0 replies; 16+ messages in thread
From: Stanislaw Gruszka @ 2017-01-13  9:09 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, Helmut Schaa, Mathias Kresin, Kalle Valo

On Thu, Jan 12, 2017 at 12:10:48PM +0100, Felix Fietkau wrote:
> On 2017-01-06 14:05, Stanislaw Gruszka wrote:
> > If we do not fallback to lower rate, we are unable to calculate
> > correctly number of retries in TX status code.
> > 
> > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> I think falling back from the lowest dual-stream to the highest
> single-stream rate is a really bad idea.

Ok, Kalle please drop this patch.

> Instead you should get rid of the assumption that fallback rates are
> ordered by their MCS index.

I think I will stay with the current code. With decreased retry
limit setting in other patch, problem is mitigated. For newer
chips there is retry count TX_STA_FIFO_EXT register, so I'll look
into that.

Thanks
Stanislaw

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

* Re: [6/9] rt2800: fallback from mcs8 to mcs7
  2017-01-06 13:05 ` [PATCH 6/9] rt2800: fallback from mcs8 to mcs7 Stanislaw Gruszka
  2017-01-12 11:10   ` Felix Fietkau
@ 2017-01-13 10:11   ` Kalle Valo
  1 sibling, 0 replies; 16+ messages in thread
From: Kalle Valo @ 2017-01-13 10:11 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: linux-wireless, Helmut Schaa, Mathias Kresin

Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> If we do not fallback to lower rate, we are unable to calculate
> correctly number of retries in TX status code.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>

Dropping per Stanislaw's request

Patch set to Changes Requested.

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

Documentation about submitting wireless patches and checking status
from patchwork:

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

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

* Re: [1/9] rt2800usb: remove watchdog
  2017-01-06 13:05 ` [PATCH 1/9] rt2800usb: remove watchdog Stanislaw Gruszka
@ 2017-01-17 11:59   ` Kalle Valo
  0 siblings, 0 replies; 16+ messages in thread
From: Kalle Valo @ 2017-01-17 11:59 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: linux-wireless, Helmut Schaa, Mathias Kresin

Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> On rt2800usb, if we do not get TX status from HW, we assume frames were
> posted and after entry->last_action timeout, we forcibly provide TX
> status to mac80211. So it's not possible to detect hardware TX hung
> based on the timeout. Additionally TXRQ_PCNT tells on number of frames
> in the Packet Buffer (buffer between bus interface and chip MAC
> subsystem), which can be non zero on normal conditions. To check HW hung
> we will need provide some different mechanism, for now remove watchdog
> as current implementation is wrong and not useful.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>

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

480b468625da rt2800usb: remove watchdog
cfe82fbd8423 rt2800: increase TX timeout
15ec51b25e05 rt2x00: save conf settings before reset tuner
01d97ef4b25f rt2800: change default retry settings
e4019e7f9530 rt2800: tune TX_RTS_CFG config
170122169676 rt2800usb: mark tx failure on timeout
51583248187c rt2x00: do not flush empty queue
66ecec02e851 rt2800: set max_psdu to 3 on usb devices

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

Documentation about submitting wireless patches and checking status
from patchwork:

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

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

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

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-06 13:05 [PATCH 0/9] rt2800 patches 06.01.2017 Stanislaw Gruszka
2017-01-06 13:05 ` [PATCH 1/9] rt2800usb: remove watchdog Stanislaw Gruszka
2017-01-17 11:59   ` [1/9] " Kalle Valo
2017-01-06 13:05 ` [PATCH 2/9] rt2800: increase TX timeout Stanislaw Gruszka
2017-01-06 15:15   ` Felix Fietkau
2017-01-06 15:34     ` Stanislaw Gruszka
2017-01-06 13:05 ` [PATCH 3/9] rt2x00: save conf settings before reset tuner Stanislaw Gruszka
2017-01-06 13:05 ` [PATCH 4/9] rt2800: change default retry settings Stanislaw Gruszka
2017-01-06 13:05 ` [PATCH 5/9] rt2800: tune TX_RTS_CFG config Stanislaw Gruszka
2017-01-06 13:05 ` [PATCH 6/9] rt2800: fallback from mcs8 to mcs7 Stanislaw Gruszka
2017-01-12 11:10   ` Felix Fietkau
2017-01-13  9:09     ` Stanislaw Gruszka
2017-01-13 10:11   ` [6/9] " Kalle Valo
2017-01-06 13:05 ` [PATCH 7/9] rt2800usb: mark tx failure on timeout Stanislaw Gruszka
2017-01-06 13:05 ` [PATCH 8/9] rt2x00: do not flush empty queue Stanislaw Gruszka
2017-01-06 13:05 ` [PATCH 9/9] rt2800: set max_psdu to 3 on usb devices Stanislaw Gruszka

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.