Message ID | ec08a926e11e74bb590e57b3705c9f1d135dd191.1607542812.git.ryder.lee@mediatek.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Felix Fietkau |
Headers | show |
Series | [v2,1/2] mt76: mt7915: reset token when mac_reset happens | expand |
Hi Ryder, I love your patch! Perhaps something to improve: [auto build test WARNING on wireless-drivers-next/master] [also build test WARNING on next-20201209] [cannot apply to wireless-drivers/master v5.10-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Ryder-Lee/mt76-mt7915-reset-token-when-mac_reset-happens/20201210-043355 base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master config: parisc-randconfig-r033-20201209 (attached as .config) compiler: hppa-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/34bdad124ca0fd65c4660ec70254e5dd16f03385 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Ryder-Lee/mt76-mt7915-reset-token-when-mac_reset-happens/20201210-043355 git checkout 34bdad124ca0fd65c4660ec70254e5dd16f03385 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): In file included from drivers/net/wireless/mediatek/mt76/mt7615/main.c:12: >> drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h:586:33: warning: 'struct mt7915_dev' declared inside parameter list will not be visible outside of this definition or declaration 586 | void mt7615_tx_token_put(struct mt7915_dev *dev); | ^~~~~~~~~~ -- In file included from drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:9: >> drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h:586:33: warning: 'struct mt7915_dev' declared inside parameter list will not be visible outside of this definition or declaration 586 | void mt7615_tx_token_put(struct mt7915_dev *dev); | ^~~~~~~~~~ drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:2078:42: warning: 'mt7615_wowlan_support' defined but not used [-Wunused-const-variable=] 2078 | static const struct wiphy_wowlan_support mt7615_wowlan_support = { | ^~~~~~~~~~~~~~~~~~~~~ -- In file included from drivers/net/wireless/mediatek/mt76/mt7615/mt7615_trace.h:10, from drivers/net/wireless/mediatek/mt76/mt7615/trace.c:10: >> drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h:586:33: warning: 'struct mt7915_dev' declared inside parameter list will not be visible outside of this definition or declaration 586 | void mt7615_tx_token_put(struct mt7915_dev *dev); | ^~~~~~~~~~ In file included from drivers/net/wireless/mediatek/mt76/mt7615/mt7615_trace.h:56, from drivers/net/wireless/mediatek/mt76/mt7615/trace.c:10: include/trace/define_trace.h:95:42: fatal error: ./mt7615_trace.h: No such file or directory 95 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | ^ compilation terminated. -- In file included from drivers/net/wireless/mediatek/mt76/mt7615/mac.c:12: >> drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h:586:33: warning: 'struct mt7915_dev' declared inside parameter list will not be visible outside of this definition or declaration 586 | void mt7615_tx_token_put(struct mt7915_dev *dev); | ^~~~~~~~~~ drivers/net/wireless/mediatek/mt76/mt7615/mac.c:2061:6: error: conflicting types for 'mt7615_tx_token_put' 2061 | void mt7615_tx_token_put(struct mt7615_dev *dev) | ^~~~~~~~~~~~~~~~~~~ In file included from drivers/net/wireless/mediatek/mt76/mt7615/mac.c:12: drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h:586:6: note: previous declaration of 'mt7615_tx_token_put' was here 586 | void mt7615_tx_token_put(struct mt7915_dev *dev); | ^~~~~~~~~~~~~~~~~~~ -- In file included from drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c:11: >> drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h:586:33: warning: 'struct mt7915_dev' declared inside parameter list will not be visible outside of this definition or declaration 586 | void mt7615_tx_token_put(struct mt7915_dev *dev); | ^~~~~~~~~~ drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c: In function 'mt7615_unregister_device': drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c:173:22: error: passing argument 1 of 'mt7615_tx_token_put' from incompatible pointer type [-Werror=incompatible-pointer-types] 173 | mt7615_tx_token_put(dev); | ^~~ | | | struct mt7615_dev * In file included from drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c:11: drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h:586:45: note: expected 'struct mt7915_dev *' but argument is of type 'struct mt7615_dev *' 586 | void mt7615_tx_token_put(struct mt7915_dev *dev); | ~~~~~~~~~~~~~~~~~~~^~~ cc1: some warnings being treated as errors vim +586 drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h 554 555 int mt7615_mcu_parse_response(struct mt76_dev *mdev, int cmd, 556 struct sk_buff *skb, int seq); 557 u32 mt7615_rf_rr(struct mt7615_dev *dev, u32 wf, u32 reg); 558 int mt7615_rf_wr(struct mt7615_dev *dev, u32 wf, u32 reg, u32 val); 559 int mt7615_mcu_set_dbdc(struct mt7615_dev *dev); 560 int mt7615_mcu_set_eeprom(struct mt7615_dev *dev); 561 int mt7615_mcu_set_mac_enable(struct mt7615_dev *dev, int band, bool enable); 562 int mt7615_mcu_set_rts_thresh(struct mt7615_phy *phy, u32 val); 563 int mt7615_mcu_get_temperature(struct mt7615_dev *dev, int index); 564 int mt7615_mcu_set_tx_power(struct mt7615_phy *phy); 565 void mt7615_mcu_exit(struct mt7615_dev *dev); 566 void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb, 567 int cmd, int *wait_seq); 568 int mt7615_mcu_set_channel_domain(struct mt7615_phy *phy); 569 int mt7615_mcu_hw_scan(struct mt7615_phy *phy, struct ieee80211_vif *vif, 570 struct ieee80211_scan_request *scan_req); 571 int mt7615_mcu_cancel_hw_scan(struct mt7615_phy *phy, 572 struct ieee80211_vif *vif); 573 int mt7615_mcu_sched_scan_req(struct mt7615_phy *phy, 574 struct ieee80211_vif *vif, 575 struct cfg80211_sched_scan_request *sreq); 576 int mt7615_mcu_sched_scan_enable(struct mt7615_phy *phy, 577 struct ieee80211_vif *vif, 578 bool enable); 579 580 int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, 581 enum mt76_txq_id qid, struct mt76_wcid *wcid, 582 struct ieee80211_sta *sta, 583 struct mt76_tx_info *tx_info); 584 585 void mt7615_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e); > 586 void mt7615_tx_token_put(struct mt7915_dev *dev); 587 void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, 588 struct sk_buff *skb); 589 void mt7615_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps); 590 int mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, 591 struct ieee80211_sta *sta); 592 void mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, 593 struct ieee80211_sta *sta); 594 void mt7615_mac_work(struct work_struct *work); 595 void mt7615_txp_skb_unmap(struct mt76_dev *dev, 596 struct mt76_txwi_cache *txwi); 597 int mt7615_mcu_set_fcc5_lpn(struct mt7615_dev *dev, int val); 598 int mt7615_mcu_set_pulse_th(struct mt7615_dev *dev, 599 const struct mt7615_dfs_pulse *pulse); 600 int mt7615_mcu_set_radar_th(struct mt7615_dev *dev, int index, 601 const struct mt7615_dfs_pattern *pattern); 602 int mt7615_mcu_set_test_param(struct mt7615_dev *dev, u8 param, bool test_mode, 603 u32 val); 604 int mt7615_mcu_set_sku_en(struct mt7615_phy *phy, bool enable); 605 int mt7615_mcu_apply_rx_dcoc(struct mt7615_phy *phy); 606 int mt7615_mcu_apply_tx_dpd(struct mt7615_phy *phy); 607 int mt7615_mcu_set_vif_ps(struct mt7615_dev *dev, struct ieee80211_vif *vif); 608 int mt7615_dfs_init_radar_detector(struct mt7615_phy *phy); 609 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 0f360be0b885..1b4986dd3baa 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -2058,6 +2058,22 @@ void mt7615_dma_reset(struct mt7615_dev *dev) } EXPORT_SYMBOL_GPL(mt7615_dma_reset); +void mt7615_tx_token_put(struct mt7615_dev *dev) +{ + struct mt76_txwi_cache *txwi; + int id; + + spin_lock_bh(&dev->token_lock); + idr_for_each_entry(&dev->token, txwi, id) { + mt7615_txp_skb_unmap(&dev->mt76, txwi); + if (txwi->skb) + dev_kfree_skb_any(txwi->skb); + mt76_put_txwi(&dev->mt76, txwi); + } + spin_unlock_bh(&dev->token_lock); + idr_destroy(&dev->token); +} + void mt7615_mac_reset_work(struct work_struct *work) { struct mt7615_phy *phy2; @@ -2101,6 +2117,9 @@ void mt7615_mac_reset_work(struct work_struct *work) mt76_wr(dev, MT_MCU_INT_EVENT, MT_MCU_INT_EVENT_PDMA_STOPPED); + mt7615_tx_token_put(dev); + idr_init(&dev->token); + if (mt7615_wait_reset_state(dev, MT_MCU_CMD_RESET_DONE)) { mt7615_dma_reset(dev); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h index 99b8abdbb08f..50e729906fa9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h @@ -583,7 +583,7 @@ int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, struct mt76_tx_info *tx_info); void mt7615_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e); - +void mt7615_tx_token_put(struct mt7915_dev *dev); void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, struct sk_buff *skb); void mt7615_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c b/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c index 27fcb1374685..58a0ec1bf8d7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c @@ -160,9 +160,7 @@ int mt7615_register_device(struct mt7615_dev *dev) void mt7615_unregister_device(struct mt7615_dev *dev) { - struct mt76_txwi_cache *txwi; bool mcu_running; - int id; mcu_running = mt7615_wait_for_mcu_init(dev); @@ -172,15 +170,7 @@ void mt7615_unregister_device(struct mt7615_dev *dev) mt7615_mcu_exit(dev); mt7615_dma_cleanup(dev); - spin_lock_bh(&dev->token_lock); - idr_for_each_entry(&dev->token, txwi, id) { - mt7615_txp_skb_unmap(&dev->mt76, txwi); - if (txwi->skb) - dev_kfree_skb_any(txwi->skb); - mt76_put_txwi(&dev->mt76, txwi); - } - spin_unlock_bh(&dev->token_lock); - idr_destroy(&dev->token); + mt7615_tx_token_put(dev); tasklet_disable(&dev->irq_tasklet);
Reset token in mt7615_mac_reset_work() to avoid possible leakege. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> --- change since v2 - rebase on top of latest codebase --- .../net/wireless/mediatek/mt76/mt7615/mac.c | 19 +++++++++++++++++++ .../wireless/mediatek/mt76/mt7615/mt7615.h | 2 +- .../wireless/mediatek/mt76/mt7615/pci_init.c | 12 +----------- 3 files changed, 21 insertions(+), 12 deletions(-)