All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] rt2x00: call sta_add/remove directly in rt2800
@ 2018-04-30 13:19 Stanislaw Gruszka
  2018-04-30 13:19 ` [PATCH 2/2] rt2x00: check against flushing empty queue Stanislaw Gruszka
  2018-05-04 12:35 ` [1/2] rt2x00: call sta_add/remove directly in rt2800 Kalle Valo
  0 siblings, 2 replies; 6+ messages in thread
From: Stanislaw Gruszka @ 2018-04-30 13:19 UTC (permalink / raw)
  To: linux-wireless; +Cc: Stanislaw Gruszka

Only rt2800 subdriver of rt2x00 implement sta_add() and sta_remove(),
we do not need generic version of those.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 11 +++++++----
 drivers/net/wireless/ralink/rt2x00/rt2800lib.h |  5 +++--
 drivers/net/wireless/ralink/rt2x00/rt2800pci.c |  6 ++----
 drivers/net/wireless/ralink/rt2x00/rt2800soc.c |  6 ++----
 drivers/net/wireless/ralink/rt2x00/rt2800usb.c |  6 ++----
 drivers/net/wireless/ralink/rt2x00/rt2x00.h    |  4 ----
 6 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index e827dc522580..a567bc273ffc 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -1557,12 +1557,13 @@ static void rt2800_set_max_psdu_len(struct rt2x00_dev *rt2x00dev)
 	rt2800_register_write(rt2x00dev, MAX_LEN_CFG, reg);
 }
 
-int rt2800_sta_add(struct rt2x00_dev *rt2x00dev, struct ieee80211_vif *vif,
+int rt2800_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		   struct ieee80211_sta *sta)
 {
-	int wcid;
-	struct rt2x00_sta *sta_priv = sta_to_rt2x00_sta(sta);
+	struct rt2x00_dev *rt2x00dev = hw->priv;
 	struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
+	struct rt2x00_sta *sta_priv = sta_to_rt2x00_sta(sta);
+	int wcid;
 
 	/*
 	 * Limit global maximum TX AMPDU length to smallest value of all
@@ -1608,8 +1609,10 @@ int rt2800_sta_add(struct rt2x00_dev *rt2x00dev, struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL_GPL(rt2800_sta_add);
 
-int rt2800_sta_remove(struct rt2x00_dev *rt2x00dev, struct ieee80211_sta *sta)
+int rt2800_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+		      struct ieee80211_sta *sta)
 {
+	struct rt2x00_dev *rt2x00dev = hw->priv;
 	struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
 	struct rt2x00_sta *sta_priv = sta_to_rt2x00_sta(sta);
 	int wcid = sta_priv->wcid;
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
index 275e3969abdd..51d9c2a932cc 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
@@ -208,9 +208,10 @@ int rt2800_config_shared_key(struct rt2x00_dev *rt2x00dev,
 int rt2800_config_pairwise_key(struct rt2x00_dev *rt2x00dev,
 			       struct rt2x00lib_crypto *crypto,
 			       struct ieee80211_key_conf *key);
-int rt2800_sta_add(struct rt2x00_dev *rt2x00dev, struct ieee80211_vif *vif,
+int rt2800_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		   struct ieee80211_sta *sta);
-int rt2800_sta_remove(struct rt2x00_dev *rt2x00dev, struct ieee80211_sta *sta);
+int rt2800_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+		      struct ieee80211_sta *sta);
 void rt2800_config_filter(struct rt2x00_dev *rt2x00dev,
 			  const unsigned int filter_flags);
 void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf,
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
index 1172eefd1c1a..71b1affc3885 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
@@ -311,8 +311,8 @@ static int rt2800pci_read_eeprom(struct rt2x00_dev *rt2x00dev)
 	.get_stats		= rt2x00mac_get_stats,
 	.get_key_seq		= rt2800_get_key_seq,
 	.set_rts_threshold	= rt2800_set_rts_threshold,
-	.sta_add		= rt2x00mac_sta_add,
-	.sta_remove		= rt2x00mac_sta_remove,
+	.sta_add		= rt2800_sta_add,
+	.sta_remove		= rt2800_sta_remove,
 	.bss_info_changed	= rt2x00mac_bss_info_changed,
 	.conf_tx		= rt2800_conf_tx,
 	.get_tsf		= rt2800_get_tsf,
@@ -377,8 +377,6 @@ static int rt2800pci_read_eeprom(struct rt2x00_dev *rt2x00dev)
 	.config_erp		= rt2800_config_erp,
 	.config_ant		= rt2800_config_ant,
 	.config			= rt2800_config,
-	.sta_add		= rt2800_sta_add,
-	.sta_remove		= rt2800_sta_remove,
 };
 
 static const struct rt2x00_ops rt2800pci_ops = {
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
index 6848ebc83534..a502816214ab 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
@@ -150,8 +150,8 @@ static int rt2800soc_write_firmware(struct rt2x00_dev *rt2x00dev,
 	.get_stats		= rt2x00mac_get_stats,
 	.get_key_seq		= rt2800_get_key_seq,
 	.set_rts_threshold	= rt2800_set_rts_threshold,
-	.sta_add		= rt2x00mac_sta_add,
-	.sta_remove		= rt2x00mac_sta_remove,
+	.sta_add		= rt2800_sta_add,
+	.sta_remove		= rt2800_sta_remove,
 	.bss_info_changed	= rt2x00mac_bss_info_changed,
 	.conf_tx		= rt2800_conf_tx,
 	.get_tsf		= rt2800_get_tsf,
@@ -216,8 +216,6 @@ static int rt2800soc_write_firmware(struct rt2x00_dev *rt2x00dev,
 	.config_erp		= rt2800_config_erp,
 	.config_ant		= rt2800_config_ant,
 	.config			= rt2800_config,
-	.sta_add		= rt2800_sta_add,
-	.sta_remove		= rt2800_sta_remove,
 };
 
 static const struct rt2x00_ops rt2800soc_ops = {
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
index d901a41d36e4..98a7313fea4a 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
@@ -797,8 +797,8 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
 	.get_stats		= rt2x00mac_get_stats,
 	.get_key_seq		= rt2800_get_key_seq,
 	.set_rts_threshold	= rt2800_set_rts_threshold,
-	.sta_add		= rt2x00mac_sta_add,
-	.sta_remove		= rt2x00mac_sta_remove,
+	.sta_add		= rt2800_sta_add,
+	.sta_remove		= rt2800_sta_remove,
 	.bss_info_changed	= rt2x00mac_bss_info_changed,
 	.conf_tx		= rt2800_conf_tx,
 	.get_tsf		= rt2800_get_tsf,
@@ -858,8 +858,6 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
 	.config_erp		= rt2800_config_erp,
 	.config_ant		= rt2800_config_ant,
 	.config			= rt2800_config,
-	.sta_add		= rt2800_sta_add,
-	.sta_remove		= rt2800_sta_remove,
 };
 
 static void rt2800usb_queue_init(struct data_queue *queue)
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
index 1f38c338ca7a..a279a4363bc1 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
@@ -1457,10 +1457,6 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 #else
 #define rt2x00mac_set_key	NULL
 #endif /* CONFIG_RT2X00_LIB_CRYPTO */
-int rt2x00mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-		      struct ieee80211_sta *sta);
-int rt2x00mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-			 struct ieee80211_sta *sta);
 void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw,
 			     struct ieee80211_vif *vif,
 			     const u8 *mac_addr);
