linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 05/29] mt76: add support for an extra wiphy in the tx status path
Date: Sat, 30 Nov 2019 16:30:21 +0100	[thread overview]
Message-ID: <20191130153045.28105-5-nbd@nbd.name> (raw)
In-Reply-To: <20191130153045.28105-1-nbd@nbd.name>

This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/dma.c  |  4 +++-
 drivers/net/wireless/mediatek/mt76/mt76.h | 17 +++++++++++++
 drivers/net/wireless/mediatek/mt76/tx.c   | 29 +++++++++++++++++++----
 3 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index eed387b10d48..67d10099cb71 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -286,6 +286,7 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
 	struct mt76_tx_info tx_info = {
 		.skb = skb,
 	};
+	struct ieee80211_hw *hw;
 	int len, n = 0, ret = -ENOMEM;
 	struct mt76_queue_entry e;
 	struct mt76_txwi_cache *t;
@@ -295,7 +296,8 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
 
 	t = mt76_get_txwi(dev);
 	if (!t) {
-		ieee80211_free_txskb(dev->hw, skb);
+		hw = mt76_tx_status_get_hw(dev, skb);
+		ieee80211_free_txskb(hw, skb);
 		return -ENOMEM;
 	}
 	txwi = mt76_get_txwi_ptr(dev, t);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 4fd36b3e9440..4c0fe88155e5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -177,6 +177,9 @@ enum mt76_wcid_flags {
 
 #define MT76_N_WCIDS 128
 
+/* stored in ieee80211_tx_info::hw_queue */
+#define MT_TX_HW_QUEUE_EXT_PHY		BIT(7)
+
 DECLARE_EWMA(signal, 10, 8);
 
 #define MT_WCID_TX_INFO_RATE		GENMASK(15, 0)
@@ -793,6 +796,20 @@ u32 mt76_calc_tx_airtime(struct mt76_dev *dev, struct ieee80211_tx_info *info,
 			 int len);
 
 /* internal */
+static inline struct ieee80211_hw *
+mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
+{
+	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+	struct ieee80211_hw *hw = dev->phy.hw;
+
+	if ((info->hw_queue & MT_TX_HW_QUEUE_EXT_PHY) && dev->phy2)
+		hw = dev->phy2->hw;
+
+	info->hw_queue &= ~MT_TX_HW_QUEUE_EXT_PHY;
+
+	return hw;
+}
+
 void mt76_tx_free(struct mt76_dev *dev);
 struct mt76_txwi_cache *mt76_get_txwi(struct mt76_dev *dev);
 void mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);
diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
index d9fccbeff206..c993ad7ef2e3 100644
--- a/drivers/net/wireless/mediatek/mt76/tx.c
+++ b/drivers/net/wireless/mediatek/mt76/tx.c
@@ -109,13 +109,17 @@ void
 mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list)
 		      __releases(&dev->status_list.unlock)
 {
+	struct ieee80211_hw *hw;
 	struct sk_buff *skb;
 
 	spin_unlock_bh(&dev->status_list.lock);
 	__release(&dev->status_list.unlock);
 
-	while ((skb = __skb_dequeue(list)) != NULL)
-		ieee80211_tx_status(dev->hw, skb);
+	while ((skb = __skb_dequeue(list)) != NULL) {
+		hw = mt76_tx_status_get_hw(dev, skb);
+		ieee80211_tx_status(hw, skb);
+	}
+
 }
 EXPORT_SYMBOL_GPL(mt76_tx_status_unlock);
 
