linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt76: remove empty flag in mt76_txq_schedule_list
@ 2019-08-22  9:49 Lorenzo Bianconi
  2019-08-22 10:36 ` Stanislaw Gruszka
  0 siblings, 1 reply; 5+ messages in thread
From: Lorenzo Bianconi @ 2019-08-22  9:49 UTC (permalink / raw)
  To: nbd; +Cc: lorenzo.bianconi, linux-wireless, sgruszka

Remove empty flag in mt76_txq_schedule_list and mt76_txq_send_burst
since we just need retry_q length to notify mac80211 to reschedule the
current tx queue

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/tx.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
index d7982aa83c11..51d69329ed06 100644
--- a/drivers/net/wireless/mediatek/mt76/tx.c
+++ b/drivers/net/wireless/mediatek/mt76/tx.c
@@ -378,7 +378,7 @@ EXPORT_SYMBOL_GPL(mt76_release_buffered_frames);
 
 static int
 mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
-		    struct mt76_txq *mtxq, bool *empty)
+		    struct mt76_txq *mtxq)
 {
 	struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
 	enum mt76_txq_id qid = mt76_txq_get_qid(txq);
@@ -392,16 +392,12 @@ mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
 	bool probe;
 	int idx;
 
-	if (test_bit(MT_WCID_FLAG_PS, &wcid->flags)) {
-		*empty = true;
+	if (test_bit(MT_WCID_FLAG_PS, &wcid->flags))
 		return 0;
-	}
 
 	skb = mt76_txq_dequeue(dev, mtxq, false);
-	if (!skb) {
-		*empty = true;
+	if (!skb)
 		return 0;
-	}
 
 	info = IEEE80211_SKB_CB(skb);
 	if (!(wcid->tx_info & MT_WCID_TX_INFO_SET))
@@ -432,10 +428,8 @@ mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
 			return -EBUSY;
 
 		skb = mt76_txq_dequeue(dev, mtxq, false);
-		if (!skb) {
-			*empty = true;
+		if (!skb)
 			break;
-		}
 
 		info = IEEE80211_SKB_CB(skb);
 		cur_ampdu = info->flags & IEEE80211_TX_CTL_AMPDU;
@@ -482,8 +476,6 @@ mt76_txq_schedule_list(struct mt76_dev *dev, enum mt76_txq_id qid)
 
 	spin_lock_bh(&hwq->lock);
 	while (1) {
-		bool empty = false;
-
 		if (sq->swq_queued >= 4)
 			break;
 
@@ -515,10 +507,9 @@ mt76_txq_schedule_list(struct mt76_dev *dev, enum mt76_txq_id qid)
 			spin_lock_bh(&hwq->lock);
 		}
 
-		ret += mt76_txq_send_burst(dev, sq, mtxq, &empty);
-		if (skb_queue_empty(&mtxq->retry_q))
-			empty = true;
-		ieee80211_return_txq(dev->hw, txq, !empty);
+		ret += mt76_txq_send_burst(dev, sq, mtxq);
+		ieee80211_return_txq(dev->hw, txq,
+				     !skb_queue_empty(&mtxq->retry_q));
 	}
 	spin_unlock_bh(&hwq->lock);
 
-- 
2.21.0


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

* Re: [PATCH] mt76: remove empty flag in mt76_txq_schedule_list
  2019-08-22  9:49 [PATCH] mt76: remove empty flag in mt76_txq_schedule_list Lorenzo Bianconi
@ 2019-08-22 10:36 ` Stanislaw Gruszka
  2019-08-22 11:50   ` Lorenzo Bianconi
  0 siblings, 1 reply; 5+ messages in thread
From: Stanislaw Gruszka @ 2019-08-22 10:36 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: nbd, lorenzo.bianconi, linux-wireless

On Thu, Aug 22, 2019 at 11:49:10AM +0200, Lorenzo Bianconi wrote:
> Remove empty flag in mt76_txq_schedule_list and mt76_txq_send_burst
> since we just need retry_q length to notify mac80211 to reschedule the
> current tx queue
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  drivers/net/wireless/mediatek/mt76/tx.c | 23 +++++++----------------
>  1 file changed, 7 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
> index d7982aa83c11..51d69329ed06 100644
> --- a/drivers/net/wireless/mediatek/mt76/tx.c
> +++ b/drivers/net/wireless/mediatek/mt76/tx.c
> @@ -378,7 +378,7 @@ EXPORT_SYMBOL_GPL(mt76_release_buffered_frames);
>  
>  static int
>  mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
> -		    struct mt76_txq *mtxq, bool *empty)
> +		    struct mt76_txq *mtxq)
>  {
>  	struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
>  	enum mt76_txq_id qid = mt76_txq_get_qid(txq);
> @@ -392,16 +392,12 @@ mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
>  	bool probe;
>  	int idx;
>  
> -	if (test_bit(MT_WCID_FLAG_PS, &wcid->flags)) {
> -		*empty = true;
> +	if (test_bit(MT_WCID_FLAG_PS, &wcid->flags))
>  		return 0;

This changes behaviour for station in PS state. If retry_q is not
empty, now we will be rescheduling tx queue for STA in PS mode.
Not sure if this is problem or not, though.

Stanislaw

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

* Re: [PATCH] mt76: remove empty flag in mt76_txq_schedule_list
  2019-08-22 10:36 ` Stanislaw Gruszka
