Lines Matching refs:dev
14 struct mt7603_dev *dev = hw->priv; in mt7603_start() local
16 mt7603_mac_reset_counters(dev); in mt7603_start()
17 mt7603_mac_start(dev); in mt7603_start()
18 dev->mphy.survey_time = ktime_get_boottime(); in mt7603_start()
19 set_bit(MT76_STATE_RUNNING, &dev->mphy.state); in mt7603_start()
20 mt7603_mac_work(&dev->mphy.mac_work.work); in mt7603_start()
28 struct mt7603_dev *dev = hw->priv; in mt7603_stop() local
30 clear_bit(MT76_STATE_RUNNING, &dev->mphy.state); in mt7603_stop()
31 cancel_delayed_work_sync(&dev->mphy.mac_work); in mt7603_stop()
32 mt7603_mac_stop(dev); in mt7603_stop()
39 struct mt7603_dev *dev = hw->priv; in mt7603_add_interface() local
45 mutex_lock(&dev->mt76.mutex); in mt7603_add_interface()
47 mvif->idx = __ffs64(~dev->mt76.vif_mask); in mt7603_add_interface()
53 mt76_wr(dev, MT_MAC_ADDR0(mvif->idx), in mt7603_add_interface()
55 mt76_wr(dev, MT_MAC_ADDR1(mvif->idx), in mt7603_add_interface()
60 mt76_wr(dev, MT_BSSID0(mvif->idx), in mt7603_add_interface()
62 mt76_wr(dev, MT_BSSID1(mvif->idx), in mt7603_add_interface()
68 dev->mt76.vif_mask |= BIT_ULL(mvif->idx); in mt7603_add_interface()
76 mt7603_wtbl_init(dev, idx, mvif->idx, bc_addr); in mt7603_add_interface()
80 rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid); in mt7603_add_interface()
83 mutex_unlock(&dev->mt76.mutex); in mt7603_add_interface()
93 struct mt7603_dev *dev = hw->priv; in mt7603_remove_interface() local
96 mt76_wr(dev, MT_MAC_ADDR0(mvif->idx), 0); in mt7603_remove_interface()
97 mt76_wr(dev, MT_MAC_ADDR1(mvif->idx), 0); in mt7603_remove_interface()
98 mt76_wr(dev, MT_BSSID0(mvif->idx), 0); in mt7603_remove_interface()
99 mt76_wr(dev, MT_BSSID1(mvif->idx), 0); in mt7603_remove_interface()
100 mt7603_beacon_set_timer(dev, mvif->idx, 0); in mt7603_remove_interface()
102 rcu_assign_pointer(dev->mt76.wcid[idx], NULL); in mt7603_remove_interface()
104 spin_lock_bh(&dev->mt76.sta_poll_lock); in mt7603_remove_interface()
107 spin_unlock_bh(&dev->mt76.sta_poll_lock); in mt7603_remove_interface()
109 mutex_lock(&dev->mt76.mutex); in mt7603_remove_interface()
110 dev->mt76.vif_mask &= ~BIT_ULL(mvif->idx); in mt7603_remove_interface()
111 mutex_unlock(&dev->mt76.mutex); in mt7603_remove_interface()
113 mt76_wcid_cleanup(&dev->mt76, &mvif->sta.wcid); in mt7603_remove_interface()
116 void mt7603_init_edcca(struct mt7603_dev *dev) in mt7603_init_edcca() argument
119 mt76_rmw_field(dev, MT_RXTD(8), MT_RXTD_8_LOWER_SIGNAL, 0x23); in mt7603_init_edcca()
122 mt76_rr(dev, MT_MIB_STAT_ED); in mt7603_init_edcca()
124 if (dev->ed_monitor) in mt7603_init_edcca()
125 mt76_set(dev, MT_MIB_CTL, MT_MIB_CTL_ED_TIME); in mt7603_init_edcca()
127 mt76_clear(dev, MT_MIB_CTL, MT_MIB_CTL_ED_TIME); in mt7603_init_edcca()
129 dev->ed_strict_mode = 0xff; in mt7603_init_edcca()
130 dev->ed_strong_signal = 0; in mt7603_init_edcca()
131 dev->ed_time = ktime_get_boottime(); in mt7603_init_edcca()
133 mt7603_edcca_set_strict(dev, false); in mt7603_init_edcca()
139 struct mt7603_dev *dev = hw->priv; in mt7603_set_channel() local
140 u8 *rssi_data = (u8 *)dev->mt76.eeprom.data; in mt7603_set_channel()
146 cancel_delayed_work_sync(&dev->mphy.mac_work); in mt7603_set_channel()
147 tasklet_disable(&dev->mt76.pre_tbtt_tasklet); in mt7603_set_channel()
149 mutex_lock(&dev->mt76.mutex); in mt7603_set_channel()
150 set_bit(MT76_RESET, &dev->mphy.state); in mt7603_set_channel()
152 mt7603_beacon_set_timer(dev, -1, 0); in mt7603_set_channel()
153 mt76_set_channel(&dev->mphy); in mt7603_set_channel()
154 mt7603_mac_stop(dev); in mt7603_set_channel()
159 dev->mphy.chandef = *def; in mt7603_set_channel()
160 mt76_rmw_field(dev, MT_AGG_BWCR, MT_AGG_BWCR_BW, bw); in mt7603_set_channel()
161 ret = mt7603_mcu_set_channel(dev); in mt7603_set_channel()
175 memcpy(dev->rssi_offset, rssi_data, sizeof(dev->rssi_offset)); in mt7603_set_channel()
178 mt76_hw(dev)->wiphy->bands[def->chan->band]->channels) << 1; in mt7603_set_channel()
179 mt76_wr(dev, MT_WF_RMAC_CH_FREQ, idx); in mt7603_set_channel()
180 mt7603_mac_set_timing(dev); in mt7603_set_channel()
181 mt7603_mac_start(dev); in mt7603_set_channel()
183 clear_bit(MT76_RESET, &dev->mphy.state); in mt7603_set_channel()
185 mt76_txq_schedule_all(&dev->mphy); in mt7603_set_channel()
187 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work, in mt7603_set_channel()
191 mt76_clear(dev, MT_MIB_CTL, MT_MIB_CTL_READ_CLR_DIS); in mt7603_set_channel()
192 mt76_set(dev, MT_MIB_CTL, in mt7603_set_channel()
194 mt76_rr(dev, MT_MIB_STAT_CCA); in mt7603_set_channel()
195 mt7603_cca_stats_reset(dev); in mt7603_set_channel()
197 dev->mphy.survey_time = ktime_get_boottime(); in mt7603_set_channel()
199 mt7603_init_edcca(dev); in mt7603_set_channel()
202 if (!(mt76_hw(dev)->conf.flags & IEEE80211_CONF_OFFCHANNEL)) in mt7603_set_channel()
203 mt7603_beacon_set_timer(dev, -1, dev->mt76.beacon_int); in mt7603_set_channel()
204 mutex_unlock(&dev->mt76.mutex); in mt7603_set_channel()
206 tasklet_enable(&dev->mt76.pre_tbtt_tasklet); in mt7603_set_channel()
209 mt7603_mac_work(&dev->mphy.mac_work.work); in mt7603_set_channel()
219 struct mt7603_dev *dev = hw->priv; in mt7603_set_sar_specs() local
220 struct mt76_phy *mphy = &dev->mphy; in mt7603_set_sar_specs()
236 struct mt7603_dev *dev = hw->priv; in mt7603_config() local
244 mutex_lock(&dev->mt76.mutex); in mt7603_config()
247 dev->rxfilter |= MT_WF_RFCR_DROP_OTHER_UC; in mt7603_config()
249 dev->rxfilter &= ~MT_WF_RFCR_DROP_OTHER_UC; in mt7603_config()
251 mt76_wr(dev, MT_WF_RFCR, dev->rxfilter); in mt7603_config()
253 mutex_unlock(&dev->mt76.mutex); in mt7603_config()
263 struct mt7603_dev *dev = hw->priv; in mt7603_configure_filter() local
268 dev->rxfilter &= ~(_hw); \ in mt7603_configure_filter()
269 dev->rxfilter |= !(flags & FIF_##_flag) * (_hw); \ in mt7603_configure_filter()
272 dev->rxfilter &= ~(MT_WF_RFCR_DROP_OTHER_BSS | in mt7603_configure_filter()
296 mt76_wr(dev, MT_WF_RFCR, dev->rxfilter); in mt7603_configure_filter()
303 struct mt7603_dev *dev = hw->priv; in mt7603_bss_info_changed() local
306 mutex_lock(&dev->mt76.mutex); in mt7603_bss_info_changed()
310 mt76_wr(dev, MT_BSSID0(mvif->idx), in mt7603_bss_info_changed()
312 mt76_wr(dev, MT_BSSID1(mvif->idx), in mt7603_bss_info_changed()
316 mt76_wr(dev, MT_BSSID0(mvif->idx), 0); in mt7603_bss_info_changed()
317 mt76_wr(dev, MT_BSSID1(mvif->idx), 0); in mt7603_bss_info_changed()
324 if (slottime != dev->slottime) { in mt7603_bss_info_changed()
325 dev->slottime = slottime; in mt7603_bss_info_changed()
326 mt7603_mac_set_timing(dev); in mt7603_bss_info_changed()
333 tasklet_disable(&dev->mt76.pre_tbtt_tasklet); in mt7603_bss_info_changed()
334 mt7603_beacon_set_timer(dev, mvif->idx, beacon_int); in mt7603_bss_info_changed()
335 tasklet_enable(&dev->mt76.pre_tbtt_tasklet); in mt7603_bss_info_changed()
338 mutex_unlock(&dev->mt76.mutex); in mt7603_bss_info_changed()
345 struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76); in mt7603_sta_add() local
351 idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7603_WTBL_STA - 1); in mt7603_sta_add()
362 mt7603_wtbl_init(dev, idx, mvif->idx, sta->addr); in mt7603_sta_add()
363 mt7603_wtbl_set_ps(dev, msta, false); in mt7603_sta_add()
375 struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76); in mt7603_sta_assoc() local
377 mt7603_wtbl_update_cap(dev, sta); in mt7603_sta_assoc()
384 struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76); in mt7603_sta_remove() local
389 spin_lock_bh(&dev->ps_lock); in mt7603_sta_remove()
391 mt7603_filter_tx(dev, mvif->idx, wcid->idx, true); in mt7603_sta_remove()
392 spin_unlock_bh(&dev->ps_lock); in mt7603_sta_remove()
399 mt7603_wtbl_clear(dev, wcid->idx); in mt7603_sta_remove()
403 mt7603_ps_tx_list(struct mt7603_dev *dev, struct sk_buff_head *list) in mt7603_ps_tx_list() argument
410 mt76_tx_queue_skb_raw(dev, dev->mphy.q_tx[qid], skb, 0); in mt7603_ps_tx_list()
417 struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76); in mt7603_sta_ps() local
421 mt76_stop_tx_queues(&dev->mphy, sta, true); in mt7603_sta_ps()
422 mt7603_wtbl_set_ps(dev, msta, ps); in mt7603_sta_ps()
428 spin_lock_bh(&dev->ps_lock); in mt7603_sta_ps()
430 spin_unlock_bh(&dev->ps_lock); in mt7603_sta_ps()
432 mt7603_ps_tx_list(dev, &list); in mt7603_sta_ps()
451 struct mt7603_dev *dev = hw->priv; in mt7603_release_buffered_frames() local
458 mt7603_wtbl_set_ps(dev, msta, false); in mt7603_release_buffered_frames()
460 spin_lock_bh(&dev->ps_lock); in mt7603_release_buffered_frames()
474 spin_unlock_bh(&dev->ps_lock); in mt7603_release_buffered_frames()
479 mt7603_ps_tx_list(dev, &list); in mt7603_release_buffered_frames()
491 struct mt7603_dev *dev = hw->priv; in mt7603_set_key() local
527 mt76_wcid_key_setup(&dev->mt76, wcid, key); in mt7603_set_key()
529 return mt7603_wtbl_set_key(dev, wcid->idx, key); in mt7603_set_key()
537 struct mt7603_dev *dev = hw->priv; in mt7603_conf_tx() local
542 queue = dev->mphy.q_tx[queue]->hw_idx; in mt7603_conf_tx()
549 mutex_lock(&dev->mt76.mutex); in mt7603_conf_tx()
550 mt7603_mac_stop(dev); in mt7603_conf_tx()
552 val = mt76_rr(dev, MT_WMM_TXOP(queue)); in mt7603_conf_tx()
555 mt76_wr(dev, MT_WMM_TXOP(queue), val); in mt7603_conf_tx()
557 val = mt76_rr(dev, MT_WMM_AIFSN); in mt7603_conf_tx()
560 mt76_wr(dev, MT_WMM_AIFSN, val); in mt7603_conf_tx()
562 val = mt76_rr(dev, MT_WMM_CWMIN); in mt7603_conf_tx()
565 mt76_wr(dev, MT_WMM_CWMIN, val); in mt7603_conf_tx()
567 val = mt76_rr(dev, MT_WMM_CWMAX(queue)); in mt7603_conf_tx()
570 mt76_wr(dev, MT_WMM_CWMAX(queue), val); in mt7603_conf_tx()
572 mt7603_mac_start(dev); in mt7603_conf_tx()
573 mutex_unlock(&dev->mt76.mutex); in mt7603_conf_tx()
589 struct mt7603_dev *dev = hw->priv; in mt7603_ampdu_action() local
604 mutex_lock(&dev->mt76.mutex); in mt7603_ampdu_action()
607 mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn, in mt7603_ampdu_action()
609 mt7603_mac_rx_ba_reset(dev, sta->addr, tid); in mt7603_ampdu_action()
612 mt76_rx_aggr_stop(&dev->mt76, &msta->wcid, tid); in mt7603_ampdu_action()
617 mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, ba_size); in mt7603_ampdu_action()
622 mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, -1); in mt7603_ampdu_action()
630 mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, -1); in mt7603_ampdu_action()
634 mutex_unlock(&dev->mt76.mutex); in mt7603_ampdu_action()
643 struct mt7603_dev *dev = hw->priv; in mt7603_sta_rate_tbl_update() local
651 spin_lock_bh(&dev->mt76.lock); in mt7603_sta_rate_tbl_update()
661 mt7603_wtbl_set_rates(dev, msta, NULL, msta->rates); in mt7603_sta_rate_tbl_update()
663 mt7603_wtbl_set_smps(dev, msta, in mt7603_sta_rate_tbl_update()
665 spin_unlock_bh(&dev->mt76.lock); in mt7603_sta_rate_tbl_update()
671 struct mt7603_dev *dev = hw->priv; in mt7603_set_coverage_class() local
673 mutex_lock(&dev->mt76.mutex); in mt7603_set_coverage_class()
674 dev->coverage_class = max_t(s16, coverage_class, 0); in mt7603_set_coverage_class()
675 mt7603_mac_set_timing(dev); in mt7603_set_coverage_class()
676 mutex_unlock(&dev->mt76.mutex); in mt7603_set_coverage_class()
685 struct mt7603_dev *dev = hw->priv; in mt7603_tx() local
686 struct mt76_wcid *wcid = &dev->global_sta.wcid; in mt7603_tx()
700 mt76_tx(&dev->mphy, control->sta, wcid, skb); in mt7603_tx()