linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] remove qid dependency from mt76-core code
@ 2019-02-16 17:47 lorenzo
  2019-02-16 17:47 ` [PATCH 1/2] mt76: add qid parameter to mt76_tx signature lorenzo
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: lorenzo @ 2019-02-16 17:47 UTC (permalink / raw)
  To: nbd; +Cc: linux-wireless, sgruszka, ryder.lee, roychl666, Lorenzo Bianconi

From: Lorenzo Bianconi <lorenzo@kernel.org>

Move queue id dependency in driver specific tx queue initialization code
since new chipsets rely on a different tx queue enumeration scheme.
Add the possibility to specify qid in mt76_tx routine

Lorenzo Bianconi (2):
  mt76: add qid parameter to mt76_tx signature
  mt76: move txq qid dependency in driver specific code

 drivers/net/wireless/mediatek/mt76/mac80211.c | 27 +++++++++++-------
 drivers/net/wireless/mediatek/mt76/mt76.h     | 14 ++++++++--
 .../net/wireless/mediatek/mt76/mt76x02_txrx.c |  8 +++++-
 .../net/wireless/mediatek/mt76/mt76x02_util.c |  2 ++
 drivers/net/wireless/mediatek/mt76/tx.c       | 28 +++++--------------
 5 files changed, 45 insertions(+), 34 deletions(-)

-- 
2.20.1


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

* [PATCH 1/2] mt76: add qid parameter to mt76_tx signature
  2019-02-16 17:47 [PATCH 0/2] remove qid dependency from mt76-core code lorenzo
@ 2019-02-16 17:47 ` lorenzo
  2019-02-16 17:47 ` [PATCH 2/2] mt76: move txq qid dependency in driver specific code lorenzo
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: lorenzo @ 2019-02-16 17:47 UTC (permalink / raw)
  To: nbd; +Cc: linux-wireless, sgruszka, ryder.lee, roychl666, Lorenzo Bianconi

From: Lorenzo Bianconi <lorenzo@kernel.org>

Add queue id parameter to mt76_tx signature since new chipsets
rely on a different hw queue enumeration

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt76.h         |  2 +-
 drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c |  8 +++++++-
 drivers/net/wireless/mediatek/mt76/tx.c           | 12 +++---------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 13f6febc9b0f..53b85042b793 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -645,7 +645,7 @@ int mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
 
 void mt76_rx(struct mt76_dev *dev, enum mt76_rxq_id q, struct sk_buff *skb);
 void mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta,
-	     struct mt76_wcid *wcid, struct sk_buff *skb);
+	     struct mt76_wcid *wcid, struct sk_buff *skb, int qid);
 void mt76_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq);
 void mt76_txq_remove(struct mt76_dev *dev, struct ieee80211_txq *txq);
 void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c b/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c
index 94f47248c59f..fcabbd9c25f2 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c
@@ -26,6 +26,7 @@ void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
 	struct mt76x02_dev *dev = hw->priv;
 	struct ieee80211_vif *vif = info->control.vif;
 	struct mt76_wcid *wcid = &dev->mt76.global_wcid;
+	int qid = skb_get_queue_mapping(skb);
 
 	if (control->sta) {
 		struct mt76x02_sta *msta;
@@ -39,7 +40,12 @@ void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
 		wcid = &mvif->group_wcid;
 	}
 
-	mt76_tx(&dev->mt76, control->sta, wcid, skb);
+	if (WARN_ON(qid >= MT_TXQ_PSD)) {
+		qid = MT_TXQ_BE;
+		skb_set_queue_mapping(skb, qid);
+	}
+
+	mt76_tx(&dev->mt76, control->sta, wcid, skb, qid);
 }
 EXPORT_SYMBOL_GPL(mt76x02_tx);
 
diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
index ef38e8626da9..3617de2c1325 100644
--- a/drivers/net/wireless/mediatek/mt76/tx.c
+++ b/drivers/net/wireless/mediatek/mt76/tx.c
@@ -255,19 +255,13 @@ void mt76_tx_complete_skb(struct mt76_dev *dev, struct sk_buff *skb)
 }
 EXPORT_SYMBOL_GPL(mt76_tx_complete_skb);
 
-void
-mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta,
-	struct mt76_wcid *wcid, struct sk_buff *skb)
+void mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta,
+	     struct mt76_wcid *wcid, struct sk_buff *skb,
+	     int qid)
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 	struct mt76_queue *q;
-	int qid = skb_get_queue_mapping(skb);
-
-	if (WARN_ON(qid >= MT_TXQ_PSD)) {
-		qid = MT_TXQ_BE;
-		skb_set_queue_mapping(skb, qid);
-	}
 
 	if (!wcid->tx_rate_set)
 		ieee80211_get_tx_rates(info->control.vif, sta, skb,
-- 
2.20.1


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

* [PATCH 2/2] mt76: move txq qid dependency in driver specific code
  2019-02-16 17:47 [PATCH 0/2] remove qid dependency from mt76-core code lorenzo
  2019-02-16 17:47 ` [PATCH 1/2] mt76: add qid parameter to mt76_tx signature lorenzo