-- 
1.9.3

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

* [PATCH 2/2] rt2x00: check against flushing empty queue
  2018-04-30 13:19 [PATCH 1/2] rt2x00: call sta_add/remove directly in rt2800 Stanislaw Gruszka
@ 2018-04-30 13:19 ` Stanislaw Gruszka
       [not found]   ` <CAOt++SdXt6YQKDZEdNxxEQOZ+sHyw2xjdUQm1DTGWdff-faJUw@mail.gmail.com>
  2018-05-04 12:35 ` [1/2] rt2x00: call sta_add/remove directly in rt2800 Kalle Valo
  1 sibling, 1 reply; 6+ messages in thread
From: Stanislaw Gruszka @ 2018-04-30 13:19 UTC (permalink / raw)
  To: linux-wireless; +Cc: Stanislaw Gruszka

We have check if queue is not empty when start flushing queues on
by mac80211 callback, but we also can start flushing queues by internal
driver calls. So move check into rt2x00queue_flush_queue() to assure
we do not flush empty queue anytime.

Additionally add warning if we start to kick empty queue as in such
situation we set wrong index in the HW queue, what can confuse the HW
and have various negative consequences.

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

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
index 1123e2bed803..e1a7ed7e4892 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
@@ -600,6 +600,7 @@ void rt2800mmio_kick_queue(struct data_queue *queue)
 	case QID_AC_VI:
 	case QID_AC_BE:
 	case QID_AC_BK:
+		WARN_ON_ONCE(rt2x00queue_empty(queue));
 		entry = rt2x00queue_get_entry(queue, Q_INDEX);
 		rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX(queue->qid),
 					  entry->entry_idx);
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
index a971bc7a6b63..c380c1f56ba6 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
@@ -739,8 +739,7 @@ void rt2x00mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		return;
 
 	tx_queue_for_each(rt2x00dev, queue)
-		if (!rt2x00queue_empty(queue))
-			rt2x00queue_flush_queue(queue, drop);
+		rt2x00queue_flush_queue(queue, drop);
 }
 EXPORT_SYMBOL_GPL(rt2x00mac_flush);
 
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
index a6884e73d2ab..7c1f8f561d4a 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
@@ -1000,6 +1000,8 @@ void rt2x00queue_flush_queue(struct data_queue *queue, bool drop)
 		(queue->qid == QID_AC_BE) ||
 		(queue->qid == QID_AC_BK);
 
+	if (rt2x00queue_empty(queue))
+		return;
 
 	/*
 	 * If we are not supposed to drop any pending
-- 
1.9.3

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

* Re: [PATCH 2/2] rt2x00: check against flushing empty queue
       [not found]   ` <CAOt++SdXt6YQKDZEdNxxEQOZ+sHyw2xjdUQm1DTGWdff-faJUw@mail.gmail.com>
