Skip to content

Commit

Permalink
dma: add a mt76_dma_ops abstraction struct to prepare for more chipse…
Browse files Browse the repository at this point in the history
…t support

Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
Felix Fietkau committed Jul 17, 2015
1 parent d1a6945 commit 158ad06
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 8 additions & 1 deletion dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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[] = {
Expand All @@ -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);

Expand Down
12 changes: 9 additions & 3 deletions mt76.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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];

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 158ad06

Please sign in to comment.