mt76: mt7615: fix MT_ANT_SWITCH_CON register definition
Subsystems (3)
Felix Fietkau
maintainerPATCH 1/11 mt76: mt7615: fix MT_ANT_SWITCH_CON register definition
This is used for testmode tx antenna selection
--- drivers/net/wireless/mediatek/mt76/mt7615/regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7615/regs.h +1 -1
@@ -575,7 +575,7 @@ enum mt7615_reg_base {#define MT_MCU_PTA_BASE 0x81060000#define MT_MCU_PTA (_n) (MT_MCU_PTA_BASE + (_n)) -#define MT_ANT_SWITCH_CON (n) MT_MCU_PTA(0x0c8) +#define MT_ANT_SWITCH_CON (_n) MT_MCU_PTA(0x0c8 + ((_n) - 1) * 4)#define MT_ANT_SWITCH_CON_MODE (_n) (GENMASK(4, 0) << (_n * 8))#define MT_ANT_SWITCH_CON_MODE1 (_n) (GENMASK(3, 0) << (_n * 8))
Signature · 1 line
2.28.0
Felix Fietkau
maintainerPATCH 2/11 mt76: mt7615: fix antenna selection for testmode tx_frames
Do not alter the tx/rx chain settings during channel setup, antennas are remapped by the testmode specific register writes already
--- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 8 -------- drivers/net/wireless/mediatek/mt76/mt7615/testmode.c | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +0 -8
@@ -2850,14 +2850,6 @@ int mt7615_mcu_set_chan_info(struct mt7615_phy *phy, int cmd) .center_chan2 = ieee80211_frequency_to_channel(freq2), }; -#ifdef CONFIG_NL80211_TESTMODE -if (dev->mt76.test.state ==MT76_TM_STATE_TX_FRAMES && - dev->mt76.test.tx_antenna_mask) { - req.tx_streams =hweight8 (dev->mt76.test.tx_antenna_mask); - req.rx_streams_mask = dev->mt76.test.tx_antenna_mask; - } -#endif -if (dev->mt76.hw->conf.flags &IEEE80211_CONF_OFFCHANNEL ) req.switch_reason =CH_SWITCH_SCAN_BYPASS_DPD ; else if ((chandef->chan->flags & IEEE80211_CHAN_RADAR) &&
drivers/net/wireless/mediatek/mt76/mt7615/testmode.c +1 -1
@@ -193,7 +193,7 @@ mt7615_tm_set_tx_antenna(struct mt7615_dev *dev, bool en)for (i =0 ; i <4 ; i++) {mt76_rmw_field (dev,MT_WF_PHY_RFINTF3_0 (i),MT_WF_PHY_RFINTF3_0_ANT , - td->tx_antenna_mask &BIT (i) ?0 :0xa ); + (td->tx_antenna_mask &BIT (i)) ?0 :0xa ); }
Signature · 1 line
2.28.0
Felix Fietkau
maintainerPATCH 3/11 mt76: testmode: add a limit for queued tx_frames packets
In reply to Felix FietkauThis avoids running out of available tx tokens
--- drivers/net/wireless/mediatek/mt76/testmode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/testmode.c +2 -1
@@ -33,7 +33,8 @@ void mt76_testmode_tx_pending(struct mt76_dev *dev)spin_lock_bh (&q->lock); -while (td->tx_pending >0 && q->queued < q->ndesc /2 ) { +while (td->tx_pending >0 && td->tx_queued - td->tx_done <1000 && + q->queued < q->ndesc /2 ) {int ret; ret = dev->queue_ops->tx_queue_skb (dev, qid,skb_get (skb), wcid,NULL );
Signature · 1 line
2.28.0
Felix Fietkau
maintainerPATCH 4/11 mt76: add utility functions for deferring work to a kernel thread
In reply to Felix FietkauIn order to avoid keeping work like tx scheduling pinned to the CPU it was scheduled from, it makes sense to switch from tasklets to kernel threads.
--- drivers/net/wireless/mediatek/mt76/util.c | 28 +++++++++ drivers/net/wireless/mediatek/mt76/util.h | 76 +++++++++++++++++++++++ 2 files changed, 104 insertions(+)
drivers/net/wireless/mediatek/mt76/util.c +28 -0
@@ -110,4 +110,32 @@ int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy) }EXPORT_SYMBOL_GPL (mt76_get_min_avg_rssi); +int __mt76_worker_fn (void *ptr) +{ +struct mt76_worker *w = ptr; + +while (!kthread_should_stop ()) { +set_current_state (TASK_INTERRUPTIBLE ); + +if (kthread_should_park ()) { +kthread_parkme (); +continue ; + } + +if (!test_and_clear_bit (MT76_WORKER_SCHEDULED , &w->state)) { +schedule (); +continue ; + } + +set_bit (MT76_WORKER_RUNNING , &w->state); +set_current_state (TASK_RUNNING ); + w->fn (w); +cond_resched (); +clear_bit (MT76_WORKER_RUNNING , &w->state); + } + +return 0 ; +} +EXPORT_SYMBOL_GPL (__mt76_worker_fn); +MODULE_LICENSE ("Dual BSD/GPL" );
drivers/net/wireless/mediatek/mt76/util.h +76 -0
86 lines not on this page · raw message
Signature · 1 line
2.28.0
Re: [PATCH 04/11] mt76: add utility functions for deferring work to a kernel thread
Quoted 4 lines · Felix Fietkau
In order to avoid keeping work like tx scheduling pinned to the CPU it was scheduled from, it makes sense to switch from tasklets to kernel threads.
Signed-off-by Felix Fietkau <[email protected]>
[...]
Quoted 23 lines
drivers/net/wireless/mediatek/mt76/util.c +17
-0@@ -110,4 +110,32 @@ int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy) }EXPORT_SYMBOL_GPL (mt76_get_min_avg_rssi); +int __mt76_worker_fn (void *ptr) +{ +struct mt76_worker *w = ptr; + +while (!kthread_should_stop ()) { +set_current_state (TASK_INTERRUPTIBLE ); + +if (kthread_should_park ()) { +kthread_parkme (); +continue ; + } + +if (!test_and_clear_bit (MT76_WORKER_SCHEDULED , &w->state)) { +schedule (); +continue ; + } +
drivers/net/wireless/mediatek/mt76/util.c int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy) · line 139
Quoted 10 lines
drivers/net/wireless/mediatek/mt76/util.c +10
-0+set_bit (MT76_WORKER_RUNNING , &w->state); +set_current_state (TASK_RUNNING ); + w->fn (w); +cond_resched (); +clear_bit (MT76_WORKER_RUNNING , &w->state); + } + +return 0 ; +} +EXPORT_SYMBOL_GPL (__mt76_worker_fn);
So how is this better than, for example, create_singlethread_workqueue()? And if this is better, shouldn't it be part of workqueue.h instead of every driver reinventing the wheel?
Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
A message that is not in the archive (sent off-list or not yet received): 010101747c3b747d-09af9fc1-2e74-400f-89f5-fae71b7d163b-000000@us-west-2.amazonses.com
Felix Fietkau
maintainerRe: [PATCH 04/11] mt76: add utility functions for deferring work to a kernel thread
Quoted 38 lines · Kalle Valo
Quoted 4 lines · Felix Fietkau
In order to avoid keeping work like tx scheduling pinned to the CPU it was scheduled from, it makes sense to switch from tasklets to kernel threads.
Signed-off-by Felix Fietkau <[email protected]>[...]
Quoted 29 lines
drivers/net/wireless/mediatek/mt76/util.c +23
-0@@ -110,4 +110,32 @@ int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy) }EXPORT_SYMBOL_GPL (mt76_get_min_avg_rssi); +int __mt76_worker_fn (void *ptr) +{ +struct mt76_worker *w = ptr; + +while (!kthread_should_stop ()) { +set_current_state (TASK_INTERRUPTIBLE ); + +if (kthread_should_park ()) { +kthread_parkme (); +continue ; + } + +if (!test_and_clear_bit (MT76_WORKER_SCHEDULED , &w->state)) { +schedule (); +continue ; + } + +set_bit (MT76_WORKER_RUNNING , &w->state); +set_current_state (TASK_RUNNING ); + w->fn (w); +cond_resched (); +clear_bit (MT76_WORKER_RUNNING , &w->state); + }
Quoted 8 lines
drivers/net/wireless/mediatek/mt76/util.c int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy) · line 139
Quoted 4 lines
drivers/net/wireless/mediatek/mt76/util.c +4
-0+ +return 0 ; +} +EXPORT_SYMBOL_GPL (__mt76_worker_fn);So how is this better than, for example,
create_singlethread_workqueue()? And if this is better, shouldn't it be part ofworkqueue.hinstead of every driver reinventing the wheel?
Unlike a workqueue, this one only allows one fixed worker function to be executed by the worker thread. Because of that, there is less locking and less code for scheduling involved.
In fact, the function that schedules the worker is small enough that it's just a simple inline function.
The difference matters in this case, because the tx worker is scheduled very often in a hot path.
I don't think it fits into workqueue.h (because of the lack of separation between workqueue and work struct), and I don't know if other drivers need this, so let's keep it in mt76 and only move to a generic API if we find another user for it.
- Felix
Re: [PATCH 04/11] mt76: add utility functions for deferring work to a kernel thread
Quoted 48 lines · Felix Fietkau
Quoted 38 lines · Kalle Valo
Quoted 4 lines · Felix Fietkau
In order to avoid keeping work like tx scheduling pinned to the CPU it was scheduled from, it makes sense to switch from tasklets to kernel threads.
Signed-off-by Felix Fietkau <[email protected]>[...]
Quoted 29 lines
drivers/net/wireless/mediatek/mt76/util.c +23
-0@@ -110,4 +110,32 @@ int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy) }EXPORT_SYMBOL_GPL (mt76_get_min_avg_rssi); +int __mt76_worker_fn (void *ptr) +{ +struct mt76_worker *w = ptr; + +while (!kthread_should_stop ()) { +set_current_state (TASK_INTERRUPTIBLE ); + +if (kthread_should_park ()) { +kthread_parkme (); +continue ; + } + +if (!test_and_clear_bit (MT76_WORKER_SCHEDULED , &w->state)) { +schedule (); +continue ; + } + +set_bit (MT76_WORKER_RUNNING , &w->state); +set_current_state (TASK_RUNNING ); + w->fn (w); +cond_resched (); +clear_bit (MT76_WORKER_RUNNING , &w->state); + }Quoted 8 lines
drivers/net/wireless/mediatek/mt76/util.c int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy) · line 139
Quoted 4 lines
drivers/net/wireless/mediatek/mt76/util.c +4
-0+ +return 0 ; +} +EXPORT_SYMBOL_GPL (__mt76_worker_fn);So how is this better than, for example,
create_singlethread_workqueue()? And if this is better, shouldn't it be part ofworkqueue.hinstead of every driver reinventing the wheel?
Quoted 11 lines
Unlike a workqueue, this one only allows one fixed worker function to be executed by the worker thread. Because of that, there is less locking and less code for scheduling involved.
In fact, the function that schedules the worker is small enough that it's just a simple inline function.
The difference matters in this case, because the tx worker is scheduled very often in a hot path.
I don't think it fits intoworkqueue.h(because of the lack of separation between workqueue and work struct), and I don't know if other drivers need this, so let's keep it in mt76 and only move to a generic API if we find another user for it.
Ok, fair enough. But please add this info to the commit log so the reasoning is properly documented.
Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Felix Fietkau
maintainerPATCH v2 4/11 mt76: add utility functions for deferring work to a kernel thread
In reply to Felix FietkauIn order to avoid keeping work like tx scheduling pinned to the CPU it was scheduled from, it makes sense to switch from tasklets to kernel threads.
Unlike a workqueue, this one only allows one fixed worker function to be executed by the worker thread. Because of that, there is less locking and less code for scheduling involved.
This is important because the tx worker is scheduled often in a hot path
---
v2: add more information to patch description
drivers/net/wireless/mediatek/mt76/util.c | 28 +++++++++ drivers/net/wireless/mediatek/mt76/util.h | 76 +++++++++++++++++++++++ 2 files changed, 104 insertions(+)
drivers/net/wireless/mediatek/mt76/util.c +28 -0
@@ -110,4 +110,32 @@ int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy) }EXPORT_SYMBOL_GPL (mt76_get_min_avg_rssi); +int __mt76_worker_fn (void *ptr) +{ +struct mt76_worker *w = ptr; + +while (!kthread_should_stop ()) { +set_current_state (TASK_INTERRUPTIBLE ); + +if (kthread_should_park ()) { +kthread_parkme (); +continue ; + } + +if (!test_and_clear_bit (MT76_WORKER_SCHEDULED , &w->state)) { +schedule (); +continue ; + } + +set_bit (MT76_WORKER_RUNNING , &w->state); +set_current_state (TASK_RUNNING ); + w->fn (w); +cond_resched (); +clear_bit (MT76_WORKER_RUNNING , &w->state); + } + +return 0 ; +} +EXPORT_SYMBOL_GPL (__mt76_worker_fn); +MODULE_LICENSE ("Dual BSD/GPL" );
drivers/net/wireless/mediatek/mt76/util.h +76 -0
86 lines not on this page · raw message
Signature · 1 line
2.28.0
Felix Fietkau
maintainerPATCH 5/11 mt76: convert from tx tasklet to tx worker thread
In reply to Felix FietkauThis improves performance by allowing the scheduler to move the tx scheduling work to idle CPUs. Since tx scheduling work is very latency sensitive and kept short via AQL, sched_set_fifo_low is used to keep worker priority above normal tasks
--- drivers/net/wireless/mediatek/mt76/dma.c | 1 + drivers/net/wireless/mediatek/mt76/mac80211.c | 14 +++++++++--- drivers/net/wireless/mediatek/mt76/mt76.h | 4 ++-- .../net/wireless/mediatek/mt76/mt7603/dma.c | 3 +-- .../net/wireless/mediatek/mt76/mt7603/mac.c | 4 ++-- .../net/wireless/mediatek/mt76/mt7615/dma.c | 1 - .../net/wireless/mediatek/mt76/mt7615/mac.c | 8 +++---- .../net/wireless/mediatek/mt76/mt7615/main.c | 2 +- .../net/wireless/mediatek/mt76/mt7615/pci.c | 3 ++- .../net/wireless/mediatek/mt76/mt7615/usb.c | 2 -- .../net/wireless/mediatek/mt76/mt76x0/pci.c | 2 +- .../net/wireless/mediatek/mt76/mt76x02_dma.h | 1 - .../net/wireless/mediatek/mt76/mt76x02_mmio.c | 22 +++++++------------ .../net/wireless/mediatek/mt76/mt76x2/pci.c | 3 ++- .../wireless/mediatek/mt76/mt76x2/pci_init.c | 2 +- .../net/wireless/mediatek/mt76/mt7915/dma.c | 1 - .../net/wireless/mediatek/mt76/mt7915/mac.c | 6 ++--- drivers/net/wireless/mediatek/mt76/testmode.c | 6 ++--- drivers/net/wireless/mediatek/mt76/tx.c | 6 ++--- drivers/net/wireless/mediatek/mt76/usb.c | 14 +++++++----- 20 files changed, 53 insertions(+), 52 deletions(-)
drivers/net/wireless/mediatek/mt76/dma.c +1 -0
@@ -592,6 +592,7 @@ void mt76_dma_cleanup(struct mt76_dev *dev) {int i; +mt76_worker_disable (&dev->tx_worker);netif_napi_del (&dev->tx_napi);for (i =0 ; i <ARRAY_SIZE (dev->q_tx); i++)mt76_dma_tx_cleanup (dev, i, true);
drivers/net/wireless/mediatek/mt76/mac80211.c +11 -3
@@ -2,6 +2,7 @@/* * Copyright (C) 2016 Felix Fietkau <[email protected]> */ +#include <linux/sched.h> #include <linux/of.h> #include "mt76.h"
@@ -436,14 +437,13 @@ mt76_alloc_device(struct device *pdev, unsigned int size,skb_queue_head_init (&dev->mcu.res_q);init_waitqueue_head (&dev->mcu.wait);mutex_init (&dev->mcu.mutex); + dev->tx_worker.fn = mt76_tx_worker;INIT_LIST_HEAD (&dev->txwi_cache);for (i =0 ; i <ARRAY_SIZE (dev->q_rx); i++)skb_queue_head_init (&dev->rx_skb[i]); -tasklet_init (&dev->tx_tasklet, mt76_tx_tasklet, (unsigned long )dev); - dev->wq =alloc_ordered_workqueue ("mt76" ,0 );if (!dev->wq) {ieee80211_free_hw (hw);
@@ -486,7 +486,14 @@ int mt76_register_device(struct mt76_dev *dev, bool vht,return ret; } -return ieee80211_register_hw (hw); + ret =ieee80211_register_hw (hw); +if (ret) +return ret; + +WARN_ON (mt76_worker_setup (hw, &dev->tx_worker,NULL ,"tx" )); +sched_set_fifo_low (dev->tx_worker.task); + +return 0 ; }EXPORT_SYMBOL_GPL (mt76_register_device);
@@ -503,6 +510,7 @@ EXPORT_SYMBOL_GPL(mt76_unregister_device);void mt76_free_device (struct mt76_dev *dev) { +mt76_worker_teardown (&dev->tx_worker);if (dev->wq) {destroy_workqueue (dev->wq); dev->wq =NULL ;
drivers/net/wireless/mediatek/mt76/mt76.h +2 -2
@@ -604,7 +604,7 @@ struct mt76_dev {const struct mt76_queue_ops *queue_ops;int tx_dma_idx[4 ]; -struct tasklet_struct tx_tasklet; +struct mt76_worker tx_worker;struct napi_struct tx_napi;struct delayed_work mac_work;
@@ -906,7 +906,7 @@ void mt76_stop_tx_queues(struct mt76_dev *dev, struct ieee80211_sta *sta,void mt76_tx_check_agg_ssn (struct ieee80211_sta *sta,struct sk_buff *skb);void mt76_txq_schedule (struct mt76_phy *phy,enum mt76_txq_id qid);void mt76_txq_schedule_all (struct mt76_phy *phy); -void mt76_tx_tasklet (unsigned long data); +void mt76_tx_worker (struct mt76_worker *w); void mt76_release_buffered_frames(struct ieee80211_hw *hw, struct ieee80211_sta *sta, u16 tids, int nframes,
drivers/net/wireless/mediatek/mt76/mt7603/dma.c +1 -2
@@ -163,7 +163,7 @@ static int mt7603_poll_tx(struct napi_struct *napi, int budget)mt7603_mac_sta_poll (dev); -tasklet_schedule (&dev->mt76.tx_tasklet); +mt76_worker_schedule (&dev->mt76.tx_worker);return 0 ; }
@@ -246,6 +246,5 @@ void mt7603_dma_cleanup(struct mt7603_dev *dev)MT_WPDMA_GLO_CFG_RX_DMA_EN | MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE); -tasklet_kill (&dev->mt76.tx_tasklet);mt76_dma_cleanup (&dev->mt76); }
drivers/net/wireless/mediatek/mt76/mt7603/mac.c +2 -2
@@ -1402,7 +1402,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev)/* lock/unlock all queues to ensure that no tx is pending */ mt76_txq_schedule_all (&dev->mphy); -tasklet_disable (&dev->mt76.tx_tasklet); +mt76_worker_disable (&dev->mt76.tx_worker);tasklet_disable (&dev->mt76.pre_tbtt_tasklet);napi_disable (&dev->mt76.napi[0 ]);napi_disable (&dev->mt76.napi[1 ]);
@@ -1451,7 +1451,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev)clear_bit (MT76_RESET , &dev->mphy.state);mutex_unlock (&dev->mt76.mutex); -tasklet_enable (&dev->mt76.tx_tasklet); +mt76_worker_enable (&dev->mt76.tx_worker);napi_enable (&dev->mt76.tx_napi);napi_schedule (&dev->mt76.tx_napi);
drivers/net/wireless/mediatek/mt76/mt7615/dma.c +0 -1
@@ -297,6 +297,5 @@ void mt7615_dma_cleanup(struct mt7615_dev *dev) MT_WPDMA_GLO_CFG_RX_DMA_EN);mt76_set (dev,MT_WPDMA_GLO_CFG ,MT_WPDMA_GLO_CFG_SW_RESET ); -tasklet_kill (&dev->mt76.tx_tasklet);mt76_dma_cleanup (&dev->mt76); }
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +4 -4
@@ -1462,7 +1462,7 @@ static void mt7615_mac_tx_free(struct mt7615_dev *dev, struct sk_buff *skb)rcu_read_unlock ();mt7615_pm_power_save_sched (dev); -tasklet_schedule (&dev->mt76.tx_tasklet); +mt76_worker_schedule (&dev->mt76.tx_worker); } void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
@@ -1888,7 +1888,7 @@ void mt7615_pm_wake_work(struct work_struct *work) }spin_unlock_bh (&dev->pm.txq_lock); -tasklet_schedule (&dev->mt76.tx_tasklet); +mt76_worker_schedule (&dev->mt76.tx_worker); out:ieee80211_wake_queues (mphy->hw);
@@ -2130,7 +2130,7 @@ void mt7615_mac_reset_work(struct work_struct *work)if (ext_phy)mt76_txq_schedule_all (ext_phy); -tasklet_disable (&dev->mt76.tx_tasklet); +mt76_worker_disable (&dev->mt76.tx_worker);napi_disable (&dev->mt76.napi[0 ]);napi_disable (&dev->mt76.napi[1 ]);napi_disable (&dev->mt76.tx_napi);
@@ -2151,7 +2151,7 @@ void mt7615_mac_reset_work(struct work_struct *work)clear_bit (MT76_MCU_RESET , &dev->mphy.state);clear_bit (MT76_RESET , &dev->mphy.state); -tasklet_enable (&dev->mt76.tx_tasklet); +mt76_worker_enable (&dev->mt76.tx_worker);napi_enable (&dev->mt76.tx_napi);napi_schedule (&dev->mt76.tx_napi);
drivers/net/wireless/mediatek/mt76/mt7615/main.c +1 -1
@@ -707,7 +707,7 @@ mt7615_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq) } dev->pm.last_activity = jiffies; -tasklet_schedule (&dev->mt76.tx_tasklet); +mt76_worker_schedule (&dev->mt76.tx_worker); } static void mt7615_tx(struct ieee80211_hw *hw,
drivers/net/wireless/mediatek/mt76/mt7615/pci.c +2 -1
@@ -88,7 +88,7 @@ static int mt7615_pci_suspend(struct pci_dev *pdev, pm_message_t state) }napi_disable (&mdev->tx_napi); -tasklet_kill (&mdev->tx_tasklet); +mt76_worker_disable (&mdev->tx_worker);mt76_for_each_q_rx (mdev, i) {napi_disable (&mdev->napi[i]);
@@ -162,6 +162,7 @@ static int mt7615_pci_resume(struct pci_dev *pdev)if (pdma_reset)dev_err (mdev->dev,"PDMA engine must be reinitialized\n" ); +mt76_worker_enable (&mdev->tx_worker);mt76_for_each_q_rx (mdev, i) {napi_enable (&mdev->napi[i]);napi_schedule (&mdev->napi[i]);
drivers/net/wireless/mediatek/mt76/mt7615/usb.c +0 -2
@@ -180,9 +180,7 @@ static int mt7663u_suspend(struct usb_interface *intf, pm_message_t state) }mt76u_stop_rx (&dev->mt76); -mt76u_stop_tx (&dev->mt76); -tasklet_kill (&dev->mt76.tx_tasklet);return 0 ; }
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c +1 -1
@@ -204,7 +204,7 @@ static void mt76x0e_cleanup(struct mt76x02_dev *dev)tasklet_disable (&dev->mt76.pre_tbtt_tasklet);mt76x0_chip_onoff (dev, false, false);mt76x0e_stop_hw (dev); -mt76x02_dma_cleanup (dev); +mt76_dma_cleanup (&dev->mt76);mt76x02_mcu_cleanup (dev); }
drivers/net/wireless/mediatek/mt76/mt76x02_dma.h +0 -1
@@ -61,6 +61,5 @@ mt76x02_wait_for_wpdma(struct mt76_dev *dev, int timeout)int mt76x02_dma_init (struct mt76x02_dev *dev);void mt76x02_dma_disable (struct mt76x02_dev *dev); -void mt76x02_dma_cleanup (struct mt76x02_dev *dev);#endif /* __MT76x02_DMA_H */
drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c +8 -14
@@ -149,9 +149,11 @@ static void mt76x02_process_tx_status_fifo(struct mt76x02_dev *dev)mt76x02_send_tx_status (dev, &stat, &update); } -static void mt76x02_tx_tasklet (unsigned long data) +static void mt76x02_tx_worker (struct mt76_worker *w) { -struct mt76x02_dev *dev = (struct mt76x02_dev *)data; +struct mt76x02_dev *dev; + + dev = container_of(w, struct mt76x02_dev, mt76.tx_worker);mt76x02_mac_poll_tx_status (dev, false);mt76x02_process_tx_status_fifo (dev);
@@ -176,7 +178,7 @@ static int mt76x02_poll_tx(struct napi_struct *napi, int budget)for (i =MT_TXQ_MCU ; i >=0 ; i--)mt76_queue_tx_cleanup (dev, i, false); -tasklet_schedule (&dev->mt76.tx_tasklet); +mt76_worker_schedule (&dev->mt76.tx_worker);return 0 ; }
@@ -195,8 +197,7 @@ int mt76x02_dma_init(struct mt76x02_dev *dev)if (!status_fifo)return -ENOMEM ; -tasklet_init (&dev->mt76.tx_tasklet, mt76x02_tx_tasklet, - (unsigned long )dev); + dev->mt76.tx_worker.fn = mt76x02_tx_worker;tasklet_init (&dev->mt76.pre_tbtt_tasklet, mt76x02_pre_tbtt_tasklet, (unsigned long )dev);
@@ -323,13 +324,6 @@ static void mt76x02_dma_enable(struct mt76x02_dev *dev) MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE); } -void mt76x02_dma_cleanup (struct mt76x02_dev *dev) -{ -tasklet_kill (&dev->mt76.tx_tasklet); -mt76_dma_cleanup (&dev->mt76); -} -EXPORT_SYMBOL_GPL (mt76x02_dma_cleanup); -void mt76x02_dma_disable (struct mt76x02_dev *dev) {u32 val =mt76_rr (dev,MT_WPDMA_GLO_CFG );
@@ -447,7 +441,7 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev)set_bit (MT76_RESET , &dev->mphy.state);tasklet_disable (&dev->mt76.pre_tbtt_tasklet); -tasklet_disable (&dev->mt76.tx_tasklet); +mt76_worker_disable (&dev->mt76.tx_worker);napi_disable (&dev->mt76.tx_napi);mt76_for_each_q_rx (&dev->mt76, i) {
@@ -504,7 +498,7 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev)clear_bit (MT76_RESET , &dev->mphy.state); -tasklet_enable (&dev->mt76.tx_tasklet); +mt76_worker_enable (&dev->mt76.tx_worker);napi_enable (&dev->mt76.tx_napi);napi_schedule (&dev->mt76.tx_napi);
drivers/net/wireless/mediatek/mt76/mt76x2/pci.c +2 -1
@@ -113,7 +113,7 @@ mt76x2e_suspend(struct pci_dev *pdev, pm_message_t state)napi_disable (&mdev->tx_napi);tasklet_kill (&mdev->pre_tbtt_tasklet); -tasklet_kill (&mdev->tx_tasklet); +mt76_worker_disable (&mdev->tx_worker);mt76_for_each_q_rx (mdev, i)napi_disable (&mdev->napi[i]);
@@ -147,6 +147,7 @@ mt76x2e_resume(struct pci_dev *pdev)pci_restore_state (pdev); +mt76_worker_enable (&mdev->tx_worker);mt76_for_each_q_rx (mdev, i) {napi_enable (&mdev->napi[i]);napi_schedule (&mdev->napi[i]);
drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c +1 -1
@@ -283,7 +283,7 @@ void mt76x2_cleanup(struct mt76x02_dev *dev)tasklet_disable (&dev->dfs_pd.dfs_tasklet);tasklet_disable (&dev->mt76.pre_tbtt_tasklet);mt76x2_stop_hardware (dev); -mt76x02_dma_cleanup (dev); +mt76_dma_cleanup (&dev->mt76);mt76x02_mcu_cleanup (dev); }
drivers/net/wireless/mediatek/mt76/mt7915/dma.c +0 -1
@@ -372,6 +372,5 @@ void mt7915_dma_cleanup(struct mt7915_dev *dev)MT_WFDMA0_RST_DMASHDL_ALL_RST | MT_WFDMA0_RST_LOGIC_RST); -tasklet_kill (&dev->mt76.tx_tasklet);mt76_dma_cleanup (&dev->mt76); }
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +3 -3
@@ -951,7 +951,7 @@ void mt7915_mac_tx_free(struct mt7915_dev *dev, struct sk_buff *skb)dev_kfree_skb (skb);mt7915_mac_sta_poll (dev); -tasklet_schedule (&dev->mt76.tx_tasklet); +mt76_worker_schedule (&dev->mt76.tx_worker); }void mt7915_tx_complete_skb (struct mt76_dev *mdev,struct mt76_queue_entry *e)
@@ -1223,7 +1223,7 @@ void mt7915_mac_reset_work(struct work_struct *work)if (ext_phy)mt76_txq_schedule_all (ext_phy); -tasklet_disable (&dev->mt76.tx_tasklet); +mt76_worker_disable (&dev->mt76.tx_worker);napi_disable (&dev->mt76.napi[0 ]);napi_disable (&dev->mt76.napi[1 ]);napi_disable (&dev->mt76.napi[2 ]);
@@ -1243,7 +1243,7 @@ void mt7915_mac_reset_work(struct work_struct *work)clear_bit (MT76_MCU_RESET , &dev->mphy.state);clear_bit (MT76_RESET , &dev->mphy.state); -tasklet_enable (&dev->mt76.tx_tasklet); +mt76_worker_enable (&dev->mt76.tx_worker);napi_enable (&dev->mt76.tx_napi);napi_schedule (&dev->mt76.tx_napi);
drivers/net/wireless/mediatek/mt76/testmode.c +3 -3
@@ -161,7 +161,7 @@ mt76_testmode_tx_start(struct mt76_dev *dev) td->tx_queued =0 ; td->tx_done =0 ; td->tx_pending = td->tx_count; -tasklet_schedule (&dev->tx_tasklet); +mt76_worker_schedule (&dev->tx_worker); } static void
@@ -169,11 +169,11 @@ mt76_testmode_tx_stop(struct mt76_dev *dev) {struct mt76_testmode_data *td = &dev->test; -tasklet_disable (&dev->tx_tasklet); +mt76_worker_disable (&dev->tx_worker); td->tx_pending =0 ; -tasklet_enable (&dev->tx_tasklet); +mt76_worker_enable (&dev->tx_worker);wait_event_timeout (dev->tx_wait, td->tx_done == td->tx_queued,10 *HZ );
drivers/net/wireless/mediatek/mt76/tx.c +3 -3
@@ -604,9 +604,9 @@ void mt76_txq_schedule_all(struct mt76_phy *phy) }EXPORT_SYMBOL_GPL (mt76_txq_schedule_all); -void mt76_tx_tasklet (unsigned long data) +void mt76_tx_worker (struct mt76_worker *w) { -struct mt76_dev *dev = (struct mt76_dev *)data; + struct mt76_dev *dev = container_of(w, struct mt76_dev, tx_worker);mt76_txq_schedule_all (&dev->phy);if (dev->phy2)
@@ -649,7 +649,7 @@ void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)if (!test_bit (MT76_STATE_RUNNING , &phy->state))return ; -tasklet_schedule (&dev->tx_tasklet); +mt76_worker_schedule (&dev->tx_worker); }EXPORT_SYMBOL_GPL (mt76_wake_tx_queue);
drivers/net/wireless/mediatek/mt76/usb.c +8 -6
@@ -792,9 +792,9 @@ int mt76u_resume_rx(struct mt76_dev *dev) }EXPORT_SYMBOL_GPL (mt76u_resume_rx); -static void mt76u_tx_tasklet (unsigned long data) +static void mt76u_tx_worker (struct mt76_worker *w) { -struct mt76_dev *dev = (struct mt76_dev *)data; + struct mt76_dev *dev = container_of(w, struct mt76_dev, tx_worker);struct mt76_queue_entry entry;struct mt76_queue *q;bool wake;
@@ -864,7 +864,7 @@ static void mt76u_complete_tx(struct urb *urb)dev_err (dev->dev,"tx urb failed: %d\n" , urb->status); e->done = true; -tasklet_schedule (&dev->tx_tasklet); +mt76_worker_schedule (&dev->tx_worker); } static int
@@ -1020,6 +1020,8 @@ void mt76u_stop_tx(struct mt76_dev *dev) {int ret; +mt76_worker_disable (&dev->tx_worker); + ret =wait_event_timeout (dev->tx_wait, !mt76_has_tx_pending (&dev->phy),HZ /5 );if (!ret) {
@@ -1038,8 +1040,6 @@ void mt76u_stop_tx(struct mt76_dev *dev)usb_kill_urb (q->entry[j].urb); } -tasklet_kill (&dev->tx_tasklet); -/* On device removal we maight queue skb's, but mt76u_tx_kick() * will fail to submit urb, cleanup those skb's manually. */
@@ -1058,6 +1058,8 @@ void mt76u_stop_tx(struct mt76_dev *dev)cancel_work_sync (&dev->usb.stat_work);clear_bit (MT76_READING_STATS , &dev->phy.state); +mt76_worker_enable (&dev->tx_worker); +mt76_tx_status_check (dev,NULL , true); }EXPORT_SYMBOL_GPL (mt76u_stop_tx);
@@ -1107,8 +1109,8 @@ int mt76u_init(struct mt76_dev *dev, mt76u_ops.rmw = ext ? mt76u_rmw_ext : mt76u_rmw; mt76u_ops.write_copy = ext ? mt76u_copy_ext : mt76u_copy; + dev->tx_worker.fn = mt76u_tx_worker;tasklet_init (&usb->rx_tasklet, mt76u_rx_tasklet, (unsigned long )dev); -tasklet_init (&dev->tx_tasklet, mt76u_tx_tasklet, (unsigned long )dev);INIT_WORK (&usb->stat_work, mt76u_tx_status_data); usb->data_len =usb_maxpacket (udev,usb_sndctrlpipe (udev,0 ),1 );
Signature · 1 line
2.28.0
Felix Fietkau
maintainerPATCH 6/11 mt76: mt7915: fix HE BSS info
In reply to Felix Fietkauhe_pe_duration and he_rts_thres have the same unit as the fields in the HE operation IE
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +2 -2
@@ -936,11 +936,11 @@ mt7915_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, tlv =mt7915_mcu_add_tlv (skb,BSS_INFO_HE_BASIC ,sizeof (*he)); he = (struct bss_info_he *)tlv; - he->he_pe_duration = vif->bss_conf.htc_trig_based_pkt_ext *4 ; + he->he_pe_duration = vif->bss_conf.htc_trig_based_pkt_ext;if (!he->he_pe_duration) he->he_pe_duration =DEFAULT_HE_PE_DURATION ; - he->he_rts_thres =cpu_to_le16 (vif->bss_conf.frame_time_rts_th *32 ); + he->he_rts_thres =cpu_to_le16 (vif->bss_conf.frame_time_rts_th);if (!he->he_rts_thres) he->he_rts_thres =cpu_to_le16 (DEFAULT_HE_DURATION_RTS_THRES );
Signature · 1 line
2.28.0
Felix Fietkau
maintainerPATCH 7/11 mt76: dma: cache dma map address/len in struct mt76_queue_entry
In reply to Felix FietkauAccessing them from uncached memory can be expensive, so it's cheaper to cache them
--- drivers/net/wireless/mediatek/mt76/dma.c | 43 +++++++++++------------ drivers/net/wireless/mediatek/mt76/mt76.h | 2 ++ 2 files changed, 22 insertions(+), 23 deletions(-)
drivers/net/wireless/mediatek/mt76/dma.c +20 -23
@@ -49,6 +49,7 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q, struct mt76_queue_buf *buf, int nbufs, u32 info, struct sk_buff *skb, void *txwi) { + struct mt76_queue_entry *entry;struct mt76_desc *desc;u32 ctrl;int i, idx =-1 ;
@@ -61,16 +62,27 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,for (i =0 ; i < nbufs; i +=2 , buf +=2 ) {u32 buf0 = buf[0 ].addr, buf1 =0 ; + idx = q->head; + q->head = (q->head +1 ) % q->ndesc; + + desc = &q->desc[idx]; + entry = &q->entry[idx]; +if (buf[0 ].skip_unmap) - q->entry[q->head].skip_buf0 = true; - q->entry[q->head].skip_buf1 = i == nbufs -1 ; + entry->skip_buf0 = true; + entry->skip_buf1 = i == nbufs -1 ; + + entry->dma_addr[0 ] = buf[0 ].addr; + entry->dma_len[0 ] = buf[0 ].len; ctrl =FIELD_PREP (MT_DMA_CTL_SD_LEN0 , buf[0 ].len);if (i < nbufs -1 ) { + entry->dma_addr[1 ] = buf[1 ].addr; + entry->dma_len[1 ] = buf[1 ].len; buf1 = buf[1 ].addr; ctrl |=FIELD_PREP (MT_DMA_CTL_SD_LEN1 , buf[1 ].len);if (buf[1 ].skip_unmap) - q->entry[q->head].skip_buf1 = true; + entry->skip_buf1 = true; }if (i == nbufs -1 )
@@ -78,11 +90,6 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,else if (i == nbufs -2 ) ctrl |=MT_DMA_CTL_LAST_SEC1 ; - idx = q->head; - q->head = (q->head +1 ) % q->ndesc; - - desc = &q->desc[idx]; -WRITE_ONCE (desc->buf0,cpu_to_le32 (buf0));WRITE_ONCE (desc->buf1,cpu_to_le32 (buf1));WRITE_ONCE (desc->info,cpu_to_le32 (info));
@@ -102,24 +109,14 @@ mt76_dma_tx_cleanup_idx(struct mt76_dev *dev, struct mt76_queue *q, int idx, struct mt76_queue_entry *prev_e) {struct mt76_queue_entry *e = &q->entry[idx]; -__le32 __ctrl =READ_ONCE (q->desc[idx].ctrl); -u32 ctrl =le32_to_cpu (__ctrl); - -if (!e->skip_buf0) { -__le32 addr =READ_ONCE (q->desc[idx].buf0); -u32 len =FIELD_GET (MT_DMA_CTL_SD_LEN0 , ctrl); -dma_unmap_single (dev->dev,le32_to_cpu (addr), len, +if (!e->skip_buf0) +dma_unmap_single (dev->dev, e->dma_addr[0 ], e->dma_len[0 ],DMA_TO_DEVICE ); - } - -if (!e->skip_buf1) { -__le32 addr =READ_ONCE (q->desc[idx].buf1); -u32 len =FIELD_GET (MT_DMA_CTL_SD_LEN1 , ctrl); -dma_unmap_single (dev->dev,le32_to_cpu (addr), len, +if (!e->skip_buf1) +dma_unmap_single (dev->dev, e->dma_addr[1 ], e->dma_len[1 ],DMA_TO_DEVICE ); - }if (e->txwi ==DMA_DUMMY_DATA ) e->txwi =NULL ;
@@ -207,7 +204,7 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,void *buf = e->buf;int buf_len =SKB_WITH_OVERHEAD (q->buf_size); - buf_addr =le32_to_cpu (READ_ONCE (desc->buf0)); + buf_addr = e->dma_addr[0 ];if (len) {u32 ctl =le32_to_cpu (READ_ONCE (desc->ctrl)); *len =FIELD_GET (MT_DMA_CTL_SD_LEN0 , ctl);
drivers/net/wireless/mediatek/mt76/mt76.h +2 -0
@@ -102,6 +102,8 @@ struct mt76_queue_entry {struct urb *urb;int buf_sz; }; +u32 dma_addr[2 ]; +u16 dma_len[2 ];u16 wcid; bool skip_buf0:1; bool skip_buf1:1;
Signature · 1 line
2.28.0
Felix Fietkau
maintainerPATCH 8/11 mt76: mt7915: simplify mt7915_lmac_mapping
In reply to Felix FietkauCompared to mac80211 ACs, MT7915 queue numbers are in reverse order There is no need for the defensive WARN_ON_ONCE, so we can simplify the function to avoid the array lookup
--- drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +2 -11
@@ -258,17 +258,8 @@ mt7915_ext_phy(struct mt7915_dev *dev)static inline u8 mt7915_lmac_mapping (struct mt7915_dev *dev,u8 ac) { -static const u8 lmac_queue_map[] = { - [IEEE80211_AC_BK ] =MT_LMAC_AC00 , - [IEEE80211_AC_BE ] =MT_LMAC_AC01 , - [IEEE80211_AC_VI ] =MT_LMAC_AC02 , - [IEEE80211_AC_VO ] =MT_LMAC_AC03 , - }; - -if (WARN_ON_ONCE (ac >=ARRAY_SIZE (lmac_queue_map))) -return MT_LMAC_AC01 ;/* BE */ - -return lmac_queue_map[ac]; +/* LMAC uses the reverse order of mac80211 AC indexes */ +return 3 - ac; }extern const struct ieee80211_ops mt7915_ops;
Signature · 1 line
2.28.0
Felix Fietkau
maintainerPATCH 9/11 mt76: mt7915: fix queue/tid mapping for airtime reporting
In reply to Felix FietkauUnlike 7615, 7915 uses the same AC index for rx and tx, which matches the LMAC queue mapping
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +3 -8
@@ -105,12 +105,6 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev) [IEEE80211_AC_VI] = 4, [IEEE80211_AC_VO] = 6 }; -static const u8 hw_queue_map[] = { - [IEEE80211_AC_BK ] =0 , - [IEEE80211_AC_BE ] =1 , - [IEEE80211_AC_VI ] =2 , - [IEEE80211_AC_VO ] =3 , - };struct ieee80211_sta *sta;struct mt7915_sta *msta;u32 tx_time[IEEE80211_NUM_ACS ], rx_time[IEEE80211_NUM_ACS ];
@@ -169,8 +163,9 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev) sta = container_of((void *)msta, struct ieee80211_sta, drv_priv);for (i =0 ; i <IEEE80211_NUM_ACS ; i++) { -u32 tx_cur = tx_time[i]; -u32 rx_cur = rx_time[hw_queue_map[i]]; +u8 q =mt7915_lmac_mapping (dev, i); +u32 tx_cur = tx_time[q]; +u32 rx_cur = rx_time[q];u8 tid = ac_to_tid[i];if (!tx_cur && !rx_cur)
Signature · 1 line
2.28.0
Felix Fietkau
maintainerPATCH 10/11 mt76: move txwi handling code to dma.c, since it is mmio specific
In reply to Felix FietkauThis way we can make some functions static
--- drivers/net/wireless/mediatek/mt76/dma.c | 72 +++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mac80211.c | 2 - drivers/net/wireless/mediatek/mt76/mt76.h | 2 - drivers/net/wireless/mediatek/mt76/tx.c | 69 ------------------ 4 files changed, 72 insertions(+), 73 deletions(-)
drivers/net/wireless/mediatek/mt76/dma.c +72 -0
@@ -7,6 +7,76 @@#include "mt76.h" #include "dma.h" +static struct mt76_txwi_cache * +mt76_alloc_txwi (struct mt76_dev *dev) +{ +struct mt76_txwi_cache *t; +dma_addr_t addr; +u8 *txwi; +int size; + + size =L1_CACHE_ALIGN (dev->drv->txwi_size +sizeof (*t)); + txwi =devm_kzalloc (dev->dev, size,GFP_ATOMIC ); +if (!txwi) +return NULL ; + + addr =dma_map_single (dev->dev, txwi, dev->drv->txwi_size, +DMA_TO_DEVICE ); + t = (struct mt76_txwi_cache *)(txwi + dev->drv->txwi_size); + t->dma_addr = addr; + +return t; +} + +static struct mt76_txwi_cache * +__mt76_get_txwi (struct mt76_dev *dev) +{ +struct mt76_txwi_cache *t =NULL ; + +spin_lock (&dev->lock); +if (!list_empty (&dev->txwi_cache)) { + t = list_first_entry(&dev->txwi_cache, struct mt76_txwi_cache, + list); +list_del (&t->list); + } +spin_unlock (&dev->lock); + +return t; +} + +static struct mt76_txwi_cache * +mt76_get_txwi (struct mt76_dev *dev) +{ +struct mt76_txwi_cache *t =__mt76_get_txwi (dev); + +if (t) +return t; + +return mt76_alloc_txwi (dev); +} + +void +mt76_put_txwi (struct mt76_dev *dev,struct mt76_txwi_cache *t) +{ +if (!t) +return ; + +spin_lock (&dev->lock); +list_add (&t->list, &dev->txwi_cache); +spin_unlock (&dev->lock); +} +EXPORT_SYMBOL_GPL (mt76_put_txwi); + +static void +mt76_free_pending_txwi (struct mt76_dev *dev) +{ +struct mt76_txwi_cache *t; + +while ((t =__mt76_get_txwi (dev)) !=NULL ) +dma_unmap_single (dev->dev, t->dma_addr, dev->drv->txwi_size, +DMA_TO_DEVICE ); +} + static int mt76_dma_alloc_queue(struct mt76_dev *dev, struct mt76_queue *q, int idx, int n_desc, int bufsize,
@@ -598,5 +668,7 @@ void mt76_dma_cleanup(struct mt76_dev *dev)netif_napi_del (&dev->napi[i]);mt76_dma_rx_cleanup (dev, &dev->q_rx[i]); } + +mt76_free_pending_txwi (dev); }EXPORT_SYMBOL_GPL (mt76_dma_cleanup);
drivers/net/wireless/mediatek/mt76/mac80211.c +0 -2
@@ -515,8 +515,6 @@ void mt76_free_device(struct mt76_dev *dev)destroy_workqueue (dev->wq); dev->wq =NULL ; } -if (mt76_is_mmio (dev)) -mt76_tx_free (dev);ieee80211_free_hw (dev->hw); }EXPORT_SYMBOL_GPL (mt76_free_device);
drivers/net/wireless/mediatek/mt76/mt76.h +0 -2
@@ -1005,8 +1005,6 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)return hw; } -void mt76_tx_free (struct mt76_dev *dev); -struct mt76_txwi_cache *mt76_get_txwi (struct mt76_dev *dev);void mt76_put_txwi (struct mt76_dev *dev,struct mt76_txwi_cache *t);void mt76_rx_complete (struct mt76_dev *dev,struct sk_buff_head *frames,struct napi_struct *napi);
drivers/net/wireless/mediatek/mt76/tx.c +0 -69
75 lines not on this page · raw message
Signature · 1 line
2.28.0
Felix Fietkau
maintainerPATCH 11/11 mt76: remove retry_q from struct mt76_txq and related code
In reply to Felix FietkauSince the switch to using AQL by default, mtxq->retry_q is never filled anymore Remove it to get rid of a few more unnecessary cycles in the tx path
--- drivers/net/wireless/mediatek/mt76/mac80211.c | 19 ------- drivers/net/wireless/mediatek/mt76/mt76.h | 5 -- .../net/wireless/mediatek/mt76/mt7603/main.c | 2 - .../net/wireless/mediatek/mt76/mt7615/main.c | 3 -- .../net/wireless/mediatek/mt76/mt76x02_util.c | 3 -- .../net/wireless/mediatek/mt76/mt7915/main.c | 3 -- drivers/net/wireless/mediatek/mt76/tx.c | 51 +++---------------- 7 files changed, 6 insertions(+), 80 deletions(-)
drivers/net/wireless/mediatek/mt76/mac80211.c +0 -19
@@ -879,7 +879,6 @@ mt76_check_sta(struct mt76_dev *dev, struct sk_buff *skb)struct ieee80211_hw *hw;struct mt76_wcid *wcid = status->wcid;bool ps; -int i; hw =mt76_phy_hw (dev, status->ext_phy);if (ieee80211_is_pspoll (hdr->frame_control) && !wcid) {
@@ -929,20 +928,6 @@ mt76_check_sta(struct mt76_dev *dev, struct sk_buff *skb) dev->drv->sta_ps (dev, sta, ps);ieee80211_sta_ps_transition (sta, ps); - -if (ps) -return ; - -for (i =0 ; i <ARRAY_SIZE (sta->txq); i++) { -struct mt76_txq *mtxq; - -if (!sta->txq[i]) -continue ; - - mtxq = (struct mt76_txq *)sta->txq[i]->drv_priv; -if (!skb_queue_empty (&mtxq->retry_q)) -ieee80211_schedule_txq (hw, sta->txq[i]); - } } void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
@@ -1004,8 +989,6 @@ mt76_sta_add(struct mt76_dev *dev, struct ieee80211_vif *vif, mtxq = (struct mt76_txq *)sta->txq[i]->drv_priv; mtxq->wcid = wcid; - -mt76_txq_init (dev, sta->txq[i]); }ewma_signal_init (&wcid->rssi);
@@ -1033,8 +1016,6 @@ void __mt76_sta_remove(struct mt76_dev *dev, struct ieee80211_vif *vif, dev->drv->sta_remove (dev, vif, sta);mt76_tx_status_check (dev, wcid, true); -for (i =0 ; i <ARRAY_SIZE (sta->txq); i++) -mt76_txq_remove (dev, sta->txq[i]);mt76_wcid_mask_clear (dev->wcid_mask, idx);mt76_wcid_mask_clear (dev->wcid_phy_mask, idx); }
drivers/net/wireless/mediatek/mt76/mt76.h +0 -5
@@ -226,11 +226,8 @@ struct mt76_wcid { };struct mt76_txq { -struct mt76_queue *q;struct mt76_wcid *wcid; -struct sk_buff_head retry_q; -u16 agg_ssn;bool send_bar;bool aggr;
@@ -900,8 +897,6 @@ static inline bool mt76_testmode_enabled(struct mt76_dev *dev)void mt76_rx (struct mt76_dev *dev,enum mt76_rxq_id q,struct sk_buff *skb);void mt76_tx (struct mt76_phy *dev,struct ieee80211_sta *sta,struct mt76_wcid *wcid,struct sk_buff *skb); -void mt76_txq_init (struct mt76_dev *dev,struct ieee80211_txq *txq); -void mt76_txq_remove (struct mt76_dev *dev,struct ieee80211_txq *txq);void mt76_wake_tx_queue (struct ieee80211_hw *hw,struct ieee80211_txq *txq);void mt76_stop_tx_queues (struct mt76_dev *dev,struct ieee80211_sta *sta,bool send_bar);
drivers/net/wireless/mediatek/mt76/mt7603/main.c +0 -2
@@ -75,7 +75,6 @@ mt7603_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mtxq = (struct mt76_txq *)vif->txq->drv_priv; mtxq->wcid = &mvif->sta.wcid; -mt76_txq_init (&dev->mt76, vif->txq);rcu_assign_pointer (dev->mt76.wcid[idx], &mvif->sta.wcid); out:
@@ -99,7 +98,6 @@ mt7603_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)mt7603_beacon_set_timer (dev, mvif->idx,0 );rcu_assign_pointer (dev->mt76.wcid[idx],NULL ); -mt76_txq_remove (&dev->mt76, vif->txq);spin_lock_bh (&dev->sta_poll_lock);if (!list_empty (&msta->poll_list))
drivers/net/wireless/mediatek/mt76/mt7615/main.c +0 -3
@@ -205,7 +205,6 @@ static int mt7615_add_interface(struct ieee80211_hw *hw,if (vif->txq) { mtxq = (struct mt76_txq *)vif->txq->drv_priv; mtxq->wcid = &mvif->sta.wcid; -mt76_txq_init (&dev->mt76, vif->txq); } ret =mt7615_mcu_add_dev_info (dev, vif, true);
@@ -256,8 +255,6 @@ static void mt7615_remove_interface(struct ieee80211_hw *hw,mt7615_mcu_add_dev_info (dev, vif, false);rcu_assign_pointer (dev->mt76.wcid[idx],NULL ); -if (vif->txq) -mt76_txq_remove (&dev->mt76, vif->txq); dev->mphy.vif_mask &= ~BIT (mvif->idx); dev->omac_mask &= ~BIT (mvif->omac_idx);
drivers/net/wireless/mediatek/mt76/mt76x02_util.c +0 -3
@@ -294,8 +294,6 @@ mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif, mvif->group_wcid.hw_key_idx =-1 ; mtxq = (struct mt76_txq *)vif->txq->drv_priv; mtxq->wcid = &mvif->group_wcid; - -mt76_txq_init (&dev->mt76, vif->txq); }int
@@ -347,7 +345,6 @@ void mt76x02_remove_interface(struct ieee80211_hw *hw,struct mt76x02_dev *dev = hw->priv;struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv; -mt76_txq_remove (&dev->mt76, vif->txq); dev->mphy.vif_mask &= ~BIT (mvif->idx); }EXPORT_SYMBOL_GPL (mt76x02_remove_interface);
drivers/net/wireless/mediatek/mt76/mt7915/main.c +0 -3
@@ -169,7 +169,6 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,if (vif->txq) { mtxq = (struct mt76_txq *)vif->txq->drv_priv; mtxq->wcid = &mvif->sta.wcid; -mt76_txq_init (&dev->mt76, vif->txq); } out:
@@ -192,8 +191,6 @@ static void mt7915_remove_interface(struct ieee80211_hw *hw,mt7915_mcu_add_dev_info (dev, vif, false);rcu_assign_pointer (dev->mt76.wcid[idx],NULL ); -if (vif->txq) -mt76_txq_remove (&dev->mt76, vif->txq);mutex_lock (&dev->mt76.mutex); phy->mt76->vif_mask &= ~BIT (mvif->idx);
drivers/net/wireless/mediatek/mt76/tx.c +6 -45
100 lines not on this page · raw message
Signature · 1 line
2.28.0