@ 2019-02-16 17:47 ` lorenzo
  2019-02-18  2:32 ` [PATCH 0/2] remove qid dependency from mt76-core code Ryder Lee
  2019-02-18 18:29 ` Felix Fietkau
  3 siblings, 0 replies; 5+ messages in thread
From: lorenzo @ 2019-02-16 17:47 UTC (permalink / raw)
  To: nbd; +Cc: linux-wireless, sgruszka, ryder.lee, roychl666, Lorenzo Bianconi

From: Lorenzo Bianconi <lorenzo@kernel.org>

Move queue id dependency in driver specific tx queue initialization code
since new chipsets rely on a different tx queue enumeration scheme
Introduce mt76_sta_init_tx_queue utility routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mac80211.c | 27 ++++++++++++-------
 drivers/net/wireless/mediatek/mt76/mt76.h     | 12 ++++++++-
 .../net/wireless/mediatek/mt76/mt76x02_util.c |  2 ++
 drivers/net/wireless/mediatek/mt76/tx.c       | 16 +++--------
 4 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index c7abf4f54867..3d25b625b8cc 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -644,20 +644,12 @@ void mt76_rx_poll_complete(struct mt76_dev *dev, enum mt76_rxq_id q,
 }
 EXPORT_SYMBOL_GPL(mt76_rx_poll_complete);
 
-static int
-mt76_sta_add(struct mt76_dev *dev, struct ieee80211_vif *vif,
-	     struct ieee80211_sta *sta)
+void mt76_sta_init_tx_queue(struct mt76_dev *dev,
+			    struct ieee80211_sta *sta)
 {
 	struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;
-	int ret;
 	int i;
 
-	mutex_lock(&dev->mutex);
-
-	ret = dev->drv->sta_add(dev, vif, sta);
-	if (ret)
-		goto out;
-
 	for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
 		struct mt76_txq *mtxq;
 
@@ -669,6 +661,21 @@ mt76_sta_add(struct mt76_dev *dev, struct ieee80211_vif *vif,
 
 		mt76_txq_init(dev, sta->txq[i]);
 	}
+}
+EXPORT_SYMBOL_GPL(mt76_sta_init_tx_queue);
+
+static int
+mt76_sta_add(struct mt76_dev *dev, struct ieee80211_vif *vif,
+	     struct ieee80211_sta *sta)
+{
+	struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;
+	int ret;
+
+	mutex_lock(&dev->mutex);
+
+	ret = dev->drv->sta_add(dev, vif, sta);
+	if (ret)
+		goto out;
 
 	ewma_signal_init(&wcid->rssi);
 	rcu_assign_pointer(dev->wcid[wcid->idx], wcid);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 53b85042b793..f6aab5ee782b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -639,6 +639,17 @@ static inline struct mt76_tx_cb *mt76_tx_skb_cb(struct sk_buff *skb)
 	return ((void *) IEEE80211_SKB_CB(skb)->status.status_driver_data);
 }
 
+void mt76_sta_init_tx_queue(struct mt76_dev *dev,
+			    struct ieee80211_sta *sta);
+void __mt76_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq, int qid);
+static inline void
+mt76_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq)
+{
+	int qid = txq->sta ? txq->ac : MT_TXQ_BE;
+
+	return __mt76_txq_init(dev, txq, qid);
+}
+
 int mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
 			  struct sk_buff *skb, struct mt76_wcid *wcid,
 			  struct ieee80211_sta *sta);
@@ -646,7 +657,6 @@ int mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
 void mt76_rx(struct mt76_dev *dev, enum mt76_rxq_id q, struct sk_buff *skb);
 void mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta,
 	     struct mt76_wcid *wcid, struct sk_buff *skb, int qid);
-void mt76_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq);
 void mt76_txq_remove(struct mt76_dev *dev, struct ieee80211_txq *txq);
 void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
 void mt76_stop_tx_queues(struct mt76_dev *dev, struct ieee80211_sta *sta,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
index 87ed00768bc7..c3a36519a942 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
@@ -251,6 +251,8 @@ int mt76x02_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
 	if (vif->type == NL80211_IFTYPE_AP)
 		set_bit(MT_WCID_FLAG_CHECK_PS, &msta->wcid.flags);
 
+	mt76_sta_init_tx_queue(mdev, sta);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(mt76x02_sta_add);
diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
index 3617de2c1325..142b12877a34 100644
--- a/drivers/net/wireless/mediatek/mt76/tx.c
+++ b/drivers/net/wireless/mediatek/mt76/tx.c
@@ -82,15 +82,6 @@ void mt76_tx_free(struct mt76_dev *dev)
 				 DMA_TO_DEVICE);
 }
 
-static int
-mt76_txq_get_qid(struct ieee80211_txq *txq)
-{
-	if (!txq->sta)
-		return MT_TXQ_BE;
-
-	return txq->ac;
-}
-
 static void
 mt76_check_agg_ssn(struct mt76_txq *mtxq, struct sk_buff *skb)
 {
@@ -604,16 +595,17 @@ void mt76_txq_remove(struct mt76_dev *dev, struct ieee80211_txq *txq)
 }
 EXPORT_SYMBOL_GPL(mt76_txq_remove);
 
-void mt76_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq)
+void __mt76_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq,
+		     int qid)
 {
 	struct mt76_txq *mtxq = (struct mt76_txq *) txq->drv_priv;
 
 	INIT_LIST_HEAD(&mtxq->list);
 	skb_queue_head_init(&mtxq->retry_q);
 
-	mtxq->hwq = &dev->q_tx[mt76_txq_get_qid(txq)];
+	mtxq->hwq = &dev->q_tx[qid];
 }
-EXPORT_SYMBOL_GPL(mt76_txq_init);
+EXPORT_SYMBOL_GPL(__mt76_txq_init);
 
 u8 mt76_ac_to_hwq(u8 ac)
 {
-- 
2.20.1


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

* Re: [PATCH 0/2] remove qid dependency from mt76-core code
  2019-02-16 17:47 [PATCH 0/2] remove qid dependency from mt76-core code lorenzo
  2019-02-16 17:47 ` [PATCH 1/2] mt76: add qid parameter to mt76_tx signature lorenzo
  2019-02-16 17:47 ` [PATCH 2/2] mt76: move txq qid dependency in driver specific code lorenzo
@ 2019-02-18  2:32 ` Ryder Lee
  2019-02-18 18:29 ` Felix Fietkau
  3 siblings, 0 replies; 5+ messages in thread
From: Ryder Lee @ 2019-02-18  2:32 UTC (permalink / raw)
  To: lorenzo; +Cc: nbd, linux-wireless, sgruszka, roychl666, linux-mediatek

On Sat, 2019-02-16 at 18:47 +0100, lorenzo@kernel.org wrote:
> From: Lorenzo Bianconi <lorenzo@kernel.org>
> 
> Move queue id dependency in driver specific tx queue initialization code
> since new chipsets rely on a different tx queue enumeration scheme.
> Add the possibility to specify qid in mt76_tx routine
> 
> Lorenzo Bianconi (2):
>   mt76: add qid parameter to mt76_tx signature
>   mt76: move txq qid dependency in driver specific code
> 
>  drivers/net/wireless/mediatek/mt76/mac80211.c | 27 +++++++++++-------
>  drivers/net/wireless/mediatek/mt76/mt76.h     | 14 ++++++++--
>  .../net/wireless/mediatek/mt76/mt76x02_txrx.c |  8 +++++-
>  .../net/wireless/mediatek/mt76/mt76x02_util.c |  2 ++
>  drivers/net/wireless/mediatek/mt76/tx.c       | 28 +++++--------------
>  5 files changed, 45 insertions(+), 34 deletions(-)
> 

Thanks. This will help us to develop the new chipsets more easily.

Acked-by: Ryder Lee <ryder.lee@mediatek.com>



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

* Re: [PATCH 0/2] remove qid dependency from mt76-core code
  2019-02-16 17:47 [PATCH 0/2] remove qid dependency from mt76-core code lorenzo
                   ` (2 preceding siblings ...)
  2019-02-18  2:32 ` [PATCH 0/2] remove qid dependency from mt76-core code Ryder Lee
@ 2019-02-18 18:29 ` Felix Fietkau
  3 siblings, 0 replies; 5+ messages in thread
