diff --git a/mt76.h b/mt76.h index fec350a7..27badb76 100644 --- a/mt76.h +++ b/mt76.h @@ -232,6 +232,8 @@ mtxq_to_txq(struct mt76_txq *mtxq) return container_of(ptr, struct ieee80211_txq, drv_priv); } +void mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta, + struct mt76_wcid *wcid, struct sk_buff *skb); 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/mt76x2_tx.c b/mt76x2_tx.c index 9347cc49..95622307 100644 --- a/mt76x2_tx.c +++ b/mt76x2_tx.c @@ -28,32 +28,13 @@ void mt76x2_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv; struct mt76x2_sta *msta = NULL; struct mt76_wcid *wcid = &mvif->group_wcid; - 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 (control->sta) { msta = (struct mt76x2_sta *) control->sta->drv_priv; wcid = &msta->wcid; } - if (!wcid->tx_rate_set) - ieee80211_get_tx_rates(info->control.vif, control->sta, skb, - info->control.rates, 1); - - q = &dev->mt76.q_tx[qid]; - - spin_lock_bh(&q->lock); - mt76_tx_queue_skb(&dev->mt76, q, skb, wcid, control->sta); - mt76_queue_kick(dev, q); - - if (q->queued > q->ndesc - 8) - ieee80211_stop_queue(hw, skb_get_queue_mapping(skb)); - spin_unlock_bh(&q->lock); + mt76_tx(&dev->mt76, control->sta, wcid, skb); } void mt76x2_tx_complete(struct mt76x2_dev *dev, struct sk_buff *skb) diff --git a/tx.c b/tx.c index 8e6554ce..c0f0c619 100644 --- a/tx.c +++ b/tx.c @@ -22,6 +22,35 @@ mt76_txq_get_qid(struct ieee80211_txq *txq) return txq->ac; } +void +mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta, + struct mt76_wcid *wcid, struct sk_buff *skb) +{ + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + 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, + info->control.rates, 1); + + q = &dev->q_tx[qid]; + + spin_lock_bh(&q->lock); + mt76_tx_queue_skb(dev, q, skb, wcid, sta); + dev->queue_ops->kick(dev, q); + + if (q->queued > q->ndesc - 8) + ieee80211_stop_queue(dev->hw, skb_get_queue_mapping(skb)); + spin_unlock_bh(&q->lock); +} +EXPORT_SYMBOL_GPL(mt76_tx); + static struct sk_buff * mt76_txq_dequeue(struct mt76_dev *dev, struct mt76_txq *mtxq, bool ps) {