mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: add support for an extra wiphy in the main tx path
This is preparation for supporting multiple wiphys per device to support the concurrent dual-band feature of MT7615D Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
@@ -245,9 +245,10 @@ 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,
|
||||
mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
|
||||
struct mt76_wcid *wcid, struct sk_buff *skb)
|
||||
{
|
||||
struct mt76_dev *dev = phy->dev;
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||
struct mt76_queue *q;
|
||||
@@ -282,7 +283,7 @@ mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta,
|
||||
dev->queue_ops->kick(dev, q);
|
||||
|
||||
if (q->queued > q->ndesc - 8 && !q->stopped) {
|
||||
ieee80211_stop_queue(dev->hw, skb_get_queue_mapping(skb));
|
||||
ieee80211_stop_queue(phy->hw, skb_get_queue_mapping(skb));
|
||||
q->stopped = true;
|
||||
}
|
||||
|
||||
@@ -291,7 +292,7 @@ mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta,
|
||||
EXPORT_SYMBOL_GPL(mt76_tx);
|
||||
|
||||
static struct sk_buff *
|
||||
mt76_txq_dequeue(struct mt76_dev *dev, struct mt76_txq *mtxq, bool ps)
|
||||
mt76_txq_dequeue(struct mt76_phy *phy, struct mt76_txq *mtxq, bool ps)
|
||||
{
|
||||
struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
|
||||
struct sk_buff *skb;
|
||||
@@ -306,7 +307,7 @@ mt76_txq_dequeue(struct mt76_dev *dev, struct mt76_txq *mtxq, bool ps)
|
||||
return skb;
|
||||
}
|
||||
|
||||
skb = ieee80211_tx_dequeue(dev->hw, txq);
|
||||
skb = ieee80211_tx_dequeue(phy->hw, txq);
|
||||
if (!skb)
|
||||
return NULL;
|
||||
|
||||
@@ -335,7 +336,8 @@ mt76_release_buffered_frames(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
|
||||
enum ieee80211_frame_release_type reason,
|
||||
bool more_data)
|
||||
{
|
||||
struct mt76_dev *dev = hw->priv;
|
||||
struct mt76_phy *phy = hw->priv;
|
||||
struct mt76_dev *dev = phy->dev;
|
||||
struct sk_buff *last_skb = NULL;
|
||||
struct mt76_queue *hwq = dev->q_tx[MT_TXQ_PSD].q;
|
||||
int i;
|
||||
@@ -350,7 +352,7 @@ mt76_release_buffered_frames(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
|
||||
continue;
|
||||
|
||||
do {
|
||||
skb = mt76_txq_dequeue(dev, mtxq, true);
|
||||
skb = mt76_txq_dequeue(phy, mtxq, true);
|
||||
if (!skb)
|
||||
break;
|
||||
|
||||
@@ -377,9 +379,10 @@ mt76_release_buffered_frames(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
|
||||
EXPORT_SYMBOL_GPL(mt76_release_buffered_frames);
|
||||
|
||||
static int
|
||||
mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
|
||||
mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_sw_queue *sq,
|
||||
struct mt76_txq *mtxq)
|
||||
{
|
||||
struct mt76_dev *dev = phy->dev;
|
||||
struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
|
||||
enum mt76_txq_id qid = mt76_txq_get_qid(txq);
|
||||
struct mt76_wcid *wcid = mtxq->wcid;
|
||||
@@ -395,7 +398,7 @@ mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
|
||||
if (test_bit(MT_WCID_FLAG_PS, &wcid->flags))
|
||||
return 0;
|
||||
|
||||
skb = mt76_txq_dequeue(dev, mtxq, false);
|
||||
skb = mt76_txq_dequeue(phy, mtxq, false);
|
||||
if (!skb)
|
||||
return 0;
|
||||
|
||||
@@ -426,7 +429,7 @@ mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
|
||||
if (test_bit(MT76_RESET, &dev->state))
|
||||
return -EBUSY;
|
||||
|
||||
skb = mt76_txq_dequeue(dev, mtxq, false);
|
||||
skb = mt76_txq_dequeue(phy, mtxq, false);
|
||||
if (!skb)
|
||||
break;
|
||||
|
||||
@@ -464,8 +467,9 @@ mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_sw_queue *sq,
|
||||
}
|
||||
|
||||
static int
|
||||
mt76_txq_schedule_list(struct mt76_dev *dev, enum mt76_txq_id qid)
|
||||
mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
|
||||
{
|
||||
struct mt76_dev *dev = phy->dev;
|
||||
struct mt76_sw_queue *sq = &dev->q_tx[qid];
|
||||
struct mt76_queue *hwq = sq->q;
|
||||
struct ieee80211_txq *txq;
|
||||
@@ -483,7 +487,7 @@ mt76_txq_schedule_list(struct mt76_dev *dev, enum mt76_txq_id qid)
|
||||
break;
|
||||
}
|
||||
|
||||
txq = ieee80211_next_txq(dev->hw, qid);
|
||||
txq = ieee80211_next_txq(phy->hw, qid);
|
||||
if (!txq)
|
||||
break;
|
||||
|
||||
@@ -505,8 +509,8 @@ 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);
|
||||
ieee80211_return_txq(dev->hw, txq,
|
||||
ret += mt76_txq_send_burst(phy, sq, mtxq);
|
||||
ieee80211_return_txq(phy->hw, txq,
|
||||
!skb_queue_empty(&mtxq->retry_q));
|
||||
}
|
||||
spin_unlock_bh(&hwq->lock);
|
||||
@@ -514,8 +518,9 @@ mt76_txq_schedule_list(struct mt76_dev *dev, enum mt76_txq_id qid)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void mt76_txq_schedule(struct mt76_dev *dev, enum mt76_txq_id qid)
|
||||
void mt76_txq_schedule(struct mt76_phy *phy, enum mt76_txq_id qid)
|
||||
{
|
||||
struct mt76_dev *dev = phy->dev;
|
||||
struct mt76_sw_queue *sq = &dev->q_tx[qid];
|
||||
int len;
|
||||
|
||||
@@ -528,21 +533,21 @@ void mt76_txq_schedule(struct mt76_dev *dev, enum mt76_txq_id qid)
|
||||
rcu_read_lock();
|
||||
|
||||
do {
|
||||
ieee80211_txq_schedule_start(dev->hw, qid);
|
||||
len = mt76_txq_schedule_list(dev, qid);
|
||||
ieee80211_txq_schedule_end(dev->hw, qid);
|
||||
ieee80211_txq_schedule_start(phy->hw, qid);
|
||||
len = mt76_txq_schedule_list(phy, qid);
|
||||
ieee80211_txq_schedule_end(phy->hw, qid);
|
||||
} while (len > 0);
|
||||
|
||||
rcu_read_unlock();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_txq_schedule);
|
||||
|
||||
void mt76_txq_schedule_all(struct mt76_dev *dev)
|
||||
void mt76_txq_schedule_all(struct mt76_phy *phy)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= MT_TXQ_BK; i++)
|
||||
mt76_txq_schedule(dev, i);
|
||||
mt76_txq_schedule(phy, i);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_txq_schedule_all);
|
||||
|
||||
@@ -550,7 +555,9 @@ void mt76_tx_tasklet(unsigned long data)
|
||||
{
|
||||
struct mt76_dev *dev = (struct mt76_dev *)data;
|
||||
|
||||
mt76_txq_schedule_all(dev);
|
||||
mt76_txq_schedule_all(&dev->phy);
|
||||
if (dev->phy2)
|
||||
mt76_txq_schedule_all(dev->phy2);
|
||||
}
|
||||
|
||||
void mt76_stop_tx_queues(struct mt76_dev *dev, struct ieee80211_sta *sta,
|
||||
@@ -578,7 +585,8 @@ EXPORT_SYMBOL_GPL(mt76_stop_tx_queues);
|
||||
|
||||
void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
|
||||
{
|
||||
struct mt76_dev *dev = hw->priv;
|
||||
struct mt76_phy *phy = hw->priv;
|
||||
struct mt76_dev *dev = phy->dev;
|
||||
|
||||
if (!test_bit(MT76_STATE_RUNNING, &dev->state))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user