@ 2018-05-02  9:39     ` Stanislaw Gruszka
  2018-06-20 16:22       ` Tom Psyborg
  0 siblings, 1 reply; 6+ messages in thread
From: Stanislaw Gruszka @ 2018-05-02  9:39 UTC (permalink / raw)
  To: Kofi Agor; +Cc: linux-wireless

Hi

On Tue, May 01, 2018 at 06:27:17AM -0600, Kofi Agor wrote:
> I haven't had a chance to test your patch yet, but does it resolve the tx
> queue flush issues? What platform are you developing/testing on?

I'm not sure about the issue, but most likely the patch
does not fix it. I tested the patch on RT3062 pcie device an
RT3071 usb dongle.

Regards
Stanislaw

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

* Re: [1/2] rt2x00: call sta_add/remove directly in rt2800
  2018-04-30 13:19 [PATCH 1/2] rt2x00: call sta_add/remove directly in rt2800 Stanislaw Gruszka
  2018-04-30 13:19 ` [PATCH 2/2] rt2x00: check against flushing empty queue Stanislaw Gruszka
@ 2018-05-04 12:35 ` Kalle Valo
  1 sibling, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2018-05-04 12:35 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: linux-wireless, Stanislaw Gruszka

Stanislaw Gruszka <sgruszka@redhat.com> wrote:

> Only rt2800 subdriver of rt2x00 implement sta_add() and sta_remove(),
> we do not need generic version of those.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>

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

9c87758cf089 rt2x00: call sta_add/remove directly in rt2800
811a39915107 rt2x00: check against flushing empty queue

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

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

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

* Re: [PATCH 2/2] rt2x00: check against flushing empty queue
  2018-05-02  9:39     ` Stanislaw Gruszka
@ 2018-06-20 16:22       ` Tom Psyborg
  2018-06-20 16:41         ` Stanislaw Gruszka
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Psyborg @ 2018-06-20 16:22 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: Kofi Agor, linux-wireless

does it fix mt7620 bug?

On 02/05/2018, Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> Hi
>
> On Tue, May 01, 2018 at 06:27:17AM -0600, Kofi Agor wrote:
>> I haven't had a chance to test your patch yet, but does it resolve the tx
>> queue flush issues? What platform are you developing/testing on?
>
> I'm not sure about the issue, but most likely the patch
> does not fix it. I tested the patch on RT3062 pcie device an
> RT3071 usb dongle.
>
> Regards
> Stanislaw
>

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

* Re: [PATCH 2/2] rt2x00: check against flushing empty queue
  2018-06-20 16:22       ` Tom Psyborg
@ 2018-06-20 16:41         ` Stanislaw Gruszka
  0 siblings, 0 replies; 6+ messages in thread
From: Stanislaw Gruszka @ 2018-06-20 16:41 UTC (permalink / raw)
  To: Tom Psyborg; +Cc: Kofi Agor, linux-wireless

On Wed, Jun 20, 2018 at 06:22:45PM +0200, Tom Psyborg wrote:
> does it fix mt7620 bug?

It is possible that patch fixes some bug that happen also on mt7620,
but is was not that I found a reproducible bug and patch fixed it.

Stanislaw

> On 02/05/2018, Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> > Hi
> >
> > On Tue, May 01, 2018 at 06:27:17AM -0600, Kofi Agor wrote:
> >> I haven't had a chance to test your patch yet, but does it resolve the tx
> >> queue flush issues? What platform are you developing/testing on?
> >
> > I'm not sure about the issue, but most likely the patch
> > does not fix it. I tested the patch on RT3062 pcie device an
> > RT3071 usb dongle.
> >
> > Regards
> > Stanislaw
> >

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

end of thread, other threads:[~2018-06-20 16:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-30 13:19 [PATCH 1/2] rt2x00: call sta_add/remove directly in rt2800 Stanislaw Gruszka
2018-04-30 13:19 ` [PATCH 2/2] rt2x00: check against flushing empty queue Stanislaw Gruszka
     [not found]   ` <CAOt++SdXt6YQKDZEdNxxEQOZ+sHyw2xjdUQm1DTGWdff-faJUw@mail.gmail.com>
2018-05-02  9:39     ` Stanislaw Gruszka
2018-06-20 16:22       ` Tom Psyborg
2018-06-20 16:41         ` Stanislaw Gruszka
2018-05-04 12:35 ` [1/2] rt2x00: call sta_add/remove directly in rt2800 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.