Skip to content

Commit

Permalink
move tx scheduling code to common
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
Felix Fietkau committed Dec 16, 2015
1 parent a08c4a3 commit 43d5b84
Show file tree
Hide file tree
Showing 8 changed files with 359 additions and 334 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ EXTRA_CFLAGS += -Werror
obj-m := mt76.o mt76x2e.o mt7603e.o

mt76-y := \
mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o
mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o tx.o

mt76x2e-y := \
mt76x2_pci.o mt76x2_dma.o \
Expand Down
18 changes: 18 additions & 0 deletions mt76.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,22 @@ static inline void mt76_eeprom_override(struct mt76_dev *dev)

int mt76_eeprom_init(struct mt76_dev *dev, int len);

static inline struct ieee80211_txq *
mtxq_to_txq(struct mt76_txq *mtxq)
{
void *ptr = mtxq;
return container_of(ptr, struct ieee80211_txq, drv_priv);
}

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);
void mt76_stop_tx_queues(struct mt76_dev *dev, struct ieee80211_sta *sta);
void mt76_txq_schedule(struct mt76_dev *dev, struct mt76_queue *hwq);
void mt76_release_buffered_frames(struct ieee80211_hw *hw,
struct ieee80211_sta *sta,
u16 tids, int nframes,
enum ieee80211_frame_release_type reason,
bool more_data);

#endif
20 changes: 1 addition & 19 deletions mt76x2.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ struct mt76x2_vif {
};

struct mt76x2_sta {
struct mt76_wcid wcid;
struct mt76_wcid wcid; /* must be first */

struct mt76x2_tx_status status;
int n_frames;
Expand Down Expand Up @@ -184,13 +184,6 @@ static inline void mt76x2_irq_disable(struct mt76x2_dev *dev, u32 mask)
mt76x2_set_irq_mask(dev, mask, 0);
}

static inline struct ieee80211_txq *
mtxq_to_txq(struct mt76_txq *mtxq)
{
void *ptr = mtxq;
return container_of(ptr, struct ieee80211_txq, drv_priv);
}

extern const struct ieee80211_ops mt76x2_ops;

struct mt76x2_dev *mt76x2_alloc_device(struct device *pdev);
Expand Down Expand Up @@ -238,16 +231,5 @@ void mt76x2_tx_complete(struct mt76x2_dev *dev, struct sk_buff *skb);
void mt76x2_pre_tbtt_tasklet(unsigned long data);

void mt76x2_txq_init(struct mt76x2_dev *dev, struct ieee80211_txq *txq);
void mt76x2_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
void mt76x2_txq_remove(struct mt76x2_dev *dev, struct ieee80211_txq *txq);
void mt76x2_txq_schedule(struct mt76x2_dev *dev, struct mt76_queue *hwq);

void mt76x2_release_buffered_frames(struct ieee80211_hw *hw,
struct ieee80211_sta *sta,
u16 tids, int nframes,
enum ieee80211_frame_release_type reason,
bool more_data);

void mt76x2_stop_tx_queues(struct mt76x2_dev *dev, struct ieee80211_sta *sta);

#endif
2 changes: 1 addition & 1 deletion mt76x2_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ mt76_tx_cleanup(struct mt76x2_dev *dev, struct mt76_queue *q, bool flush)
spin_lock_bh(&q->lock);
mt76_queue_cleanup(dev, q, flush, mt76x2_tx_cleanup_entry);
if (!flush)
mt76x2_txq_schedule(dev, q);
mt76_txq_schedule(&dev->mt76, q);
spin_unlock_bh(&q->lock);
}

Expand Down
10 changes: 5 additions & 5 deletions mt76x2_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ mt76x2_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
struct mt76x2_dev *dev = hw->priv;

mt76x2_txq_remove(dev, vif->txq);
mt76_txq_remove(&dev->mt76, vif->txq);
}

static int
Expand Down Expand Up @@ -256,7 +256,7 @@ mt76x2_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&dev->mutex);
rcu_assign_pointer(dev->wcid[idx], NULL);
for (i = 0; i < ARRAY_SIZE(sta->txq); i++)
mt76x2_txq_remove(dev, sta->txq[i]);
mt76_txq_remove(&dev->mt76, sta->txq[i]);
mt76_set(dev, MT_WCID_DROP(idx), MT_WCID_DROP_MASK(idx));
dev->wcid_mask[idx / BITS_PER_LONG] &= ~BIT(idx % BITS_PER_LONG);
mt76x2_mac_wcid_setup(dev, idx, 0, NULL);
Expand All @@ -277,7 +277,7 @@ mt76x2_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
case STA_NOTIFY_SLEEP:
msta->sleeping = true;
mt76_set(dev, MT_WCID_DROP(idx), MT_WCID_DROP_MASK(idx));
mt76x2_stop_tx_queues(dev, sta);
mt76_stop_tx_queues(&dev->mt76, sta);
break;
case STA_NOTIFY_AWAKE:
mt76_clear(dev, MT_WCID_DROP(idx), MT_WCID_DROP_MASK(idx));
Expand Down Expand Up @@ -486,9 +486,9 @@ const struct ieee80211_ops mt76x2_ops = {
.flush = mt76x2_flush,
.ampdu_action = mt76x2_ampdu_action,
.get_txpower = mt76x2_get_txpower,
.wake_tx_queue = mt76x2_wake_tx_queue,
.wake_tx_queue = mt76_wake_tx_queue,
.sta_rate_tbl_update = mt76x2_sta_rate_tbl_update,
.release_buffered_frames = mt76x2_release_buffered_frames,
.release_buffered_frames = mt76_release_buffered_frames,
.set_coverage_class = mt76x2_set_coverage_class,
};

Expand Down
Loading

0 comments on commit 43d5b84

Please sign in to comment.