main.c (9fba6d077f6411b116f435a9a9dc82c6cdc55324) main.c (96747a51fe62eb13481a39438453262d22148fa7)
1// SPDX-License-Identifier: ISC
2
3#include <linux/etherdevice.h>
4#include <linux/platform_device.h>
5#include <linux/pci.h>
6#include <linux/module.h>
7#include "mt7603.h"
8#include "mac.h"
9#include "eeprom.h"
10
11static int
12mt7603_start(struct ieee80211_hw *hw)
13{
14 struct mt7603_dev *dev = hw->priv;
15
16 mt7603_mac_reset_counters(dev);
17 mt7603_mac_start(dev);
1// SPDX-License-Identifier: ISC
2
3#include <linux/etherdevice.h>
4#include <linux/platform_device.h>
5#include <linux/pci.h>
6#include <linux/module.h>
7#include "mt7603.h"
8#include "mac.h"
9#include "eeprom.h"
10
11static int
12mt7603_start(struct ieee80211_hw *hw)
13{
14 struct mt7603_dev *dev = hw->priv;
15
16 mt7603_mac_reset_counters(dev);
17 mt7603_mac_start(dev);
18 dev->mt76.survey_time = ktime_get_boottime();
18 dev->mphy.survey_time = ktime_get_boottime();
19 set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
20 mt7603_mac_work(&dev->mt76.mac_work.work);
21
22 return 0;
23}
24
25static void
26mt7603_stop(struct ieee80211_hw *hw)

--- 114 unchanged lines hidden (view full) ---

141
142 cancel_delayed_work_sync(&dev->mt76.mac_work);
143 tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
144
145 mutex_lock(&dev->mt76.mutex);
146 set_bit(MT76_RESET, &dev->mt76.state);
147
148 mt7603_beacon_set_timer(dev, -1, 0);
19 set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
20 mt7603_mac_work(&dev->mt76.mac_work.work);
21
22 return 0;
23}
24
25static void
26mt7603_stop(struct ieee80211_hw *hw)

--- 114 unchanged lines hidden (view full) ---

141
142 cancel_delayed_work_sync(&dev->mt76.mac_work);
143 tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
144
145 mutex_lock(&dev->mt76.mutex);
146 set_bit(MT76_RESET, &dev->mt76.state);
147
148 mt7603_beacon_set_timer(dev, -1, 0);
149 mt76_set_channel(&dev->mt76);
149 mt76_set_channel(&dev->mphy);
150 mt7603_mac_stop(dev);
151
152 if (def->width == NL80211_CHAN_WIDTH_40)
153 bw = MT_BW_40;
154
150 mt7603_mac_stop(dev);
151
152 if (def->width == NL80211_CHAN_WIDTH_40)
153 bw = MT_BW_40;
154
155 dev->mt76.chandef = *def;
155 dev->mphy.chandef = *def;
156 mt76_rmw_field(dev, MT_AGG_BWCR, MT_AGG_BWCR_BW, bw);
157 ret = mt7603_mcu_set_channel(dev);
158 if (ret) {
159 failed = true;
160 goto out;
161 }
162
163 if (def->chan->band == NL80211_BAND_5GHZ) {

--- 21 unchanged lines hidden (view full) ---

185
186 /* reset channel stats */
187 mt76_clear(dev, MT_MIB_CTL, MT_MIB_CTL_READ_CLR_DIS);
188 mt76_set(dev, MT_MIB_CTL,
189 MT_MIB_CTL_CCA_NAV_TX | MT_MIB_CTL_PSCCA_TIME);
190 mt76_rr(dev, MT_MIB_STAT_PSCCA);
191 mt7603_cca_stats_reset(dev);
192
156 mt76_rmw_field(dev, MT_AGG_BWCR, MT_AGG_BWCR_BW, bw);
157 ret = mt7603_mcu_set_channel(dev);
158 if (ret) {
159 failed = true;
160 goto out;
161 }
162
163 if (def->chan->band == NL80211_BAND_5GHZ) {

--- 21 unchanged lines hidden (view full) ---

185
186 /* reset channel stats */
187 mt76_clear(dev, MT_MIB_CTL, MT_MIB_CTL_READ_CLR_DIS);
188 mt76_set(dev, MT_MIB_CTL,
189 MT_MIB_CTL_CCA_NAV_TX | MT_MIB_CTL_PSCCA_TIME);
190 mt76_rr(dev, MT_MIB_STAT_PSCCA);
191 mt7603_cca_stats_reset(dev);
192
193 dev->mt76.survey_time = ktime_get_boottime();
193 dev->mphy.survey_time = ktime_get_boottime();
194
195 mt7603_init_edcca(dev);
196
197out:
198 if (!(mt76_hw(dev)->conf.flags & IEEE80211_CONF_OFFCHANNEL))
199 mt7603_beacon_set_timer(dev, -1, dev->mt76.beacon_int);
200 mutex_unlock(&dev->mt76.mutex);
201

--- 525 unchanged lines hidden ---
194
195 mt7603_init_edcca(dev);
196
197out:
198 if (!(mt76_hw(dev)->conf.flags & IEEE80211_CONF_OFFCHANNEL))
199 mt7603_beacon_set_timer(dev, -1, dev->mt76.beacon_int);
200 mutex_unlock(&dev->mt76.mutex);
201

--- 525 unchanged lines hidden ---