move more tx code to common

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2015-12-16 19:11:16 +01:00
parent 43d5b84989
commit 5a2e904bbd
3 changed files with 32 additions and 20 deletions
+2
View File
@@ -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);
+1 -20
View File
@@ -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)
+29
View File
@@ -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)
{