From: Felix Fietkau @ 2019-02-18 18:29 UTC (permalink / raw)
  To: lorenzo; +Cc: linux-wireless, sgruszka, ryder.lee, roychl666

On 2019-02-16 18:47, lorenzo@kernel.org wrote:
> From: Lorenzo Bianconi <lorenzo@kernel.org>
> 
> Move queue id dependency in driver specific tx queue initialization code
> since new chipsets rely on a different tx queue enumeration scheme.
> Add the possibility to specify qid in mt76_tx routine
I've thought about this patch set some more, and I think we should take
a different approach.
If we simply map everything to the BE queue for MT7615, this breaks
per-AC scheduling of intermediate tx queues. Because outstanding packet
batches are currently tracked as part of the hardware queue, we can't
track them separately per AC in that case.

I would suggest the following approach instead.
- add a pointer to struct mt76_queue to make it possible to set a parent
queue
- add a queue identifier to struct mt76_queue_entry
- initialize only QID_AC_BE as a full hardware queue
- point all other data queues to QID_AC_BE
- use swq and swq_queued from the skb queue, all other fields (including
the lock) from the parent queue

Does that make sense?

- Felix

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

end of thread, other threads:[~2019-02-18 18:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-16 17:47 [PATCH 0/2] remove qid dependency from mt76-core code lorenzo
2019-02-16 17:47 ` [PATCH 1/2] mt76: add qid parameter to mt76_tx signature lorenzo
2019-02-16 17:47 ` [PATCH 2/2] mt76: move txq qid dependency in driver specific code lorenzo
2019-02-18  2:32 ` [PATCH 0/2] remove qid dependency from mt76-core code Ryder Lee
2019-02-18 18:29 ` Felix Fietkau

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