mt76: move mac_work in mt76_core module
Move mac_work delayed_work and mac_work_count in mt76_phy since it is used by all drivers. This is a preliminary patch to create a common mcu library used by mt7615 and mt7921 drivers Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
7517ea014d
commit
a782f8bfdd
@ -583,6 +583,9 @@ struct mt76_phy {
|
||||
#ifdef CONFIG_NL80211_TESTMODE
|
||||
struct mt76_testmode_data test;
|
||||
#endif
|
||||
|
||||
struct delayed_work mac_work;
|
||||
u8 mac_work_count;
|
||||
};
|
||||
|
||||
struct mt76_dev {
|
||||
@ -623,7 +626,6 @@ struct mt76_dev {
|
||||
|
||||
struct mt76_worker tx_worker;
|
||||
struct napi_struct tx_napi;
|
||||
struct delayed_work mac_work;
|
||||
|
||||
wait_queue_head_t tx_wait;
|
||||
struct sk_buff_head status_list;
|
||||
|
@ -532,7 +532,7 @@ int mt7603_register_device(struct mt7603_dev *dev)
|
||||
spin_lock_init(&dev->sta_poll_lock);
|
||||
spin_lock_init(&dev->ps_lock);
|
||||
|
||||
INIT_DELAYED_WORK(&dev->mt76.mac_work, mt7603_mac_work);
|
||||
INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7603_mac_work);
|
||||
tasklet_setup(&dev->mt76.pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet);
|
||||
|
||||
dev->slottime = 9;
|
||||
|
@ -1788,7 +1788,7 @@ out:
|
||||
void mt7603_mac_work(struct work_struct *work)
|
||||
{
|
||||
struct mt7603_dev *dev = container_of(work, struct mt7603_dev,
|
||||
mt76.mac_work.work);
|
||||
mphy.mac_work.work);
|
||||
bool reset = false;
|
||||
int i, idx;
|
||||
|
||||
@ -1796,7 +1796,7 @@ void mt7603_mac_work(struct work_struct *work)
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
|
||||
dev->mac_work_count++;
|
||||
dev->mphy.mac_work_count++;
|
||||
mt76_update_survey(&dev->mt76);
|
||||
mt7603_edcca_check(dev);
|
||||
|
||||
@ -1807,7 +1807,7 @@ void mt7603_mac_work(struct work_struct *work)
|
||||
dev->mt76.aggr_stats[idx++] += val >> 16;
|
||||
}
|
||||
|
||||
if (dev->mac_work_count == 10)
|
||||
if (dev->mphy.mac_work_count == 10)
|
||||
mt7603_false_cca_check(dev);
|
||||
|
||||
if (mt7603_watchdog_check(dev, &dev->rx_pse_check,
|
||||
@ -1838,17 +1838,17 @@ void mt7603_mac_work(struct work_struct *work)
|
||||
dev->rx_dma_idx = ~0;
|
||||
memset(dev->tx_dma_idx, 0xff, sizeof(dev->tx_dma_idx));
|
||||
reset = true;
|
||||
dev->mac_work_count = 0;
|
||||
dev->mphy.mac_work_count = 0;
|
||||
}
|
||||
|
||||
if (dev->mac_work_count >= 10)
|
||||
dev->mac_work_count = 0;
|
||||
if (dev->mphy.mac_work_count >= 10)
|
||||
dev->mphy.mac_work_count = 0;
|
||||
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
|
||||
if (reset)
|
||||
mt7603_mac_watchdog_reset(dev);
|
||||
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
|
||||
msecs_to_jiffies(MT7603_WATCHDOG_TIME));
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ mt7603_start(struct ieee80211_hw *hw)
|
||||
mt7603_mac_start(dev);
|
||||
dev->mphy.survey_time = ktime_get_boottime();
|
||||
set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
|
||||
mt7603_mac_work(&dev->mt76.mac_work.work);
|
||||
mt7603_mac_work(&dev->mphy.mac_work.work);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -28,7 +28,7 @@ mt7603_stop(struct ieee80211_hw *hw)
|
||||
struct mt7603_dev *dev = hw->priv;
|
||||
|
||||
clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
|
||||
cancel_delayed_work_sync(&dev->mt76.mac_work);
|
||||
cancel_delayed_work_sync(&dev->mphy.mac_work);
|
||||
mt7603_mac_stop(dev);
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
|
||||
u8 bw = MT_BW_20;
|
||||
bool failed = false;
|
||||
|
||||
cancel_delayed_work_sync(&dev->mt76.mac_work);
|
||||
cancel_delayed_work_sync(&dev->mphy.mac_work);
|
||||
tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
@ -178,7 +178,7 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
|
||||
|
||||
mt76_txq_schedule_all(&dev->mphy);
|
||||
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
|
||||
msecs_to_jiffies(MT7603_WATCHDOG_TIME));
|
||||
|
||||
/* reset channel stats */
|
||||
@ -200,7 +200,7 @@ out:
|
||||
tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
|
||||
|
||||
if (failed)
|
||||
mt7603_mac_work(&dev->mt76.mac_work.work);
|
||||
mt7603_mac_work(&dev->mphy.mac_work.work);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -132,8 +132,6 @@ struct mt7603_dev {
|
||||
|
||||
spinlock_t ps_lock;
|
||||
|
||||
u8 mac_work_count;
|
||||
|
||||
u8 mcu_running;
|
||||
|
||||
u8 ed_monitor_enabled;
|
||||
|
@ -408,7 +408,7 @@ int mt7615_register_ext_phy(struct mt7615_dev *dev)
|
||||
mphy->antenna_mask = BIT(hweight8(phy->chainmask)) - 1;
|
||||
mt7615_init_wiphy(mphy->hw);
|
||||
|
||||
INIT_DELAYED_WORK(&phy->mac_work, mt7615_mac_work);
|
||||
INIT_DELAYED_WORK(&mphy->mac_work, mt7615_mac_work);
|
||||
INIT_DELAYED_WORK(&phy->scan_work, mt7615_scan_work);
|
||||
skb_queue_head_init(&phy->scan_event_list);
|
||||
|
||||
@ -471,7 +471,7 @@ void mt7615_init_device(struct mt7615_dev *dev)
|
||||
init_completion(&dev->pm.wake_cmpl);
|
||||
spin_lock_init(&dev->pm.txq_lock);
|
||||
set_bit(MT76_STATE_PM, &dev->mphy.state);
|
||||
INIT_DELAYED_WORK(&dev->phy.mac_work, mt7615_mac_work);
|
||||
INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7615_mac_work);
|
||||
INIT_DELAYED_WORK(&dev->phy.scan_work, mt7615_scan_work);
|
||||
skb_queue_head_init(&dev->phy.scan_event_list);
|
||||
INIT_LIST_HEAD(&dev->sta_poll_list);
|
||||
|
@ -1976,17 +1976,17 @@ out:
|
||||
void mt7615_mac_work(struct work_struct *work)
|
||||
{
|
||||
struct mt7615_phy *phy;
|
||||
struct mt76_dev *mdev;
|
||||
struct mt76_phy *mphy;
|
||||
|
||||
phy = (struct mt7615_phy *)container_of(work, struct mt7615_phy,
|
||||
mac_work.work);
|
||||
mdev = &phy->dev->mt76;
|
||||
mphy = (struct mt76_phy *)container_of(work, struct mt76_phy,
|
||||
mac_work.work);
|
||||
phy = mphy->priv;
|
||||
|
||||
mt7615_mutex_acquire(phy->dev);
|
||||
|
||||
mt7615_update_survey(phy->dev);
|
||||
if (++phy->mac_work_count == 5) {
|
||||
phy->mac_work_count = 0;
|
||||
if (++mphy->mac_work_count == 5) {
|
||||
mphy->mac_work_count = 0;
|
||||
|
||||
mt7615_mac_update_mib_stats(phy);
|
||||
mt7615_mac_scs_check(phy);
|
||||
@ -1994,8 +1994,8 @@ void mt7615_mac_work(struct work_struct *work)
|
||||
|
||||
mt7615_mutex_release(phy->dev);
|
||||
|
||||
mt76_tx_status_check(mdev, NULL, false);
|
||||
ieee80211_queue_delayed_work(phy->mt76->hw, &phy->mac_work,
|
||||
mt76_tx_status_check(mphy->dev, NULL, false);
|
||||
ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
|
||||
MT7615_WATCHDOG_TIME);
|
||||
}
|
||||
|
||||
@ -2104,11 +2104,11 @@ void mt7615_mac_reset_work(struct work_struct *work)
|
||||
set_bit(MT76_RESET, &dev->mphy.state);
|
||||
set_bit(MT76_MCU_RESET, &dev->mphy.state);
|
||||
wake_up(&dev->mt76.mcu.wait);
|
||||
cancel_delayed_work_sync(&dev->phy.mac_work);
|
||||
cancel_delayed_work_sync(&dev->mphy.mac_work);
|
||||
del_timer_sync(&dev->phy.roc_timer);
|
||||
cancel_work_sync(&dev->phy.roc_work);
|
||||
if (phy2) {
|
||||
cancel_delayed_work_sync(&phy2->mac_work);
|
||||
cancel_delayed_work_sync(&phy2->mt76->mac_work);
|
||||
del_timer_sync(&phy2->roc_timer);
|
||||
cancel_work_sync(&phy2->roc_work);
|
||||
}
|
||||
@ -2163,10 +2163,11 @@ void mt7615_mac_reset_work(struct work_struct *work)
|
||||
|
||||
mt7615_mutex_release(dev);
|
||||
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->phy.mac_work,
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
|
||||
MT7615_WATCHDOG_TIME);
|
||||
if (phy2)
|
||||
ieee80211_queue_delayed_work(ext_phy->hw, &phy2->mac_work,
|
||||
ieee80211_queue_delayed_work(ext_phy->hw,
|
||||
&phy2->mt76->mac_work,
|
||||
MT7615_WATCHDOG_TIME);
|
||||
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ static int mt7615_start(struct ieee80211_hw *hw)
|
||||
|
||||
set_bit(MT76_STATE_RUNNING, &phy->mt76->state);
|
||||
|
||||
ieee80211_queue_delayed_work(hw, &phy->mac_work,
|
||||
ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
|
||||
MT7615_WATCHDOG_TIME);
|
||||
|
||||
if (!running)
|
||||
@ -86,7 +86,7 @@ static void mt7615_stop(struct ieee80211_hw *hw)
|
||||
struct mt7615_dev *dev = mt7615_hw_dev(hw);
|
||||
struct mt7615_phy *phy = mt7615_hw_phy(hw);
|
||||
|
||||
cancel_delayed_work_sync(&phy->mac_work);
|
||||
cancel_delayed_work_sync(&phy->mt76->mac_work);
|
||||
del_timer_sync(&phy->roc_timer);
|
||||
cancel_work_sync(&phy->roc_work);
|
||||
|
||||
@ -300,7 +300,7 @@ int mt7615_set_channel(struct mt7615_phy *phy)
|
||||
bool ext_phy = phy != &dev->phy;
|
||||
int ret;
|
||||
|
||||
cancel_delayed_work_sync(&phy->mac_work);
|
||||
cancel_delayed_work_sync(&phy->mt76->mac_work);
|
||||
|
||||
mt7615_mutex_acquire(dev);
|
||||
|
||||
@ -335,7 +335,8 @@ out:
|
||||
mt76_txq_schedule_all(phy->mt76);
|
||||
|
||||
if (!mt76_testmode_enabled(phy->mt76))
|
||||
ieee80211_queue_delayed_work(phy->mt76->hw, &phy->mac_work,
|
||||
ieee80211_queue_delayed_work(phy->mt76->hw,
|
||||
&phy->mt76->mac_work,
|
||||
MT7615_WATCHDOG_TIME);
|
||||
|
||||
return ret;
|
||||
@ -1112,7 +1113,7 @@ static int mt7615_suspend(struct ieee80211_hw *hw,
|
||||
|
||||
clear_bit(MT76_STATE_RUNNING, &phy->mt76->state);
|
||||
cancel_delayed_work_sync(&phy->scan_work);
|
||||
cancel_delayed_work_sync(&phy->mac_work);
|
||||
cancel_delayed_work_sync(&phy->mt76->mac_work);
|
||||
|
||||
set_bit(MT76_STATE_SUSPEND, &phy->mt76->state);
|
||||
ieee80211_iterate_active_interfaces(hw,
|
||||
@ -1153,7 +1154,7 @@ static int mt7615_resume(struct ieee80211_hw *hw)
|
||||
IEEE80211_IFACE_ITER_RESUME_ALL,
|
||||
mt7615_mcu_set_suspend_iter, phy);
|
||||
|
||||
ieee80211_queue_delayed_work(hw, &phy->mac_work,
|
||||
ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
|
||||
MT7615_WATCHDOG_TIME);
|
||||
|
||||
mt7615_mutex_release(dev);
|
||||
|
@ -185,9 +185,6 @@ struct mt7615_phy {
|
||||
|
||||
struct mib_stats mib;
|
||||
|
||||
struct delayed_work mac_work;
|
||||
u8 mac_work_count;
|
||||
|
||||
struct sk_buff_head scan_event_list;
|
||||
struct delayed_work scan_work;
|
||||
|
||||
|
@ -29,7 +29,7 @@ static void mt7663u_stop(struct ieee80211_hw *hw)
|
||||
del_timer_sync(&phy->roc_timer);
|
||||
cancel_work_sync(&phy->roc_work);
|
||||
cancel_delayed_work_sync(&phy->scan_work);
|
||||
cancel_delayed_work_sync(&phy->mac_work);
|
||||
cancel_delayed_work_sync(&phy->mt76->mac_work);
|
||||
mt76u_stop_tx(&dev->mt76);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ static int mt76x0e_start(struct ieee80211_hw *hw)
|
||||
|
||||
mt76x02_mac_start(dev);
|
||||
mt76x0_phy_calibrate(dev, true);
|
||||
ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mt76.mac_work,
|
||||
ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mphy.mac_work,
|
||||
MT_MAC_WORK_INTERVAL);
|
||||
ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
|
||||
MT_CALIBRATE_INTERVAL);
|
||||
@ -28,7 +28,7 @@ static int mt76x0e_start(struct ieee80211_hw *hw)
|
||||
static void mt76x0e_stop_hw(struct mt76x02_dev *dev)
|
||||
{
|
||||
cancel_delayed_work_sync(&dev->cal_work);
|
||||
cancel_delayed_work_sync(&dev->mt76.mac_work);
|
||||
cancel_delayed_work_sync(&dev->mphy.mac_work);
|
||||
clear_bit(MT76_RESTART, &dev->mphy.state);
|
||||
|
||||
if (!mt76_poll(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_TX_DMA_BUSY,
|
||||
|
@ -82,7 +82,7 @@ static void mt76x0u_stop(struct ieee80211_hw *hw)
|
||||
|
||||
clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
|
||||
cancel_delayed_work_sync(&dev->cal_work);
|
||||
cancel_delayed_work_sync(&dev->mt76.mac_work);
|
||||
cancel_delayed_work_sync(&dev->mphy.mac_work);
|
||||
mt76u_stop_tx(&dev->mt76);
|
||||
mt76x02u_exit_beacon_config(dev);
|
||||
|
||||
@ -108,7 +108,7 @@ static int mt76x0u_start(struct ieee80211_hw *hw)
|
||||
return ret;
|
||||
|
||||
mt76x0_phy_calibrate(dev, true);
|
||||
ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mt76.mac_work,
|
||||
ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mphy.mac_work,
|
||||
MT_MAC_WORK_INTERVAL);
|
||||
ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
|
||||
MT_CALIBRATE_INTERVAL);
|
||||
|
@ -1162,7 +1162,7 @@ static void mt76x02_edcca_check(struct mt76x02_dev *dev)
|
||||
void mt76x02_mac_work(struct work_struct *work)
|
||||
{
|
||||
struct mt76x02_dev *dev = container_of(work, struct mt76x02_dev,
|
||||
mt76.mac_work.work);
|
||||
mphy.mac_work.work);
|
||||
int i, idx;
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
@ -1185,7 +1185,7 @@ void mt76x02_mac_work(struct work_struct *work)
|
||||
|
||||
mt76_tx_status_check(&dev->mt76, NULL, false);
|
||||
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
|
||||
MT_MAC_WORK_INTERVAL);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ void mt76x02_init_device(struct mt76x02_dev *dev)
|
||||
struct ieee80211_hw *hw = mt76_hw(dev);
|
||||
struct wiphy *wiphy = hw->wiphy;
|
||||
|
||||
INIT_DELAYED_WORK(&dev->mt76.mac_work, mt76x02_mac_work);
|
||||
INIT_DELAYED_WORK(&dev->mphy.mac_work, mt76x02_mac_work);
|
||||
|
||||
hw->queues = 4;
|
||||
hw->max_rates = 1;
|
||||
|
@ -271,7 +271,7 @@ static int mt76x2_init_hardware(struct mt76x02_dev *dev)
|
||||
void mt76x2_stop_hardware(struct mt76x02_dev *dev)
|
||||
{
|
||||
cancel_delayed_work_sync(&dev->cal_work);
|
||||
cancel_delayed_work_sync(&dev->mt76.mac_work);
|
||||
cancel_delayed_work_sync(&dev->mphy.mac_work);
|
||||
cancel_delayed_work_sync(&dev->wdt_work);
|
||||
clear_bit(MT76_RESTART, &dev->mphy.state);
|
||||
mt76x02_mcu_set_radio_state(dev, false);
|
||||
|
@ -14,7 +14,7 @@ mt76x2_start(struct ieee80211_hw *hw)
|
||||
mt76x02_mac_start(dev);
|
||||
mt76x2_phy_start(dev);
|
||||
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
|
||||
MT_MAC_WORK_INTERVAL);
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->wdt_work,
|
||||
MT_WATCHDOG_TIME);
|
||||
|
@ -236,7 +236,7 @@ fail:
|
||||
void mt76x2u_stop_hw(struct mt76x02_dev *dev)
|
||||
{
|
||||
cancel_delayed_work_sync(&dev->cal_work);
|
||||
cancel_delayed_work_sync(&dev->mt76.mac_work);
|
||||
cancel_delayed_work_sync(&dev->mphy.mac_work);
|
||||
mt76x2u_mac_stop(dev);
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ static int mt76x2u_start(struct ieee80211_hw *hw)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
|
||||
MT_MAC_WORK_INTERVAL);
|
||||
set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
|
||||
|
||||
|
@ -240,7 +240,7 @@ static int mt7915_register_ext_phy(struct mt7915_dev *dev)
|
||||
mt7915_init_wiphy(mphy->hw);
|
||||
|
||||
INIT_LIST_HEAD(&phy->stats_list);
|
||||
INIT_DELAYED_WORK(&phy->mac_work, mt7915_mac_work);
|
||||
INIT_DELAYED_WORK(&mphy->mac_work, mt7915_mac_work);
|
||||
|
||||
mt7915_eeprom_parse_band_config(phy);
|
||||
mt7915_set_stream_vht_txbf_caps(phy);
|
||||
@ -622,7 +622,7 @@ int mt7915_register_device(struct mt7915_dev *dev)
|
||||
dev->mt76.phy.priv = &dev->phy;
|
||||
INIT_LIST_HEAD(&dev->phy.stats_list);
|
||||
INIT_WORK(&dev->rc_work, mt7915_mac_sta_rc_work);
|
||||
INIT_DELAYED_WORK(&dev->phy.mac_work, mt7915_mac_work);
|
||||
INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7915_mac_work);
|
||||
INIT_LIST_HEAD(&dev->sta_rc_list);
|
||||
INIT_LIST_HEAD(&dev->sta_poll_list);
|
||||
spin_lock_init(&dev->sta_poll_lock);
|
||||
|
@ -1544,9 +1544,9 @@ void mt7915_mac_reset_work(struct work_struct *work)
|
||||
set_bit(MT76_RESET, &dev->mphy.state);
|
||||
set_bit(MT76_MCU_RESET, &dev->mphy.state);
|
||||
wake_up(&dev->mt76.mcu.wait);
|
||||
cancel_delayed_work_sync(&dev->phy.mac_work);
|
||||
cancel_delayed_work_sync(&dev->mphy.mac_work);
|
||||
if (phy2)
|
||||
cancel_delayed_work_sync(&phy2->mac_work);
|
||||
cancel_delayed_work_sync(&phy2->mt76->mac_work);
|
||||
|
||||
/* lock/unlock all queues to ensure that no tx is pending */
|
||||
mt76_txq_schedule_all(&dev->mphy);
|
||||
@ -1600,10 +1600,11 @@ void mt7915_mac_reset_work(struct work_struct *work)
|
||||
|
||||
mt7915_update_beacons(dev);
|
||||
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->phy.mac_work,
|
||||
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
|
||||
MT7915_WATCHDOG_TIME);
|
||||
if (phy2)
|
||||
ieee80211_queue_delayed_work(ext_phy->hw, &phy2->mac_work,
|
||||
ieee80211_queue_delayed_work(ext_phy->hw,
|
||||
&phy2->mt76->mac_work,
|
||||
MT7915_WATCHDOG_TIME);
|
||||
}
|
||||
|
||||
@ -1714,17 +1715,17 @@ void mt7915_mac_sta_rc_work(struct work_struct *work)
|
||||
void mt7915_mac_work(struct work_struct *work)
|
||||
{
|
||||
struct mt7915_phy *phy;
|
||||
struct mt76_dev *mdev;
|
||||
struct mt76_phy *mphy;
|
||||
|
||||
phy = (struct mt7915_phy *)container_of(work, struct mt7915_phy,
|
||||
mac_work.work);
|
||||
mdev = &phy->dev->mt76;
|
||||
mphy = (struct mt76_phy *)container_of(work, struct mt76_phy,
|
||||
mac_work.work);
|
||||
phy = mphy->priv;
|
||||
|
||||
mutex_lock(&mdev->mutex);
|
||||
mutex_lock(&mphy->dev->mutex);
|
||||
|
||||
mt76_update_survey(mdev);
|
||||
if (++phy->mac_work_count == 5) {
|
||||
phy->mac_work_count = 0;
|
||||
mt76_update_survey(mphy->dev);
|
||||
if (++mphy->mac_work_count == 5) {
|
||||
mphy->mac_work_count = 0;
|
||||
|
||||
mt7915_mac_update_mib_stats(phy);
|
||||
}
|
||||
@ -1734,9 +1735,9 @@ void mt7915_mac_work(struct work_struct *work)
|
||||
mt7915_mac_sta_stats_work(phy);
|
||||
};
|
||||
|
||||
mutex_unlock(&mdev->mutex);
|
||||
mutex_unlock(&mphy->dev->mutex);
|
||||
|
||||
ieee80211_queue_delayed_work(phy->mt76->hw, &phy->mac_work,
|
||||
ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
|
||||
MT7915_WATCHDOG_TIME);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ static int mt7915_start(struct ieee80211_hw *hw)
|
||||
set_bit(MT76_STATE_RUNNING, &phy->mt76->state);
|
||||
|
||||
if (!mt76_testmode_enabled(phy->mt76))
|
||||
ieee80211_queue_delayed_work(hw, &phy->mac_work,
|
||||
ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
|
||||
MT7915_WATCHDOG_TIME);
|
||||
|
||||
if (!running)
|
||||
@ -66,7 +66,7 @@ static void mt7915_stop(struct ieee80211_hw *hw)
|
||||
struct mt7915_dev *dev = mt7915_hw_dev(hw);
|
||||
struct mt7915_phy *phy = mt7915_hw_phy(hw);
|
||||
|
||||
cancel_delayed_work_sync(&phy->mac_work);
|
||||
cancel_delayed_work_sync(&phy->mt76->mac_work);
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
|
||||
@ -273,7 +273,7 @@ int mt7915_set_channel(struct mt7915_phy *phy)
|
||||
struct mt7915_dev *dev = phy->dev;
|
||||
int ret;
|
||||
|
||||
cancel_delayed_work_sync(&phy->mac_work);
|
||||
cancel_delayed_work_sync(&phy->mt76->mac_work);
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
set_bit(MT76_RESET, &phy->mt76->state);
|
||||
@ -299,7 +299,8 @@ out:
|
||||
mt76_txq_schedule_all(phy->mt76);
|
||||
|
||||
if (!mt76_testmode_enabled(phy->mt76))
|
||||
ieee80211_queue_delayed_work(phy->mt76->hw, &phy->mac_work,
|
||||
ieee80211_queue_delayed_work(phy->mt76->hw,
|
||||
&phy->mt76->mac_work,
|
||||
MT7915_WATCHDOG_TIME);
|
||||
|
||||
return ret;
|
||||
|
@ -140,8 +140,6 @@ struct mt7915_phy {
|
||||
struct mib_stats mib;
|
||||
struct list_head stats_list;
|
||||
|
||||
struct delayed_work mac_work;
|
||||
u8 mac_work_count;
|
||||
u8 sta_work_count;
|
||||
|
||||
#ifdef CONFIG_NL80211_TESTMODE
|
||||
|
Loading…
x
Reference in New Issue
Block a user