dma: add a mt76_dma_ops abstraction struct to prepare for more chipset support

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2015-07-17 19:30:26 +02:00
parent d1a6945d77
commit 158ad06239
2 changed files with 17 additions and 4 deletions
+8 -1
View File
@@ -203,7 +203,8 @@ int __mt76_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
return 0;
}
int mt76_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
static int
mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
struct sk_buff *skb, struct mt76_wcid *wcid,
struct ieee80211_sta *sta)
{
@@ -517,6 +518,10 @@ mt76_rx_tasklet(unsigned long data)
mt76_irq_enable(dev, MT_INT_RX_DONE(1));
}
static const struct mt76_dma_ops dma_ops = {
.queue_skb = mt76_dma_tx_queue_skb,
};
int mt76_dma_init(struct mt76_dev *dev)
{
static const u8 wmm_queue_map[] = {
@@ -528,6 +533,8 @@ int mt76_dma_init(struct mt76_dev *dev)
int ret;
int i;
dev->dma_ops = &dma_ops;
init_waitqueue_head(&dev->mcu.wait);
skb_queue_head_init(&dev->mcu.res_q);
+9 -3
View File
@@ -141,6 +141,12 @@ struct mt76_hw_cap {
bool has_5ghz;
};
struct mt76_dma_ops {
int (*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;
struct device *dev;
@@ -151,6 +157,8 @@ struct mt76_dev {
struct mutex mutex;
const struct mt76_dma_ops *dma_ops;
const u16 *beacon_offsets;
unsigned long wcid_mask[256 / BITS_PER_LONG];
@@ -325,9 +333,7 @@ void mt76_rx(struct mt76_dev *dev, struct sk_buff *skb);
int __mt76_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
struct sk_buff *skb, u32 tx_info);
int mt76_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
struct sk_buff *skb, struct mt76_wcid *wcid,
struct ieee80211_sta *sta);
#define mt76_tx_queue_skb(dev, ...) dev->dma_ops->queue_skb(dev, __VA_ARGS__)
void mt76_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
struct sk_buff *skb);