main.c (ffa1bf97425bd511b105ce769976e20a845a71e9) | main.c (67aa27431c7f871962fccdb70ae1f3883691e958) |
---|---|
1// SPDX-License-Identifier: ISC 2/* Copyright (C) 2020 MediaTek Inc. */ 3 4#include <linux/etherdevice.h> 5#include <linux/platform_device.h> 6#include <linux/pci.h> 7#include <linux/module.h> 8#include "mt7921.h" --- 162 unchanged lines hidden (view full) --- 171 172static int mt7921_start(struct ieee80211_hw *hw) 173{ 174 struct mt7921_dev *dev = mt7921_hw_dev(hw); 175 struct mt7921_phy *phy = mt7921_hw_phy(hw); 176 177 mutex_lock(&dev->mt76.mutex); 178 | 1// SPDX-License-Identifier: ISC 2/* Copyright (C) 2020 MediaTek Inc. */ 3 4#include <linux/etherdevice.h> 5#include <linux/platform_device.h> 6#include <linux/pci.h> 7#include <linux/module.h> 8#include "mt7921.h" --- 162 unchanged lines hidden (view full) --- 171 172static int mt7921_start(struct ieee80211_hw *hw) 173{ 174 struct mt7921_dev *dev = mt7921_hw_dev(hw); 175 struct mt7921_phy *phy = mt7921_hw_phy(hw); 176 177 mutex_lock(&dev->mt76.mutex); 178 |
179 mt7921_mcu_set_mac(dev, 0, true, false); 180 mt7921_mcu_set_channel_domain(phy); | 179 mt76_connac_mcu_set_mac_enable(&dev->mt76, 0, true, false); 180 mt76_connac_mcu_set_channel_domain(phy->mt76); 181 |
181 mt7921_mcu_set_chan_info(phy, MCU_EXT_CMD_SET_RX_PATH); 182 mt7921_mac_reset_counters(phy); 183 set_bit(MT76_STATE_RUNNING, &phy->mt76->state); 184 185 ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work, 186 MT7921_WATCHDOG_TIME); 187 188 mutex_unlock(&dev->mt76.mutex); --- 5 unchanged lines hidden (view full) --- 194{ 195 struct mt7921_dev *dev = mt7921_hw_dev(hw); 196 struct mt7921_phy *phy = mt7921_hw_phy(hw); 197 198 cancel_delayed_work_sync(&phy->mt76->mac_work); 199 200 mutex_lock(&dev->mt76.mutex); 201 clear_bit(MT76_STATE_RUNNING, &phy->mt76->state); | 182 mt7921_mcu_set_chan_info(phy, MCU_EXT_CMD_SET_RX_PATH); 183 mt7921_mac_reset_counters(phy); 184 set_bit(MT76_STATE_RUNNING, &phy->mt76->state); 185 186 ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work, 187 MT7921_WATCHDOG_TIME); 188 189 mutex_unlock(&dev->mt76.mutex); --- 5 unchanged lines hidden (view full) --- 195{ 196 struct mt7921_dev *dev = mt7921_hw_dev(hw); 197 struct mt7921_phy *phy = mt7921_hw_phy(hw); 198 199 cancel_delayed_work_sync(&phy->mt76->mac_work); 200 201 mutex_lock(&dev->mt76.mutex); 202 clear_bit(MT76_STATE_RUNNING, &phy->mt76->state); |
202 mt7921_mcu_set_mac(dev, 0, false, false); | 203 mt76_connac_mcu_set_mac_enable(&dev->mt76, 0, false, false); |
203 mutex_unlock(&dev->mt76.mutex); 204} 205 206static inline int get_free_idx(u32 mask, u8 start, u8 end) 207{ 208 return ffs(~mask & GENMASK(end, start)); 209} 210 --- 69 unchanged lines hidden (view full) --- 280 ret = -ENOSPC; 281 goto out; 282 } 283 mvif->mt76.omac_idx = idx; 284 mvif->phy = phy; 285 mvif->mt76.band_idx = 0; 286 mvif->mt76.wmm_idx = mvif->mt76.idx % MT7921_MAX_WMM_SETS; 287 | 204 mutex_unlock(&dev->mt76.mutex); 205} 206 207static inline int get_free_idx(u32 mask, u8 start, u8 end) 208{ 209 return ffs(~mask & GENMASK(end, start)); 210} 211 --- 69 unchanged lines hidden (view full) --- 281 ret = -ENOSPC; 282 goto out; 283 } 284 mvif->mt76.omac_idx = idx; 285 mvif->phy = phy; 286 mvif->mt76.band_idx = 0; 287 mvif->mt76.wmm_idx = mvif->mt76.idx % MT7921_MAX_WMM_SETS; 288 |
288 ret = mt7921_mcu_uni_add_dev(dev, vif, true); | 289 ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, 290 true); |
289 if (ret) 290 goto out; 291 292 dev->mt76.vif_mask |= BIT(mvif->mt76.idx); 293 phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx); 294 295 idx = MT7921_WTBL_RESERVED - mvif->mt76.idx; 296 --- 31 unchanged lines hidden (view full) --- 328 struct mt7921_sta *msta = &mvif->sta; 329 struct mt7921_dev *dev = mt7921_hw_dev(hw); 330 struct mt7921_phy *phy = mt7921_hw_phy(hw); 331 int idx = msta->wcid.idx; 332 333 if (vif == phy->monitor_vif) 334 phy->monitor_vif = NULL; 335 | 291 if (ret) 292 goto out; 293 294 dev->mt76.vif_mask |= BIT(mvif->mt76.idx); 295 phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx); 296 297 idx = MT7921_WTBL_RESERVED - mvif->mt76.idx; 298 --- 31 unchanged lines hidden (view full) --- 330 struct mt7921_sta *msta = &mvif->sta; 331 struct mt7921_dev *dev = mt7921_hw_dev(hw); 332 struct mt7921_phy *phy = mt7921_hw_phy(hw); 333 int idx = msta->wcid.idx; 334 335 if (vif == phy->monitor_vif) 336 phy->monitor_vif = NULL; 337 |
336 mt7921_mcu_uni_add_dev(dev, vif, false); | 338 mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, false); |
337 338 rcu_assign_pointer(dev->mt76.wcid[idx], NULL); 339 340 mutex_lock(&dev->mt76.mutex); 341 dev->mt76.vif_mask &= ~BIT(mvif->mt76.idx); 342 phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx); 343 mutex_unlock(&dev->mt76.mutex); 344 --- 239 unchanged lines hidden (view full) --- 584 msta->vif = mvif; 585 msta->wcid.sta = 1; 586 msta->wcid.idx = idx; 587 msta->wcid.ext_phy = mvif->mt76.band_idx; 588 msta->wcid.tx_info |= MT_WCID_TX_INFO_SET; 589 msta->stats.jiffies = jiffies; 590 591 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) | 339 340 rcu_assign_pointer(dev->mt76.wcid[idx], NULL); 341 342 mutex_lock(&dev->mt76.mutex); 343 dev->mt76.vif_mask &= ~BIT(mvif->mt76.idx); 344 phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx); 345 mutex_unlock(&dev->mt76.mutex); 346 --- 239 unchanged lines hidden (view full) --- 586 msta->vif = mvif; 587 msta->wcid.sta = 1; 588 msta->wcid.idx = idx; 589 msta->wcid.ext_phy = mvif->mt76.band_idx; 590 msta->wcid.tx_info |= MT_WCID_TX_INFO_SET; 591 msta->stats.jiffies = jiffies; 592 593 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) |
592 mt7921_mcu_uni_add_bss(&dev->phy, vif, true); | 594 mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.wcid, 595 true); 596 |
593 mt7921_mac_wtbl_update(dev, idx, 594 MT_WTBL_UPDATE_ADM_COUNT_CLEAR); 595 | 597 mt7921_mac_wtbl_update(dev, idx, 598 MT_WTBL_UPDATE_ADM_COUNT_CLEAR); 599 |
596 ret = mt7921_mcu_uni_add_sta(dev, vif, sta, true); | 600 ret = mt76_connac_mcu_add_sta_cmd(&dev->mphy, vif, sta, &msta->wcid, 601 true, MCU_UNI_CMD_STA_REC_UPDATE); |
597 if (ret) 598 return ret; 599 600 return 0; 601} 602 603void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, 604 struct ieee80211_sta *sta) 605{ 606 struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); 607 struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv; 608 | 602 if (ret) 603 return ret; 604 605 return 0; 606} 607 608void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, 609 struct ieee80211_sta *sta) 610{ 611 struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); 612 struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv; 613 |
609 mt7921_mcu_uni_add_sta(dev, vif, sta, false); | 614 mt76_connac_mcu_add_sta_cmd(&dev->mphy, vif, sta, &msta->wcid, false, 615 MCU_UNI_CMD_STA_REC_UPDATE); |
610 mt7921_mac_wtbl_update(dev, msta->wcid.idx, 611 MT_WTBL_UPDATE_ADM_COUNT_CLEAR); | 616 mt7921_mac_wtbl_update(dev, msta->wcid.idx, 617 MT_WTBL_UPDATE_ADM_COUNT_CLEAR); |
612 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) 613 mt7921_mcu_uni_add_bss(&dev->phy, vif, false); | |
614 | 618 |
619 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) { 620 struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv; 621 622 mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.wcid, 623 false); 624 } 625 |
|
615 spin_lock_bh(&dev->sta_poll_lock); 616 if (!list_empty(&msta->poll_list)) 617 list_del_init(&msta->poll_list); 618 if (!list_empty(&msta->stats_list)) 619 list_del_init(&msta->stats_list); 620 spin_unlock_bh(&dev->sta_poll_lock); 621} 622 --- 22 unchanged lines hidden (view full) --- 645 } 646 647 mt76_tx(mphy, control->sta, wcid, skb); 648} 649 650static int mt7921_set_rts_threshold(struct ieee80211_hw *hw, u32 val) 651{ 652 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 626 spin_lock_bh(&dev->sta_poll_lock); 627 if (!list_empty(&msta->poll_list)) 628 list_del_init(&msta->poll_list); 629 if (!list_empty(&msta->stats_list)) 630 list_del_init(&msta->stats_list); 631 spin_unlock_bh(&dev->sta_poll_lock); 632} 633 --- 22 unchanged lines hidden (view full) --- 656 } 657 658 mt76_tx(mphy, control->sta, wcid, skb); 659} 660 661static int mt7921_set_rts_threshold(struct ieee80211_hw *hw, u32 val) 662{ 663 struct mt7921_dev *dev = mt7921_hw_dev(hw); |
653 struct mt7921_phy *phy = mt7921_hw_phy(hw); | |
654 655 mutex_lock(&dev->mt76.mutex); | 664 665 mutex_lock(&dev->mt76.mutex); |
656 mt7921_mcu_set_rts_thresh(phy, val); | 666 mt76_connac_mcu_set_rts_thresh(&dev->mt76, val, 0); |
657 mutex_unlock(&dev->mt76.mutex); 658 659 return 0; 660} 661 662static int 663mt7921_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 664 struct ieee80211_ampdu_params *params) --- 416 unchanged lines hidden --- | 667 mutex_unlock(&dev->mt76.mutex); 668 669 return 0; 670} 671 672static int 673mt7921_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 674 struct ieee80211_ampdu_params *params) --- 416 unchanged lines hidden --- |