mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
add a driver ops struct to allow mt76 to call into driver specific code, will be used for queueing tx packets (incl. mac header processing)
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
@@ -130,10 +130,17 @@ struct mt76_hw_cap {
|
||||
bool has_5ghz;
|
||||
};
|
||||
|
||||
struct mt76_driver_ops {
|
||||
int (*tx_queue_skb)(struct mt76_dev *dev, struct mt76_queue *q,
|
||||
struct sk_buff *skb, struct mt76_wcid *wcid,
|
||||
struct ieee80211_sta *sta);
|
||||
};
|
||||
|
||||
struct mt76_dev {
|
||||
struct ieee80211_hw *hw;
|
||||
|
||||
const struct mt76_bus_ops *bus;
|
||||
const struct mt76_driver_ops *drv;
|
||||
void __iomem *regs;
|
||||
struct device *dev;
|
||||
|
||||
@@ -200,6 +207,8 @@ static inline u16 mt76_rev(struct mt76_dev *dev)
|
||||
#define mt76_queue_cleanup(dev, ...) (dev)->mt76.queue_ops->cleanup(&((dev)->mt76), __VA_ARGS__)
|
||||
#define mt76_queue_kick(dev, ...) (dev)->mt76.queue_ops->kick(&((dev)->mt76), __VA_ARGS__)
|
||||
|
||||
#define mt76_tx_queue_skb(dev, ...) (dev)->drv->tx_queue_skb(dev, __VA_ARGS__)
|
||||
|
||||
int mt76_register_device(struct mt76_dev *dev, bool vht,
|
||||
struct ieee80211_rate *rates, int n_rates);
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ void mt76x2_dma_cleanup(struct mt76x2_dev *dev);
|
||||
void mt76x2_cleanup(struct mt76x2_dev *dev);
|
||||
void mt76x2_rx(struct mt76x2_dev *dev, struct sk_buff *skb);
|
||||
|
||||
int mt76x2_tx_queue_skb(struct mt76x2_dev *dev, struct mt76_queue *q,
|
||||
int mt76x2_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
|
||||
struct sk_buff *skb, struct mt76_wcid *wcid,
|
||||
struct ieee80211_sta *sta);
|
||||
int mt76x2_tx_queue_mcu(struct mt76x2_dev *dev, enum mt76_txq_id qid,
|
||||
|
||||
+2
-1
@@ -157,10 +157,11 @@ mt76x2_tx_queue_mcu(struct mt76x2_dev *dev, enum mt76_txq_id qid,
|
||||
}
|
||||
|
||||
int
|
||||
mt76x2_tx_queue_skb(struct mt76x2_dev *dev, struct mt76_queue *q,
|
||||
mt76x2_tx_queue_skb(struct mt76_dev *cdev, struct mt76_queue *q,
|
||||
struct sk_buff *skb, struct mt76_wcid *wcid,
|
||||
struct ieee80211_sta *sta)
|
||||
{
|
||||
struct mt76x2_dev *dev = container_of(cdev, struct mt76x2_dev, mt76);
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
struct mt76_txwi_cache *t;
|
||||
dma_addr_t addr;
|
||||
|
||||
@@ -560,6 +560,9 @@ void mt76x2_cleanup(struct mt76x2_dev *dev)
|
||||
|
||||
struct mt76x2_dev *mt76x2_alloc_device(struct device *pdev)
|
||||
{
|
||||
static const struct mt76_driver_ops drv_ops = {
|
||||
.tx_queue_skb = mt76x2_tx_queue_skb
|
||||
};
|
||||
struct ieee80211_hw *hw;
|
||||
struct mt76x2_dev *dev;
|
||||
|
||||
@@ -570,6 +573,7 @@ struct mt76x2_dev *mt76x2_alloc_device(struct device *pdev)
|
||||
dev = hw->priv;
|
||||
dev->mt76.dev = pdev;
|
||||
dev->mt76.hw = hw;
|
||||
dev->mt76.drv = &drv_ops;
|
||||
mutex_init(&dev->mutex);
|
||||
spin_lock_init(&dev->lock);
|
||||
spin_lock_init(&dev->irq_lock);
|
||||
|
||||
+5
-5
@@ -48,7 +48,7 @@ void mt76x2_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
|
||||
q = &dev->mt76.q_tx[qid];
|
||||
|
||||
spin_lock_bh(&q->lock);
|
||||
mt76x2_tx_queue_skb(dev, q, skb, wcid, control->sta);
|
||||
mt76_tx_queue_skb(&dev->mt76, q, skb, wcid, control->sta);
|
||||
mt76_queue_kick(dev, q);
|
||||
|
||||
if (q->queued > q->ndesc - 8)
|
||||
@@ -169,7 +169,7 @@ void mt76x2_pre_tbtt_tasklet(unsigned long arg)
|
||||
struct ieee80211_vif *vif = info->control.vif;
|
||||
struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
|
||||
|
||||
mt76x2_tx_queue_skb(dev, q, skb, &mvif->group_wcid, NULL);
|
||||
mt76_tx_queue_skb(&dev->mt76, q, skb, &mvif->group_wcid, NULL);
|
||||
}
|
||||
spin_unlock_bh(&q->lock);
|
||||
}
|
||||
@@ -231,7 +231,7 @@ mt76x2_queue_ps_skb(struct mt76x2_dev *dev, struct ieee80211_sta *sta,
|
||||
info->flags |= IEEE80211_TX_STATUS_EOSP;
|
||||
|
||||
mt76x2_skb_set_moredata(skb, !last);
|
||||
mt76x2_tx_queue_skb(dev, hwq, skb, wcid, sta);
|
||||
mt76_tx_queue_skb(&dev->mt76, hwq, skb, wcid, sta);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -309,7 +309,7 @@ mt76x2_txq_send_burst(struct mt76x2_dev *dev, struct mt76_queue *hwq,
|
||||
if (ampdu)
|
||||
mt76x2_check_agg_ssn(mtxq, skb);
|
||||
|
||||
idx = mt76x2_tx_queue_skb(dev, hwq, skb, wcid, txq->sta);
|
||||
idx = mt76_tx_queue_skb(&dev->mt76, hwq, skb, wcid, txq->sta);
|
||||
|
||||
if (idx < 0)
|
||||
return idx;
|
||||
@@ -340,7 +340,7 @@ mt76x2_txq_send_burst(struct mt76x2_dev *dev, struct mt76_queue *hwq,
|
||||
if (cur_ampdu)
|
||||
mt76x2_check_agg_ssn(mtxq, skb);
|
||||
|
||||
idx = mt76x2_tx_queue_skb(dev, hwq, skb, wcid, txq->sta);
|
||||
idx = mt76_tx_queue_skb(&dev->mt76, hwq, skb, wcid, txq->sta);
|
||||
if (idx < 0)
|
||||
return idx;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user