@ 2019-08-22 11:50   ` Lorenzo Bianconi
  2019-08-22 12:37     ` Stanislaw Gruszka
  0 siblings, 1 reply; 5+ messages in thread
From: Lorenzo Bianconi @ 2019-08-22 11:50 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: nbd, lorenzo.bianconi, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1707 bytes --]

> On Thu, Aug 22, 2019 at 11:49:10AM +0200, Lorenzo Bianconi wrote:
> > Remove empty flag in mt76_txq_schedule_list and mt76_txq_send_burst
> > since we just need retry_q length to notify mac80211 to reschedule the
> > current tx queue
> > 
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > ---
> >  drivers/net/wireless/mediatek/mt76/tx.c | 23 +++++++----------------
> >  1 file changed, 7 insertions(+), 16 deletions(-)
> > 
> > diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
> > index d7982aa83c11..51d69329ed06 100644
> > --- a/drivers/net/wireless/mediatek/mt76/tx.c
> > +++ b/drivers/net/wireless/mediatek/mt76/tx.c
> > @@ -378,7 +378,7 @@ EXPORT_SYMBOL_GPL(mt76_release_buffered_frames);
> >  
> >  static int
> >  mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
> > -		    struct mt76_txq *mtxq, bool *empty)
> > +		    struct mt76_txq *mtxq)
> >  {
> >  	struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
> >  	enum mt76_txq_id qid = mt76_txq_get_qid(txq);
> > @@ -392,16 +392,12 @@ mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
> >  	bool probe;
> >  	int idx;
> >  
> > -	if (test_bit(MT_WCID_FLAG_PS, &wcid->flags)) {
> > -		*empty = true;
> > +	if (test_bit(MT_WCID_FLAG_PS, &wcid->flags))
> >  		return 0;
> 
> This changes behaviour for station in PS state. If retry_q is not
> empty, now we will be rescheduling tx queue for STA in PS mode.
> Not sure if this is problem or not, though.

good point..looking at the code it seems not a issue since we will not actually
tx frames for PS stations. What do you think?

Regards,
Lorenzo

> 
> Stanislaw

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH] mt76: remove empty flag in mt76_txq_schedule_list
  2019-08-22 11:50   ` Lorenzo Bianconi
@ 2019-08-22 12:37     ` Stanislaw Gruszka
  2019-08-22 12:44       ` Lorenzo Bianconi
  0 siblings, 1 reply; 5+ messages in thread
From: Stanislaw Gruszka @ 2019-08-22 12:37 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: nbd, lorenzo.bianconi, linux-wireless

On Thu, Aug 22, 2019 at 01:50:52PM +0200, Lorenzo Bianconi wrote:
> > On Thu, Aug 22, 2019 at 11:49:10AM +0200, Lorenzo Bianconi wrote:
> > > Remove empty flag in mt76_txq_schedule_list and mt76_txq_send_burst
> > > since we just need retry_q length to notify mac80211 to reschedule the
> > > current tx queue
> > > 
> > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > > ---
> > >  drivers/net/wireless/mediatek/mt76/tx.c | 23 +++++++----------------
> > >  1 file changed, 7 insertions(+), 16 deletions(-)
> > > 
> > > diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
> > > index d7982aa83c11..51d69329ed06 100644
> > > --- a/drivers/net/wireless/mediatek/mt76/tx.c
> > > +++ b/drivers/net/wireless/mediatek/mt76/tx.c
> > > @@ -378,7 +378,7 @@ EXPORT_SYMBOL_GPL(mt76_release_buffered_frames);
> > >  
> > >  static int
> > >  mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
> > > -		    struct mt76_txq *mtxq, bool *empty)
> > > +		    struct mt76_txq *mtxq)
> > >  {
> > >  	struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
> > >  	enum mt76_txq_id qid = mt76_txq_get_qid(txq);
> > > @@ -392,16 +392,12 @@ mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
> > >  	bool probe;
> > >  	int idx;
> > >  
> > > -	if (test_bit(MT_WCID_FLAG_PS, &wcid->flags)) {
> > > -		*empty = true;
> > > +	if (test_bit(MT_WCID_FLAG_PS, &wcid->flags))
> > >  		return 0;
> > 
> > This changes behaviour for station in PS state. If retry_q is not
> > empty, now we will be rescheduling tx queue for STA in PS mode.
> > Not sure if this is problem or not, though.
> 
> good point..looking at the code it seems not a issue since we will not actually
> tx frames for PS stations. What do you think?

I do not see how changing this could possibly break things, but it 
was explicitly added by below commit, with changelog sugesting it is
needed:

commit d225581df3147060bc99e931b11f7cf2dcb1b2ca
Author: Felix Fietkau <nbd@nbd.name>
Date:   Mon Jan 21 17:33:38 2019 +0100

    mt76: avoid scheduling tx queues for powersave stations
    
    In case a tx queue wake call arrives after a client has transitioned to
    powersave, make sure that the queue is not kept active until the client
    has left powersave mode

Stanislaw

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

* Re: [PATCH] mt76: remove empty flag in mt76_txq_schedule_list
  2019-08-22 12:37     ` Stanislaw Gruszka
@ 2019-08-22 12:44       ` Lorenzo Bianconi
  0 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2019-08-22 12:44 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: Lorenzo Bianconi, nbd, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 2673 bytes --]

> On Thu, Aug 22, 2019 at 01:50:52PM +0200, Lorenzo Bianconi wrote:
> > > On Thu, Aug 22, 2019 at 11:49:10AM +0200, Lorenzo Bianconi wrote:
> > > > Remove empty flag in mt76_txq_schedule_list and mt76_txq_send_burst
> > > > since we just need retry_q length to notify mac80211 to reschedule the
> > > > current tx queue
> > > > 
> > > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > > > ---
> > > >  drivers/net/wireless/mediatek/mt76/tx.c | 23 +++++++----------------
> > > >  1 file changed, 7 insertions(+), 16 deletions(-)
> > > > 
> > > > diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
> > > > index d7982aa83c11..51d69329ed06 100644
> > > > --- a/drivers/net/wireless/mediatek/mt76/tx.c
> > > > +++ b/drivers/net/wireless/mediatek/mt76/tx.c
> > > > @@ -378,7 +378,7 @@ EXPORT_SYMBOL_GPL(mt76_release_buffered_frames);
> > > >  
> > > >  static int
> > > >  mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
> > > > -		    struct mt76_txq *mtxq, bool *empty)
> > > > +		    struct mt76_txq *mtxq)
> > > >  {
> > > >  	struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
> > > >  	enum mt76_txq_id qid = mt76_txq_get_qid(txq);
> > > > @@ -392,16 +392,12 @@ mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
> > > >  	bool probe;
> > > >  	int idx;
> > > >  
> > > > -	if (test_bit(MT_WCID_FLAG_PS, &wcid->flags)) {
> > > > -		*empty = true;
> > > > +	if (test_bit(MT_WCID_FLAG_PS, &wcid->flags))
> > > >  		return 0;
> > > 
> > > This changes behaviour for station in PS state. If retry_q is not
> > > empty, now we will be rescheduling tx queue for STA in PS mode.
> > > Not sure if this is problem or not, though.
> > 
> > good point..looking at the code it seems not a issue since we will not actually
> > tx frames for PS stations. What do you think?
> 
> I do not see how changing this could possibly break things, but it 
> was explicitly added by below commit, with changelog sugesting it is
> needed:
> 
> commit d225581df3147060bc99e931b11f7cf2dcb1b2ca
> Author: Felix Fietkau <nbd@nbd.name>
> Date:   Mon Jan 21 17:33:38 2019 +0100
> 
>     mt76: avoid scheduling tx queues for powersave stations
>     
>     In case a tx queue wake call arrives after a client has transitioned to
>     powersave, make sure that the queue is not kept active until the client
>     has left powersave mode
> 
> Stanislaw

This is exactly what I am saying, we need the 'if block' in mt76_txq_send_burst
in order to avoid scheduling tx queue for station in powersave but the empty
flag seems not necessary.

Regards,
Lorenzo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2019-08-22 12:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22  9:49 [PATCH] mt76: remove empty flag in mt76_txq_schedule_list Lorenzo Bianconi
2019-08-22 10:36 ` Stanislaw Gruszka
2019-08-22 11:50   ` Lorenzo Bianconi
2019-08-22 12:37     ` Stanislaw Gruszka
2019-08-22 12:44       ` Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).