main.c (78562b2cafc61a0c08dc949eacb942ac756aae37) | main.c (975e122ddb7cd6f67bff974d2ea00c5568d2014c) |
---|---|
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 <net/ipv6.h> --- 250 unchanged lines hidden (view full) --- 259 err = __mt7921_start(phy); 260 mt7921_mutex_release(phy->dev); 261 262 return err; 263} 264 265void mt7921_stop(struct ieee80211_hw *hw) 266{ | 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 <net/ipv6.h> --- 250 unchanged lines hidden (view full) --- 259 err = __mt7921_start(phy); 260 mt7921_mutex_release(phy->dev); 261 262 return err; 263} 264 265void mt7921_stop(struct ieee80211_hw *hw) 266{ |
267 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 267 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
268 struct mt792x_phy *phy = mt7921_hw_phy(hw); 269 270 cancel_delayed_work_sync(&phy->mt76->mac_work); 271 272 cancel_delayed_work_sync(&dev->pm.ps_work); 273 cancel_work_sync(&dev->pm.wake_work); 274 cancel_work_sync(&dev->reset_work); 275 mt76_connac_free_pending_tx_skbs(&dev->pm, NULL); --- 4 unchanged lines hidden (view full) --- 280 mt7921_mutex_release(dev); 281} 282EXPORT_SYMBOL_GPL(mt7921_stop); 283 284static int mt7921_add_interface(struct ieee80211_hw *hw, 285 struct ieee80211_vif *vif) 286{ 287 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; | 268 struct mt792x_phy *phy = mt7921_hw_phy(hw); 269 270 cancel_delayed_work_sync(&phy->mt76->mac_work); 271 272 cancel_delayed_work_sync(&dev->pm.ps_work); 273 cancel_work_sync(&dev->pm.wake_work); 274 cancel_work_sync(&dev->reset_work); 275 mt76_connac_free_pending_tx_skbs(&dev->pm, NULL); --- 4 unchanged lines hidden (view full) --- 280 mt7921_mutex_release(dev); 281} 282EXPORT_SYMBOL_GPL(mt7921_stop); 283 284static int mt7921_add_interface(struct ieee80211_hw *hw, 285 struct ieee80211_vif *vif) 286{ 287 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; |
288 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 288 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
289 struct mt792x_phy *phy = mt7921_hw_phy(hw); 290 struct mt76_txq *mtxq; 291 int idx, ret = 0; 292 293 mt7921_mutex_acquire(dev); 294 295 mvif->mt76.idx = __ffs64(~dev->mt76.vif_mask); 296 if (mvif->mt76.idx >= MT7921_MAX_INTERFACES) { --- 41 unchanged lines hidden (view full) --- 338 return ret; 339} 340 341static void mt7921_remove_interface(struct ieee80211_hw *hw, 342 struct ieee80211_vif *vif) 343{ 344 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 345 struct mt792x_sta *msta = &mvif->sta; | 289 struct mt792x_phy *phy = mt7921_hw_phy(hw); 290 struct mt76_txq *mtxq; 291 int idx, ret = 0; 292 293 mt7921_mutex_acquire(dev); 294 295 mvif->mt76.idx = __ffs64(~dev->mt76.vif_mask); 296 if (mvif->mt76.idx >= MT7921_MAX_INTERFACES) { --- 41 unchanged lines hidden (view full) --- 338 return ret; 339} 340 341static void mt7921_remove_interface(struct ieee80211_hw *hw, 342 struct ieee80211_vif *vif) 343{ 344 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 345 struct mt792x_sta *msta = &mvif->sta; |
346 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 346 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
347 struct mt792x_phy *phy = mt7921_hw_phy(hw); 348 int idx = msta->wcid.idx; 349 350 mt7921_mutex_acquire(dev); 351 mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid); 352 mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, false); 353 354 rcu_assign_pointer(dev->mt76.wcid[idx], NULL); --- 112 unchanged lines hidden (view full) --- 467 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 468 struct mt792x_phy *phy = mt7921_hw_phy(hw); 469 470 return mt7921_abort_roc(phy, mvif); 471} 472 473static int mt7921_set_channel(struct mt792x_phy *phy) 474{ | 347 struct mt792x_phy *phy = mt7921_hw_phy(hw); 348 int idx = msta->wcid.idx; 349 350 mt7921_mutex_acquire(dev); 351 mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid); 352 mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, false); 353 354 rcu_assign_pointer(dev->mt76.wcid[idx], NULL); --- 112 unchanged lines hidden (view full) --- 467 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 468 struct mt792x_phy *phy = mt7921_hw_phy(hw); 469 470 return mt7921_abort_roc(phy, mvif); 471} 472 473static int mt7921_set_channel(struct mt792x_phy *phy) 474{ |
475 struct mt7921_dev *dev = phy->dev; | 475 struct mt792x_dev *dev = phy->dev; |
476 int ret; 477 478 cancel_delayed_work_sync(&phy->mt76->mac_work); 479 480 mt7921_mutex_acquire(dev); 481 set_bit(MT76_RESET, &phy->mt76->state); 482 483 mt76_set_channel(phy->mt76); --- 17 unchanged lines hidden (view full) --- 501 502 return ret; 503} 504 505static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 506 struct ieee80211_vif *vif, struct ieee80211_sta *sta, 507 struct ieee80211_key_conf *key) 508{ | 476 int ret; 477 478 cancel_delayed_work_sync(&phy->mt76->mac_work); 479 480 mt7921_mutex_acquire(dev); 481 set_bit(MT76_RESET, &phy->mt76->state); 482 483 mt76_set_channel(phy->mt76); --- 17 unchanged lines hidden (view full) --- 501 502 return ret; 503} 504 505static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 506 struct ieee80211_vif *vif, struct ieee80211_sta *sta, 507 struct ieee80211_key_conf *key) 508{ |
509 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 509 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
510 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 511 struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv : 512 &mvif->sta; 513 struct mt76_wcid *wcid = &msta->wcid; 514 u8 *wcid_keyidx = &wcid->hw_key_idx; 515 int idx = key->keyidx, err = 0; 516 517 /* The hardware does not support per-STA RX GTK, fallback --- 55 unchanged lines hidden (view full) --- 573 mt7921_mutex_release(dev); 574 575 return err; 576} 577 578static void 579mt7921_pm_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) 580{ | 510 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 511 struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv : 512 &mvif->sta; 513 struct mt76_wcid *wcid = &msta->wcid; 514 u8 *wcid_keyidx = &wcid->hw_key_idx; 515 int idx = key->keyidx, err = 0; 516 517 /* The hardware does not support per-STA RX GTK, fallback --- 55 unchanged lines hidden (view full) --- 573 mt7921_mutex_release(dev); 574 575 return err; 576} 577 578static void 579mt7921_pm_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) 580{ |
581 struct mt7921_dev *dev = priv; | 581 struct mt792x_dev *dev = priv; |
582 struct ieee80211_hw *hw = mt76_hw(dev); 583 bool pm_enable = dev->pm.enable; 584 int err; 585 586 err = mt7921_mcu_set_beacon_filter(dev, vif, pm_enable); 587 if (err < 0) 588 return; 589 --- 4 unchanged lines hidden (view full) --- 594 vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER; 595 __clear_bit(IEEE80211_HW_CONNECTION_MONITOR, hw->flags); 596 } 597} 598 599static void 600mt7921_sniffer_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) 601{ | 582 struct ieee80211_hw *hw = mt76_hw(dev); 583 bool pm_enable = dev->pm.enable; 584 int err; 585 586 err = mt7921_mcu_set_beacon_filter(dev, vif, pm_enable); 587 if (err < 0) 588 return; 589 --- 4 unchanged lines hidden (view full) --- 594 vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER; 595 __clear_bit(IEEE80211_HW_CONNECTION_MONITOR, hw->flags); 596 } 597} 598 599static void 600mt7921_sniffer_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) 601{ |
602 struct mt7921_dev *dev = priv; | 602 struct mt792x_dev *dev = priv; |
603 struct ieee80211_hw *hw = mt76_hw(dev); 604 struct mt76_connac_pm *pm = &dev->pm; 605 bool monitor = !!(hw->conf.flags & IEEE80211_CONF_MONITOR); 606 607 mt7921_mcu_set_sniffer(dev, vif, monitor); 608 pm->enable = pm->enable_user && !monitor; 609 pm->ds_enable = pm->ds_enable_user && !monitor; 610 611 mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable); 612 613 if (monitor) 614 mt7921_mcu_set_beacon_filter(dev, vif, false); 615} 616 | 603 struct ieee80211_hw *hw = mt76_hw(dev); 604 struct mt76_connac_pm *pm = &dev->pm; 605 bool monitor = !!(hw->conf.flags & IEEE80211_CONF_MONITOR); 606 607 mt7921_mcu_set_sniffer(dev, vif, monitor); 608 pm->enable = pm->enable_user && !monitor; 609 pm->ds_enable = pm->ds_enable_user && !monitor; 610 611 mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable); 612 613 if (monitor) 614 mt7921_mcu_set_beacon_filter(dev, vif, false); 615} 616 |
617void mt7921_set_runtime_pm(struct mt7921_dev *dev) | 617void mt7921_set_runtime_pm(struct mt792x_dev *dev) |
618{ 619 struct ieee80211_hw *hw = mt76_hw(dev); 620 struct mt76_connac_pm *pm = &dev->pm; 621 bool monitor = !!(hw->conf.flags & IEEE80211_CONF_MONITOR); 622 623 pm->enable = pm->enable_user && !monitor; 624 ieee80211_iterate_active_interfaces(hw, 625 IEEE80211_IFACE_ITER_RESUME_ALL, 626 mt7921_pm_interface_iter, dev); 627 pm->ds_enable = pm->ds_enable_user && !monitor; 628 mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable); 629} 630 631static int mt7921_config(struct ieee80211_hw *hw, u32 changed) 632{ | 618{ 619 struct ieee80211_hw *hw = mt76_hw(dev); 620 struct mt76_connac_pm *pm = &dev->pm; 621 bool monitor = !!(hw->conf.flags & IEEE80211_CONF_MONITOR); 622 623 pm->enable = pm->enable_user && !monitor; 624 ieee80211_iterate_active_interfaces(hw, 625 IEEE80211_IFACE_ITER_RESUME_ALL, 626 mt7921_pm_interface_iter, dev); 627 pm->ds_enable = pm->ds_enable_user && !monitor; 628 mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable); 629} 630 631static int mt7921_config(struct ieee80211_hw *hw, u32 changed) 632{ |
633 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 633 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
634 struct mt792x_phy *phy = mt7921_hw_phy(hw); 635 int ret = 0; 636 637 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { 638 ieee80211_stop_queues(hw); 639 ret = mt7921_set_channel(phy); 640 if (ret) 641 return ret; --- 39 unchanged lines hidden (view full) --- 681 unsigned int *total_flags, 682 u64 multicast) 683{ 684#define MT7921_FILTER_FCSFAIL BIT(2) 685#define MT7921_FILTER_CONTROL BIT(5) 686#define MT7921_FILTER_OTHER_BSS BIT(6) 687#define MT7921_FILTER_ENABLE BIT(31) 688 | 634 struct mt792x_phy *phy = mt7921_hw_phy(hw); 635 int ret = 0; 636 637 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { 638 ieee80211_stop_queues(hw); 639 ret = mt7921_set_channel(phy); 640 if (ret) 641 return ret; --- 39 unchanged lines hidden (view full) --- 681 unsigned int *total_flags, 682 u64 multicast) 683{ 684#define MT7921_FILTER_FCSFAIL BIT(2) 685#define MT7921_FILTER_CONTROL BIT(5) 686#define MT7921_FILTER_OTHER_BSS BIT(6) 687#define MT7921_FILTER_ENABLE BIT(31) 688 |
689 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 689 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
690 u32 flags = MT7921_FILTER_ENABLE; 691 692#define MT7921_FILTER(_fif, _type) do { \ 693 if (*total_flags & (_fif)) \ 694 flags |= MT7921_FILTER_##_type; \ 695 } while (0) 696 697 MT7921_FILTER(FIF_FCSFAIL, FCSFAIL); --- 8 unchanged lines hidden (view full) --- 706} 707 708static void mt7921_bss_info_changed(struct ieee80211_hw *hw, 709 struct ieee80211_vif *vif, 710 struct ieee80211_bss_conf *info, 711 u64 changed) 712{ 713 struct mt792x_phy *phy = mt7921_hw_phy(hw); | 690 u32 flags = MT7921_FILTER_ENABLE; 691 692#define MT7921_FILTER(_fif, _type) do { \ 693 if (*total_flags & (_fif)) \ 694 flags |= MT7921_FILTER_##_type; \ 695 } while (0) 696 697 MT7921_FILTER(FIF_FCSFAIL, FCSFAIL); --- 8 unchanged lines hidden (view full) --- 706} 707 708static void mt7921_bss_info_changed(struct ieee80211_hw *hw, 709 struct ieee80211_vif *vif, 710 struct ieee80211_bss_conf *info, 711 u64 changed) 712{ 713 struct mt792x_phy *phy = mt7921_hw_phy(hw); |
714 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 714 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
715 716 mt7921_mutex_acquire(dev); 717 718 if (changed & BSS_CHANGED_ERP_SLOT) { 719 int slottime = info->use_short_slot ? 9 : 20; 720 721 if (slottime != phy->slottime) { 722 phy->slottime = slottime; --- 27 unchanged lines hidden (view full) --- 750 } 751 752 mt7921_mutex_release(dev); 753} 754 755int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, 756 struct ieee80211_sta *sta) 757{ | 715 716 mt7921_mutex_acquire(dev); 717 718 if (changed & BSS_CHANGED_ERP_SLOT) { 719 int slottime = info->use_short_slot ? 9 : 20; 720 721 if (slottime != phy->slottime) { 722 phy->slottime = slottime; --- 27 unchanged lines hidden (view full) --- 750 } 751 752 mt7921_mutex_release(dev); 753} 754 755int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, 756 struct ieee80211_sta *sta) 757{ |
758 struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); | 758 struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); |
759 struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; 760 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 761 int ret, idx; 762 763 idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7921_WTBL_STA - 1); 764 if (idx < 0) 765 return -ENOSPC; 766 --- 24 unchanged lines hidden (view full) --- 791 792 return 0; 793} 794EXPORT_SYMBOL_GPL(mt7921_mac_sta_add); 795 796void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, 797 struct ieee80211_sta *sta) 798{ | 759 struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; 760 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 761 int ret, idx; 762 763 idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7921_WTBL_STA - 1); 764 if (idx < 0) 765 return -ENOSPC; 766 --- 24 unchanged lines hidden (view full) --- 791 792 return 0; 793} 794EXPORT_SYMBOL_GPL(mt7921_mac_sta_add); 795 796void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, 797 struct ieee80211_sta *sta) 798{ |
799 struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); | 799 struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); |
800 struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; 801 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 802 803 mt7921_mutex_acquire(dev); 804 805 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) 806 mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.wcid, 807 true, mvif->ctx); --- 8 unchanged lines hidden (view full) --- 816 817 mt7921_mutex_release(dev); 818} 819EXPORT_SYMBOL_GPL(mt7921_mac_sta_assoc); 820 821void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, 822 struct ieee80211_sta *sta) 823{ | 800 struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; 801 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 802 803 mt7921_mutex_acquire(dev); 804 805 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) 806 mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.wcid, 807 true, mvif->ctx); --- 8 unchanged lines hidden (view full) --- 816 817 mt7921_mutex_release(dev); 818} 819EXPORT_SYMBOL_GPL(mt7921_mac_sta_assoc); 820 821void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, 822 struct ieee80211_sta *sta) 823{ |
824 struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); | 824 struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); |
825 struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; 826 827 mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid); 828 mt76_connac_pm_wake(&dev->mphy, &dev->pm); 829 830 mt7921_mcu_sta_update(dev, sta, vif, false, MT76_STA_INFO_STATE_NONE); 831 mt7921_mac_wtbl_update(dev, msta->wcid.idx, 832 MT_WTBL_UPDATE_ADM_COUNT_CLEAR); --- 15 unchanged lines hidden (view full) --- 848 spin_unlock_bh(&dev->mt76.sta_poll_lock); 849 850 mt76_connac_power_save_sched(&dev->mphy, &dev->pm); 851} 852EXPORT_SYMBOL_GPL(mt7921_mac_sta_remove); 853 854void mt7921_tx_worker(struct mt76_worker *w) 855{ | 825 struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; 826 827 mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid); 828 mt76_connac_pm_wake(&dev->mphy, &dev->pm); 829 830 mt7921_mcu_sta_update(dev, sta, vif, false, MT76_STA_INFO_STATE_NONE); 831 mt7921_mac_wtbl_update(dev, msta->wcid.idx, 832 MT_WTBL_UPDATE_ADM_COUNT_CLEAR); --- 15 unchanged lines hidden (view full) --- 848 spin_unlock_bh(&dev->mt76.sta_poll_lock); 849 850 mt76_connac_power_save_sched(&dev->mphy, &dev->pm); 851} 852EXPORT_SYMBOL_GPL(mt7921_mac_sta_remove); 853 854void mt7921_tx_worker(struct mt76_worker *w) 855{ |
856 struct mt7921_dev *dev = container_of(w, struct mt7921_dev, | 856 struct mt792x_dev *dev = container_of(w, struct mt792x_dev, |
857 mt76.tx_worker); 858 859 if (!mt76_connac_pm_ref(&dev->mphy, &dev->pm)) { 860 queue_work(dev->mt76.wq, &dev->pm.wake_work); 861 return; 862 } 863 864 mt76_txq_schedule_all(&dev->mphy); 865 mt76_connac_pm_unref(&dev->mphy, &dev->pm); 866} 867 868static void mt7921_tx(struct ieee80211_hw *hw, 869 struct ieee80211_tx_control *control, 870 struct sk_buff *skb) 871{ | 857 mt76.tx_worker); 858 859 if (!mt76_connac_pm_ref(&dev->mphy, &dev->pm)) { 860 queue_work(dev->mt76.wq, &dev->pm.wake_work); 861 return; 862 } 863 864 mt76_txq_schedule_all(&dev->mphy); 865 mt76_connac_pm_unref(&dev->mphy, &dev->pm); 866} 867 868static void mt7921_tx(struct ieee80211_hw *hw, 869 struct ieee80211_tx_control *control, 870 struct sk_buff *skb) 871{ |
872 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 872 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
873 struct mt76_phy *mphy = hw->priv; 874 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 875 struct ieee80211_vif *vif = info->control.vif; 876 struct mt76_wcid *wcid = &dev->mt76.global_wcid; 877 int qid; 878 879 if (control->sta) { 880 struct mt792x_sta *sta; --- 21 unchanged lines hidden (view full) --- 902 skb_set_queue_mapping(skb, qid); 903 } 904 905 mt76_connac_pm_queue_skb(hw, &dev->pm, wcid, skb); 906} 907 908static int mt7921_set_rts_threshold(struct ieee80211_hw *hw, u32 val) 909{ | 873 struct mt76_phy *mphy = hw->priv; 874 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 875 struct ieee80211_vif *vif = info->control.vif; 876 struct mt76_wcid *wcid = &dev->mt76.global_wcid; 877 int qid; 878 879 if (control->sta) { 880 struct mt792x_sta *sta; --- 21 unchanged lines hidden (view full) --- 902 skb_set_queue_mapping(skb, qid); 903 } 904 905 mt76_connac_pm_queue_skb(hw, &dev->pm, wcid, skb); 906} 907 908static int mt7921_set_rts_threshold(struct ieee80211_hw *hw, u32 val) 909{ |
910 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 910 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
911 912 mt7921_mutex_acquire(dev); 913 mt76_connac_mcu_set_rts_thresh(&dev->mt76, val, 0); 914 mt7921_mutex_release(dev); 915 916 return 0; 917} 918 919static int 920mt7921_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 921 struct ieee80211_ampdu_params *params) 922{ 923 enum ieee80211_ampdu_mlme_action action = params->action; | 911 912 mt7921_mutex_acquire(dev); 913 mt76_connac_mcu_set_rts_thresh(&dev->mt76, val, 0); 914 mt7921_mutex_release(dev); 915 916 return 0; 917} 918 919static int 920mt7921_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 921 struct ieee80211_ampdu_params *params) 922{ 923 enum ieee80211_ampdu_mlme_action action = params->action; |
924 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 924 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
925 struct ieee80211_sta *sta = params->sta; 926 struct ieee80211_txq *txq = sta->txq[params->tid]; 927 struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; 928 u16 tid = params->tid; 929 u16 ssn = params->ssn; 930 struct mt76_txq *mtxq; 931 int ret = 0; 932 --- 41 unchanged lines hidden (view full) --- 974} 975 976static int mt7921_sta_state(struct ieee80211_hw *hw, 977 struct ieee80211_vif *vif, 978 struct ieee80211_sta *sta, 979 enum ieee80211_sta_state old_state, 980 enum ieee80211_sta_state new_state) 981{ | 925 struct ieee80211_sta *sta = params->sta; 926 struct ieee80211_txq *txq = sta->txq[params->tid]; 927 struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; 928 u16 tid = params->tid; 929 u16 ssn = params->ssn; 930 struct mt76_txq *mtxq; 931 int ret = 0; 932 --- 41 unchanged lines hidden (view full) --- 974} 975 976static int mt7921_sta_state(struct ieee80211_hw *hw, 977 struct ieee80211_vif *vif, 978 struct ieee80211_sta *sta, 979 enum ieee80211_sta_state old_state, 980 enum ieee80211_sta_state new_state) 981{ |
982 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 982 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
983 984 if (dev->pm.ds_enable) { 985 mt7921_mutex_acquire(dev); 986 mt76_connac_sta_state_dp(&dev->mt76, old_state, new_state); 987 mt7921_mutex_release(dev); 988 } 989 990 return mt76_sta_state(hw, vif, sta, old_state, new_state); --- 91 unchanged lines hidden (view full) --- 1082 "v_tx_nss_3", 1083 "v_tx_nss_4", 1084}; 1085 1086static void 1087mt7921_get_et_strings(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1088 u32 sset, u8 *data) 1089{ | 983 984 if (dev->pm.ds_enable) { 985 mt7921_mutex_acquire(dev); 986 mt76_connac_sta_state_dp(&dev->mt76, old_state, new_state); 987 mt7921_mutex_release(dev); 988 } 989 990 return mt76_sta_state(hw, vif, sta, old_state, new_state); --- 91 unchanged lines hidden (view full) --- 1082 "v_tx_nss_3", 1083 "v_tx_nss_4", 1084}; 1085 1086static void 1087mt7921_get_et_strings(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1088 u32 sset, u8 *data) 1089{ |
1090 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1090 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1091 1092 if (sset != ETH_SS_STATS) 1093 return; 1094 1095 memcpy(data, *mt7921_gstrings_stats, sizeof(mt7921_gstrings_stats)); 1096 1097 if (mt76_is_sdio(&dev->mt76)) 1098 return; 1099 1100 data += sizeof(mt7921_gstrings_stats); 1101 page_pool_ethtool_stats_get_strings(data); 1102} 1103 1104static int 1105mt7921_get_et_sset_count(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1106 int sset) 1107{ | 1091 1092 if (sset != ETH_SS_STATS) 1093 return; 1094 1095 memcpy(data, *mt7921_gstrings_stats, sizeof(mt7921_gstrings_stats)); 1096 1097 if (mt76_is_sdio(&dev->mt76)) 1098 return; 1099 1100 data += sizeof(mt7921_gstrings_stats); 1101 page_pool_ethtool_stats_get_strings(data); 1102} 1103 1104static int 1105mt7921_get_et_sset_count(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1106 int sset) 1107{ |
1108 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1108 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1109 1110 if (sset != ETH_SS_STATS) 1111 return 0; 1112 1113 if (mt76_is_sdio(&dev->mt76)) 1114 return ARRAY_SIZE(mt7921_gstrings_stats); 1115 1116 return ARRAY_SIZE(mt7921_gstrings_stats) + --- 14 unchanged lines hidden (view full) --- 1131 1132static 1133void mt7921_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1134 struct ethtool_stats *stats, u64 *data) 1135{ 1136 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 1137 int stats_size = ARRAY_SIZE(mt7921_gstrings_stats); 1138 struct mt792x_phy *phy = mt7921_hw_phy(hw); | 1109 1110 if (sset != ETH_SS_STATS) 1111 return 0; 1112 1113 if (mt76_is_sdio(&dev->mt76)) 1114 return ARRAY_SIZE(mt7921_gstrings_stats); 1115 1116 return ARRAY_SIZE(mt7921_gstrings_stats) + --- 14 unchanged lines hidden (view full) --- 1131 1132static 1133void mt7921_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1134 struct ethtool_stats *stats, u64 *data) 1135{ 1136 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 1137 int stats_size = ARRAY_SIZE(mt7921_gstrings_stats); 1138 struct mt792x_phy *phy = mt7921_hw_phy(hw); |
1139 struct mt7921_dev *dev = phy->dev; | 1139 struct mt792x_dev *dev = phy->dev; |
1140 struct mt76_mib_stats *mib = &phy->mib; 1141 struct mt76_ethtool_worker_info wi = { 1142 .data = data, 1143 .idx = mvif->mt76.idx, 1144 }; 1145 int i, ei = 0; 1146 1147 mt7921_mutex_acquire(dev); --- 51 unchanged lines hidden (view full) --- 1199 if (ei != stats_size) 1200 dev_err(dev->mt76.dev, "ei: %d SSTATS_LEN: %d", ei, stats_size); 1201} 1202 1203static u64 1204mt7921_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1205{ 1206 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; | 1140 struct mt76_mib_stats *mib = &phy->mib; 1141 struct mt76_ethtool_worker_info wi = { 1142 .data = data, 1143 .idx = mvif->mt76.idx, 1144 }; 1145 int i, ei = 0; 1146 1147 mt7921_mutex_acquire(dev); --- 51 unchanged lines hidden (view full) --- 1199 if (ei != stats_size) 1200 dev_err(dev->mt76.dev, "ei: %d SSTATS_LEN: %d", ei, stats_size); 1201} 1202 1203static u64 1204mt7921_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1205{ 1206 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; |
1207 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1207 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1208 u8 omac_idx = mvif->mt76.omac_idx; 1209 union { 1210 u64 t64; 1211 u32 t32[2]; 1212 } tsf; 1213 u16 n; 1214 1215 mt7921_mutex_acquire(dev); --- 9 unchanged lines hidden (view full) --- 1225 return tsf.t64; 1226} 1227 1228static void 1229mt7921_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1230 u64 timestamp) 1231{ 1232 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; | 1208 u8 omac_idx = mvif->mt76.omac_idx; 1209 union { 1210 u64 t64; 1211 u32 t32[2]; 1212 } tsf; 1213 u16 n; 1214 1215 mt7921_mutex_acquire(dev); --- 9 unchanged lines hidden (view full) --- 1225 return tsf.t64; 1226} 1227 1228static void 1229mt7921_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1230 u64 timestamp) 1231{ 1232 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; |
1233 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1233 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1234 u8 omac_idx = mvif->mt76.omac_idx; 1235 union { 1236 u64 t64; 1237 u32 t32[2]; 1238 } tsf = { .t64 = timestamp, }; 1239 u16 n; 1240 1241 mt7921_mutex_acquire(dev); --- 6 unchanged lines hidden (view full) --- 1248 1249 mt7921_mutex_release(dev); 1250} 1251 1252static void 1253mt7921_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class) 1254{ 1255 struct mt792x_phy *phy = mt7921_hw_phy(hw); | 1234 u8 omac_idx = mvif->mt76.omac_idx; 1235 union { 1236 u64 t64; 1237 u32 t32[2]; 1238 } tsf = { .t64 = timestamp, }; 1239 u16 n; 1240 1241 mt7921_mutex_acquire(dev); --- 6 unchanged lines hidden (view full) --- 1248 1249 mt7921_mutex_release(dev); 1250} 1251 1252static void 1253mt7921_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class) 1254{ 1255 struct mt792x_phy *phy = mt7921_hw_phy(hw); |
1256 struct mt7921_dev *dev = phy->dev; | 1256 struct mt792x_dev *dev = phy->dev; |
1257 1258 mt7921_mutex_acquire(dev); 1259 phy->coverage_class = max_t(s16, coverage_class, 0); 1260 mt7921_mac_set_timing(phy); 1261 mt7921_mutex_release(dev); 1262} 1263 1264void mt7921_scan_work(struct work_struct *work) --- 28 unchanged lines hidden (view full) --- 1293 dev_kfree_skb(skb); 1294 } 1295} 1296 1297static int 1298mt7921_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1299 struct ieee80211_scan_request *req) 1300{ | 1257 1258 mt7921_mutex_acquire(dev); 1259 phy->coverage_class = max_t(s16, coverage_class, 0); 1260 mt7921_mac_set_timing(phy); 1261 mt7921_mutex_release(dev); 1262} 1263 1264void mt7921_scan_work(struct work_struct *work) --- 28 unchanged lines hidden (view full) --- 1293 dev_kfree_skb(skb); 1294 } 1295} 1296 1297static int 1298mt7921_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1299 struct ieee80211_scan_request *req) 1300{ |
1301 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1301 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1302 struct mt76_phy *mphy = hw->priv; 1303 int err; 1304 1305 mt7921_mutex_acquire(dev); 1306 err = mt76_connac_mcu_hw_scan(mphy, vif, req); 1307 mt7921_mutex_release(dev); 1308 1309 return err; 1310} 1311 1312static void 1313mt7921_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1314{ | 1302 struct mt76_phy *mphy = hw->priv; 1303 int err; 1304 1305 mt7921_mutex_acquire(dev); 1306 err = mt76_connac_mcu_hw_scan(mphy, vif, req); 1307 mt7921_mutex_release(dev); 1308 1309 return err; 1310} 1311 1312static void 1313mt7921_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1314{ |
1315 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1315 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1316 struct mt76_phy *mphy = hw->priv; 1317 1318 mt7921_mutex_acquire(dev); 1319 mt76_connac_mcu_cancel_hw_scan(mphy, vif); 1320 mt7921_mutex_release(dev); 1321} 1322 1323static int 1324mt7921_start_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1325 struct cfg80211_sched_scan_request *req, 1326 struct ieee80211_scan_ies *ies) 1327{ | 1316 struct mt76_phy *mphy = hw->priv; 1317 1318 mt7921_mutex_acquire(dev); 1319 mt76_connac_mcu_cancel_hw_scan(mphy, vif); 1320 mt7921_mutex_release(dev); 1321} 1322 1323static int 1324mt7921_start_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1325 struct cfg80211_sched_scan_request *req, 1326 struct ieee80211_scan_ies *ies) 1327{ |
1328 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1328 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1329 struct mt76_phy *mphy = hw->priv; 1330 int err; 1331 1332 mt7921_mutex_acquire(dev); 1333 1334 err = mt76_connac_mcu_sched_scan_req(mphy, vif, req); 1335 if (err < 0) 1336 goto out; 1337 1338 err = mt76_connac_mcu_sched_scan_enable(mphy, vif, true); 1339out: 1340 mt7921_mutex_release(dev); 1341 1342 return err; 1343} 1344 1345static int 1346mt7921_stop_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1347{ | 1329 struct mt76_phy *mphy = hw->priv; 1330 int err; 1331 1332 mt7921_mutex_acquire(dev); 1333 1334 err = mt76_connac_mcu_sched_scan_req(mphy, vif, req); 1335 if (err < 0) 1336 goto out; 1337 1338 err = mt76_connac_mcu_sched_scan_enable(mphy, vif, true); 1339out: 1340 mt7921_mutex_release(dev); 1341 1342 return err; 1343} 1344 1345static int 1346mt7921_stop_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1347{ |
1348 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1348 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1349 struct mt76_phy *mphy = hw->priv; 1350 int err; 1351 1352 mt7921_mutex_acquire(dev); 1353 err = mt76_connac_mcu_sched_scan_enable(mphy, vif, false); 1354 mt7921_mutex_release(dev); 1355 1356 return err; 1357} 1358 1359static int 1360mt7921_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) 1361{ | 1349 struct mt76_phy *mphy = hw->priv; 1350 int err; 1351 1352 mt7921_mutex_acquire(dev); 1353 err = mt76_connac_mcu_sched_scan_enable(mphy, vif, false); 1354 mt7921_mutex_release(dev); 1355 1356 return err; 1357} 1358 1359static int 1360mt7921_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) 1361{ |
1362 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1362 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1363 struct mt792x_phy *phy = mt7921_hw_phy(hw); 1364 int max_nss = hweight8(hw->wiphy->available_antennas_tx); 1365 1366 if (!tx_ant || tx_ant != rx_ant || ffs(tx_ant) > max_nss) 1367 return -EINVAL; 1368 1369 if ((BIT(hweight8(tx_ant)) - 1) != tx_ant) 1370 return -EINVAL; --- 47 unchanged lines hidden (view full) --- 1418 sinfo->avg_ack_signal = -(s8)ewma_avg_signal_read(&msta->avg_ack_signal); 1419 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG); 1420} 1421 1422#ifdef CONFIG_PM 1423static int mt7921_suspend(struct ieee80211_hw *hw, 1424 struct cfg80211_wowlan *wowlan) 1425{ | 1363 struct mt792x_phy *phy = mt7921_hw_phy(hw); 1364 int max_nss = hweight8(hw->wiphy->available_antennas_tx); 1365 1366 if (!tx_ant || tx_ant != rx_ant || ffs(tx_ant) > max_nss) 1367 return -EINVAL; 1368 1369 if ((BIT(hweight8(tx_ant)) - 1) != tx_ant) 1370 return -EINVAL; --- 47 unchanged lines hidden (view full) --- 1418 sinfo->avg_ack_signal = -(s8)ewma_avg_signal_read(&msta->avg_ack_signal); 1419 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG); 1420} 1421 1422#ifdef CONFIG_PM 1423static int mt7921_suspend(struct ieee80211_hw *hw, 1424 struct cfg80211_wowlan *wowlan) 1425{ |
1426 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1426 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1427 struct mt792x_phy *phy = mt7921_hw_phy(hw); 1428 1429 cancel_delayed_work_sync(&phy->scan_work); 1430 cancel_delayed_work_sync(&phy->mt76->mac_work); 1431 1432 cancel_delayed_work_sync(&dev->pm.ps_work); 1433 mt76_connac_free_pending_tx_skbs(&dev->pm, NULL); 1434 --- 7 unchanged lines hidden (view full) --- 1442 1443 mt7921_mutex_release(dev); 1444 1445 return 0; 1446} 1447 1448static int mt7921_resume(struct ieee80211_hw *hw) 1449{ | 1427 struct mt792x_phy *phy = mt7921_hw_phy(hw); 1428 1429 cancel_delayed_work_sync(&phy->scan_work); 1430 cancel_delayed_work_sync(&phy->mt76->mac_work); 1431 1432 cancel_delayed_work_sync(&dev->pm.ps_work); 1433 mt76_connac_free_pending_tx_skbs(&dev->pm, NULL); 1434 --- 7 unchanged lines hidden (view full) --- 1442 1443 mt7921_mutex_release(dev); 1444 1445 return 0; 1446} 1447 1448static int mt7921_resume(struct ieee80211_hw *hw) 1449{ |
1450 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1450 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1451 struct mt792x_phy *phy = mt7921_hw_phy(hw); 1452 1453 mt7921_mutex_acquire(dev); 1454 1455 set_bit(MT76_STATE_RUNNING, &phy->mt76->state); 1456 ieee80211_iterate_active_interfaces(hw, 1457 IEEE80211_IFACE_ITER_RESUME_ALL, 1458 mt76_connac_mcu_set_suspend_iter, --- 4 unchanged lines hidden (view full) --- 1463 1464 mt7921_mutex_release(dev); 1465 1466 return 0; 1467} 1468 1469static void mt7921_set_wakeup(struct ieee80211_hw *hw, bool enabled) 1470{ | 1451 struct mt792x_phy *phy = mt7921_hw_phy(hw); 1452 1453 mt7921_mutex_acquire(dev); 1454 1455 set_bit(MT76_STATE_RUNNING, &phy->mt76->state); 1456 ieee80211_iterate_active_interfaces(hw, 1457 IEEE80211_IFACE_ITER_RESUME_ALL, 1458 mt76_connac_mcu_set_suspend_iter, --- 4 unchanged lines hidden (view full) --- 1463 1464 mt7921_mutex_release(dev); 1465 1466 return 0; 1467} 1468 1469static void mt7921_set_wakeup(struct ieee80211_hw *hw, bool enabled) 1470{ |
1471 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1471 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1472 struct mt76_dev *mdev = &dev->mt76; 1473 1474 device_set_wakeup_enable(mdev->dev, enabled); 1475} 1476 1477static void mt7921_set_rekey_data(struct ieee80211_hw *hw, 1478 struct ieee80211_vif *vif, 1479 struct cfg80211_gtk_rekey_data *data) 1480{ | 1472 struct mt76_dev *mdev = &dev->mt76; 1473 1474 device_set_wakeup_enable(mdev->dev, enabled); 1475} 1476 1477static void mt7921_set_rekey_data(struct ieee80211_hw *hw, 1478 struct ieee80211_vif *vif, 1479 struct cfg80211_gtk_rekey_data *data) 1480{ |
1481 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1481 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1482 1483 mt7921_mutex_acquire(dev); 1484 mt76_connac_mcu_update_gtk_rekey(hw, vif, data); 1485 mt7921_mutex_release(dev); 1486} 1487#endif /* CONFIG_PM */ 1488 1489static void mt7921_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1490 u32 queues, bool drop) 1491{ | 1482 1483 mt7921_mutex_acquire(dev); 1484 mt76_connac_mcu_update_gtk_rekey(hw, vif, data); 1485 mt7921_mutex_release(dev); 1486} 1487#endif /* CONFIG_PM */ 1488 1489static void mt7921_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1490 u32 queues, bool drop) 1491{ |
1492 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1492 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1493 1494 wait_event_timeout(dev->mt76.tx_wait, !mt76_has_tx_pending(&dev->mphy), 1495 HZ / 2); 1496} 1497 1498static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw, 1499 struct ieee80211_vif *vif, 1500 struct ieee80211_sta *sta, 1501 bool enabled) 1502{ 1503 struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; | 1493 1494 wait_event_timeout(dev->mt76.tx_wait, !mt76_has_tx_pending(&dev->mphy), 1495 HZ / 2); 1496} 1497 1498static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw, 1499 struct ieee80211_vif *vif, 1500 struct ieee80211_sta *sta, 1501 bool enabled) 1502{ 1503 struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; |
1504 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1504 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1505 1506 mt7921_mutex_acquire(dev); 1507 1508 if (enabled) 1509 set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); 1510 else 1511 clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); 1512 --- 4 unchanged lines hidden (view full) --- 1517} 1518 1519#if IS_ENABLED(CONFIG_IPV6) 1520static void mt7921_ipv6_addr_change(struct ieee80211_hw *hw, 1521 struct ieee80211_vif *vif, 1522 struct inet6_dev *idev) 1523{ 1524 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; | 1505 1506 mt7921_mutex_acquire(dev); 1507 1508 if (enabled) 1509 set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); 1510 else 1511 clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); 1512 --- 4 unchanged lines hidden (view full) --- 1517} 1518 1519#if IS_ENABLED(CONFIG_IPV6) 1520static void mt7921_ipv6_addr_change(struct ieee80211_hw *hw, 1521 struct ieee80211_vif *vif, 1522 struct inet6_dev *idev) 1523{ 1524 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; |
1525 struct mt7921_dev *dev = mvif->phy->dev; | 1525 struct mt792x_dev *dev = mvif->phy->dev; |
1526 struct inet6_ifaddr *ifa; 1527 struct in6_addr ns_addrs[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; 1528 struct sk_buff *skb; 1529 u8 i, idx = 0; 1530 1531 struct { 1532 struct { 1533 u8 bss_idx; --- 59 unchanged lines hidden (view full) --- 1593 err = mt76_connac_mcu_set_rate_txpower(mphy); 1594 1595 return err; 1596} 1597 1598static int mt7921_set_sar_specs(struct ieee80211_hw *hw, 1599 const struct cfg80211_sar_specs *sar) 1600{ | 1526 struct inet6_ifaddr *ifa; 1527 struct in6_addr ns_addrs[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; 1528 struct sk_buff *skb; 1529 u8 i, idx = 0; 1530 1531 struct { 1532 struct { 1533 u8 bss_idx; --- 59 unchanged lines hidden (view full) --- 1593 err = mt76_connac_mcu_set_rate_txpower(mphy); 1594 1595 return err; 1596} 1597 1598static int mt7921_set_sar_specs(struct ieee80211_hw *hw, 1599 const struct cfg80211_sar_specs *sar) 1600{ |
1601 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1601 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1602 int err; 1603 1604 mt7921_mutex_acquire(dev); 1605 err = mt7921_mcu_set_clc(dev, dev->mt76.alpha2, 1606 dev->country_ie_env); 1607 if (err < 0) 1608 goto out; 1609 --- 4 unchanged lines hidden (view full) --- 1614 return err; 1615} 1616 1617static void 1618mt7921_channel_switch_beacon(struct ieee80211_hw *hw, 1619 struct ieee80211_vif *vif, 1620 struct cfg80211_chan_def *chandef) 1621{ | 1602 int err; 1603 1604 mt7921_mutex_acquire(dev); 1605 err = mt7921_mcu_set_clc(dev, dev->mt76.alpha2, 1606 dev->country_ie_env); 1607 if (err < 0) 1608 goto out; 1609 --- 4 unchanged lines hidden (view full) --- 1614 return err; 1615} 1616 1617static void 1618mt7921_channel_switch_beacon(struct ieee80211_hw *hw, 1619 struct ieee80211_vif *vif, 1620 struct cfg80211_chan_def *chandef) 1621{ |
1622 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1622 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1623 1624 mt7921_mutex_acquire(dev); 1625 mt7921_mcu_uni_add_beacon_offload(dev, hw, vif, true); 1626 mt7921_mutex_release(dev); 1627} 1628 1629static int 1630mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1631 struct ieee80211_bss_conf *link_conf) 1632{ 1633 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 1634 struct mt792x_phy *phy = mt7921_hw_phy(hw); | 1623 1624 mt7921_mutex_acquire(dev); 1625 mt7921_mcu_uni_add_beacon_offload(dev, hw, vif, true); 1626 mt7921_mutex_release(dev); 1627} 1628 1629static int 1630mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1631 struct ieee80211_bss_conf *link_conf) 1632{ 1633 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 1634 struct mt792x_phy *phy = mt7921_hw_phy(hw); |
1635 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1635 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1636 int err; 1637 1638 mt7921_mutex_acquire(dev); 1639 1640 err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, 1641 true, mvif->ctx); 1642 if (err) 1643 goto out; --- 11 unchanged lines hidden (view full) --- 1655} 1656 1657static void 1658mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1659 struct ieee80211_bss_conf *link_conf) 1660{ 1661 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 1662 struct mt792x_phy *phy = mt7921_hw_phy(hw); | 1636 int err; 1637 1638 mt7921_mutex_acquire(dev); 1639 1640 err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, 1641 true, mvif->ctx); 1642 if (err) 1643 goto out; --- 11 unchanged lines hidden (view full) --- 1655} 1656 1657static void 1658mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1659 struct ieee80211_bss_conf *link_conf) 1660{ 1661 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; 1662 struct mt792x_phy *phy = mt7921_hw_phy(hw); |
1663 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1663 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1664 int err; 1665 1666 mt7921_mutex_acquire(dev); 1667 1668 err = mt7921_mcu_set_bss_pm(dev, vif, false); 1669 if (err) 1670 goto out; 1671 --- 48 unchanged lines hidden (view full) --- 1720 1721static int 1722mt7921_assign_vif_chanctx(struct ieee80211_hw *hw, 1723 struct ieee80211_vif *vif, 1724 struct ieee80211_bss_conf *link_conf, 1725 struct ieee80211_chanctx_conf *ctx) 1726{ 1727 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; | 1664 int err; 1665 1666 mt7921_mutex_acquire(dev); 1667 1668 err = mt7921_mcu_set_bss_pm(dev, vif, false); 1669 if (err) 1670 goto out; 1671 --- 48 unchanged lines hidden (view full) --- 1720 1721static int 1722mt7921_assign_vif_chanctx(struct ieee80211_hw *hw, 1723 struct ieee80211_vif *vif, 1724 struct ieee80211_bss_conf *link_conf, 1725 struct ieee80211_chanctx_conf *ctx) 1726{ 1727 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; |
1728 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1728 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1729 1730 mutex_lock(&dev->mt76.mutex); 1731 mvif->ctx = ctx; 1732 mutex_unlock(&dev->mt76.mutex); 1733 1734 return 0; 1735} 1736 1737static void 1738mt7921_unassign_vif_chanctx(struct ieee80211_hw *hw, 1739 struct ieee80211_vif *vif, 1740 struct ieee80211_bss_conf *link_conf, 1741 struct ieee80211_chanctx_conf *ctx) 1742{ 1743 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; | 1729 1730 mutex_lock(&dev->mt76.mutex); 1731 mvif->ctx = ctx; 1732 mutex_unlock(&dev->mt76.mutex); 1733 1734 return 0; 1735} 1736 1737static void 1738mt7921_unassign_vif_chanctx(struct ieee80211_hw *hw, 1739 struct ieee80211_vif *vif, 1740 struct ieee80211_bss_conf *link_conf, 1741 struct ieee80211_chanctx_conf *ctx) 1742{ 1743 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; |
1744 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1744 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1745 1746 mutex_lock(&dev->mt76.mutex); 1747 mvif->ctx = NULL; 1748 mutex_unlock(&dev->mt76.mutex); 1749} 1750 1751static void mt7921_mgd_prepare_tx(struct ieee80211_hw *hw, 1752 struct ieee80211_vif *vif, 1753 struct ieee80211_prep_tx_info *info) 1754{ 1755 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; | 1745 1746 mutex_lock(&dev->mt76.mutex); 1747 mvif->ctx = NULL; 1748 mutex_unlock(&dev->mt76.mutex); 1749} 1750 1751static void mt7921_mgd_prepare_tx(struct ieee80211_hw *hw, 1752 struct ieee80211_vif *vif, 1753 struct ieee80211_prep_tx_info *info) 1754{ 1755 struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; |
1756 struct mt7921_dev *dev = mt7921_hw_dev(hw); | 1756 struct mt792x_dev *dev = mt7921_hw_dev(hw); |
1757 u16 duration = info->duration ? info->duration : 1758 jiffies_to_msecs(HZ); 1759 1760 mt7921_mutex_acquire(dev); 1761 mt7921_set_roc(mvif->phy, mvif, mvif->ctx->def.chan, duration, 1762 MT7921_ROC_REQ_JOIN); 1763 mt7921_mutex_release(dev); 1764} --- 74 unchanged lines hidden --- | 1757 u16 duration = info->duration ? info->duration : 1758 jiffies_to_msecs(HZ); 1759 1760 mt7921_mutex_acquire(dev); 1761 mt7921_set_roc(mvif->phy, mvif, mvif->ctx->def.chan, duration, 1762 MT7921_ROC_REQ_JOIN); 1763 mt7921_mutex_release(dev); 1764} --- 74 unchanged lines hidden --- |