@@ -231,10 +235,12 @@ EXPORT_SYMBOL_GPL(mt76_tx_status_check);
 
 void mt76_tx_complete_skb(struct mt76_dev *dev, struct sk_buff *skb)
 {
+	struct ieee80211_hw *hw;
 	struct sk_buff_head list;
 
 	if (!skb->prev) {
-		ieee80211_free_txskb(dev->hw, skb);
+		hw = mt76_tx_status_get_hw(dev, skb);
+		ieee80211_free_txskb(hw, skb);
 		return;
 	}
 
@@ -253,6 +259,7 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	struct mt76_queue *q;
 	int qid = skb_get_queue_mapping(skb);
+	bool ext_phy = phy != &dev->phy;
 
 	if (WARN_ON(qid >= MT_TXQ_PSD)) {
 		qid = MT_TXQ_BE;
@@ -276,6 +283,9 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
 			mt76_check_agg_ssn(mtxq, skb);
 	}
 
+	if (ext_phy)
+		info->hw_queue |= MT_TX_HW_QUEUE_EXT_PHY;
+
 	q = dev->q_tx[qid].q;
 
 	spin_lock_bh(&q->lock);
@@ -295,6 +305,8 @@ static struct sk_buff *
 mt76_txq_dequeue(struct mt76_phy *phy, struct mt76_txq *mtxq, bool ps)
 {
 	struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
+	struct ieee80211_tx_info *info;
+	bool ext_phy = phy != &phy->dev->phy;
 	struct sk_buff *skb;
 
 	skb = skb_dequeue(&mtxq->retry_q);
@@ -311,6 +323,10 @@ mt76_txq_dequeue(struct mt76_phy *phy, struct mt76_txq *mtxq, bool ps)
 	if (!skb)
 		return NULL;
 
+	info = IEEE80211_SKB_CB(skb);
+	if (ext_phy)
+		info->hw_queue |= MT_TX_HW_QUEUE_EXT_PHY;
+
 	return skb;
 }
 
@@ -597,6 +613,7 @@ EXPORT_SYMBOL_GPL(mt76_wake_tx_queue);
 
 void mt76_txq_remove(struct mt76_dev *dev, struct ieee80211_txq *txq)
 {
+	struct ieee80211_hw *hw;
 	struct mt76_txq *mtxq;
 	struct sk_buff *skb;
 
@@ -605,8 +622,10 @@ void mt76_txq_remove(struct mt76_dev *dev, struct ieee80211_txq *txq)
 
 	mtxq = (struct mt76_txq *)txq->drv_priv;
 
-	while ((skb = skb_dequeue(&mtxq->retry_q)) != NULL)
-		ieee80211_free_txskb(dev->hw, skb);
+	while ((skb = skb_dequeue(&mtxq->retry_q)) != NULL) {
+		hw = mt76_tx_status_get_hw(dev, skb);
+		ieee80211_free_txskb(hw, skb);
+	}
 }
 EXPORT_SYMBOL_GPL(mt76_txq_remove);
 
-- 
2.24.0


  parent reply	other threads:[~2019-11-30 15:30 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-30 15:30 [PATCH 01/29] mt76: move initialization of some struct members to mt76_alloc_device Felix Fietkau
2019-11-30 15:30 ` [PATCH 02/29] mt76: introduce struct mt76_phy Felix Fietkau
2019-11-30 15:30 ` [PATCH 03/29] mt76: add support for an extra wiphy in the rx path Felix Fietkau
2019-11-30 15:30 ` [PATCH 04/29] mt76: add support for an extra wiphy in the main tx path Felix Fietkau
2019-11-30 15:30 ` Felix Fietkau [this message]
2019-11-30 15:30 ` [PATCH 06/29] mt76: add support for an extra wiphy in mt76_sta_state() Felix Fietkau
2019-11-30 15:30 ` [PATCH 07/29] mt76: move channel state to struct mt76_phy Felix Fietkau
2019-11-30 15:30 ` [PATCH 08/29] mt76: keep a set of software tx queues per phy Felix Fietkau
2019-11-30 15:30 ` [PATCH 09/29] mt76: move state from struct mt76_dev to mt76_phy Felix Fietkau
2019-11-30 15:30 ` [PATCH 10/29] mt76: move chainmask back to driver specific structs Felix Fietkau
2019-11-30 15:30 ` [PATCH 11/29] mt76: move txpower_conf " Felix Fietkau
2019-11-30 15:30 ` [PATCH 12/29] mt76: move txpower and antenna mask to struct mt76_phy Felix Fietkau
2019-11-30 15:30 ` [PATCH 13/29] mt76: add multiple wiphy support to mt76_get_min_avg_rssi Felix Fietkau
2019-11-30 15:30 ` [PATCH 14/29] mt76: add priv pointer to struct mt76_phy Felix Fietkau
2019-11-30 15:30 ` [PATCH 15/29] mt76: add function for allocating an external wiphy Felix Fietkau
2019-12-03 20:02   ` [PATCH v2 15/29] mt76: add function for allocating an extra wiphy Felix Fietkau
2019-11-30 15:30 ` [PATCH 16/29] mt76: add ext_phy field to struct mt76_wcid Felix Fietkau
2019-11-30 15:30 ` [PATCH 17/29] mt76: move ampdu_ref from mt76_dev to driver struct Felix Fietkau
2019-11-30 15:30 ` [PATCH 18/29] mt76: mt7615: add dual-phy support for mac80211 ops Felix Fietkau
2019-11-30 15:30 ` [PATCH 19/29] mt76: mt7615: add multiple wiphy support for smart carrier sense Felix Fietkau
2019-11-30 15:30 ` [PATCH 20/29] mt76: mt7615: add missing register init for dual-wiphy support Felix Fietkau
2019-11-30 15:30 ` [PATCH 21/29] mt76: mt7615: remove useless MT_HW_RDD0/1 enum Felix Fietkau
2019-11-30 15:30 ` [PATCH 22/29] mt76: mt7615: add multiple wiphy support to the dfs support code Felix Fietkau
2019-11-30 15:30 ` [PATCH 23/29] mt76: mt7615: rework chainmask handling Felix Fietkau
2019-11-30 15:30 ` [PATCH 24/29] mt76: mt7615: add multiple wiphy support to the rx path Felix Fietkau
2019-11-30 15:30 ` [PATCH 25/29] mt76: mt7615: initialize dbdc settings on interface add Felix Fietkau
2019-11-30 15:30 ` [PATCH 26/29] mt76: mt7615: move radio/mac initialization to .start/stop callbacks Felix Fietkau
2019-11-30 15:30 ` [PATCH 27/29] mt76: mt7615: select the correct tx queue for frames sent to the second phy Felix Fietkau
2019-11-30 15:30 ` [PATCH 28/29] mt76: mt7615: add support for registering a second wiphy via debugfs Felix Fietkau
2019-12-16 11:30   ` Kalle Valo
2020-01-20 11:03   ` [PATCH v2 " Felix Fietkau
2019-11-30 15:30 ` [PATCH 29/29] mt76: mt7615: update beacon contents on BSS_CHANGED_BEACON Felix Fietkau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191130153045.28105-5-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).