From d22feb00e9270529420899ce17bbf5d470eceedf Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 28 Nov 2018 22:15:30 +0100 Subject: [PATCH] mt7603: move cab queue enabling to pre-tbtt tasklet It is not necessary to time the start of the queue in software, the hardware already does that for us. Move all processing into the pre-tbtt tasklet to get rid of a race condition that could happen when the pre-tbtt tasklet takes too long Signed-off-by: Felix Fietkau --- mt7603/beacon.c | 14 +++++--------- mt7603/core.c | 2 -- mt7603/mt7603.h | 1 - 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/mt7603/beacon.c b/mt7603/beacon.c index 05797a9d..82e3b0eb 100644 --- a/mt7603/beacon.c +++ b/mt7603/beacon.c @@ -67,15 +67,6 @@ mt7603_add_buffered_bc(void *priv, u8 *mac, struct ieee80211_vif *vif) data->count[mvif->idx]++; } -void mt7603_tbtt(struct mt7603_dev *dev) -{ - u32 mask = MT_WF_ARB_CAB_START_BSSn(0) | - (MT_WF_ARB_CAB_START_BSS0n(1) * - ((1 << (MT7603_MAX_INTERFACES - 1)) - 1)); - - mt76_wr(dev, MT_WF_ARB_CAB_START, mask); -} - void mt7603_pre_tbtt_tasklet(unsigned long arg) { struct mt7603_dev *dev = (struct mt7603_dev *)arg; @@ -135,6 +126,11 @@ void mt7603_pre_tbtt_tasklet(unsigned long arg) mt76_wr(dev, MT_WF_ARB_CAB_COUNT(i), data.count[i] << MT_WF_ARB_CAB_COUNT_B0_SHIFT(i)); + mt76_wr(dev, MT_WF_ARB_CAB_START, + MT_WF_ARB_CAB_START_BSSn(0) | + (MT_WF_ARB_CAB_START_BSS0n(1) * + ((1 << (MT7603_MAX_INTERFACES - 1)) - 1))); + out: mt76_queue_tx_cleanup(dev, MT_TXQ_BEACON, false); if (dev->mt76.q_tx[MT_TXQ_BEACON].queued > MT7603_MAX_INTERFACES) diff --git a/mt7603/core.c b/mt7603/core.c index 4ef6765c..16e4a9a4 100644 --- a/mt7603/core.c +++ b/mt7603/core.c @@ -54,8 +54,6 @@ irqreturn_t mt7603_irq_handler(int irq, void *dev_instance) mt76_wr(dev, MT_HW_INT_STATUS(3), hwintr); if (hwintr & MT_HW_INT3_PRE_TBTT0) tasklet_schedule(&dev->pre_tbtt_tasklet); - if (hwintr & MT_HW_INT3_TBTT0) - mt7603_tbtt(dev); } if (intr & MT_INT_TX_DONE_ALL) { diff --git a/mt7603/mt7603.h b/mt7603/mt7603.h index 3f1f388f..4a5a96ba 100644 --- a/mt7603/mt7603.h +++ b/mt7603/mt7603.h @@ -237,7 +237,6 @@ int mt7603_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, void mt7603_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta); -void mt7603_tbtt(struct mt7603_dev *dev); void mt7603_pre_tbtt_tasklet(unsigned long arg); void mt7603_update_channel(struct mt76_dev *mdev);