Commit a33b8ab8 authored by Felix Fietkau's avatar Felix Fietkau

mt76: move tx tasklet to struct mt76_dev

Allows it to be scheduled from core code
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent db9f11d3
...@@ -386,7 +386,6 @@ struct mt76_usb { ...@@ -386,7 +386,6 @@ struct mt76_usb {
u8 data[32]; u8 data[32];
struct tasklet_struct rx_tasklet; struct tasklet_struct rx_tasklet;
struct tasklet_struct tx_tasklet;
struct delayed_work stat_work; struct delayed_work stat_work;
u8 out_ep[__MT_EP_OUT_MAX]; u8 out_ep[__MT_EP_OUT_MAX];
...@@ -448,6 +447,8 @@ struct mt76_dev { ...@@ -448,6 +447,8 @@ struct mt76_dev {
const struct mt76_queue_ops *queue_ops; const struct mt76_queue_ops *queue_ops;
int tx_dma_idx[4]; int tx_dma_idx[4];
struct tasklet_struct tx_tasklet;
wait_queue_head_t tx_wait; wait_queue_head_t tx_wait;
struct sk_buff_head status_list; struct sk_buff_head status_list;
......
...@@ -35,7 +35,7 @@ irqreturn_t mt7603_irq_handler(int irq, void *dev_instance) ...@@ -35,7 +35,7 @@ irqreturn_t mt7603_irq_handler(int irq, void *dev_instance)
if (intr & MT_INT_TX_DONE_ALL) { if (intr & MT_INT_TX_DONE_ALL) {
mt7603_irq_disable(dev, MT_INT_TX_DONE_ALL); mt7603_irq_disable(dev, MT_INT_TX_DONE_ALL);
tasklet_schedule(&dev->tx_tasklet); tasklet_schedule(&dev->mt76.tx_tasklet);
} }
if (intr & MT_INT_RX_DONE(0)) { if (intr & MT_INT_RX_DONE(0)) {
......
...@@ -164,7 +164,7 @@ int mt7603_dma_init(struct mt7603_dev *dev) ...@@ -164,7 +164,7 @@ int mt7603_dma_init(struct mt7603_dev *dev)
init_waitqueue_head(&dev->mt76.mmio.mcu.wait); init_waitqueue_head(&dev->mt76.mmio.mcu.wait);
skb_queue_head_init(&dev->mt76.mmio.mcu.res_q); skb_queue_head_init(&dev->mt76.mmio.mcu.res_q);
tasklet_init(&dev->tx_tasklet, mt7603_tx_tasklet, (unsigned long)dev); tasklet_init(&dev->mt76.tx_tasklet, mt7603_tx_tasklet, (unsigned long)dev);
mt76_clear(dev, MT_WPDMA_GLO_CFG, mt76_clear(dev, MT_WPDMA_GLO_CFG,
MT_WPDMA_GLO_CFG_TX_DMA_EN | MT_WPDMA_GLO_CFG_TX_DMA_EN |
...@@ -224,6 +224,6 @@ void mt7603_dma_cleanup(struct mt7603_dev *dev) ...@@ -224,6 +224,6 @@ void mt7603_dma_cleanup(struct mt7603_dev *dev)
MT_WPDMA_GLO_CFG_RX_DMA_EN | MT_WPDMA_GLO_CFG_RX_DMA_EN |
MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE); MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE);
tasklet_kill(&dev->tx_tasklet); tasklet_kill(&dev->mt76.tx_tasklet);
mt76_dma_cleanup(&dev->mt76); mt76_dma_cleanup(&dev->mt76);
} }
...@@ -1277,7 +1277,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev) ...@@ -1277,7 +1277,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev)
/* lock/unlock all queues to ensure that no tx is pending */ /* lock/unlock all queues to ensure that no tx is pending */
mt76_txq_schedule_all(&dev->mt76); mt76_txq_schedule_all(&dev->mt76);
tasklet_disable(&dev->tx_tasklet); tasklet_disable(&dev->mt76.tx_tasklet);
tasklet_disable(&dev->pre_tbtt_tasklet); tasklet_disable(&dev->pre_tbtt_tasklet);
napi_disable(&dev->mt76.napi[0]); napi_disable(&dev->mt76.napi[0]);
napi_disable(&dev->mt76.napi[1]); napi_disable(&dev->mt76.napi[1]);
...@@ -1324,8 +1324,8 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev) ...@@ -1324,8 +1324,8 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev)
clear_bit(MT76_RESET, &dev->mt76.state); clear_bit(MT76_RESET, &dev->mt76.state);
mutex_unlock(&dev->mt76.mutex); mutex_unlock(&dev->mt76.mutex);
tasklet_enable(&dev->tx_tasklet); tasklet_enable(&dev->mt76.tx_tasklet);
tasklet_schedule(&dev->tx_tasklet); tasklet_schedule(&dev->mt76.tx_tasklet);
tasklet_enable(&dev->pre_tbtt_tasklet); tasklet_enable(&dev->pre_tbtt_tasklet);
mt7603_beacon_set_timer(dev, -1, beacon_int); mt7603_beacon_set_timer(dev, -1, beacon_int);
......
...@@ -145,7 +145,6 @@ struct mt7603_dev { ...@@ -145,7 +145,6 @@ struct mt7603_dev {
unsigned int reset_cause[__RESET_CAUSE_MAX]; unsigned int reset_cause[__RESET_CAUSE_MAX];
struct delayed_work mac_work; struct delayed_work mac_work;
struct tasklet_struct tx_tasklet;
struct tasklet_struct pre_tbtt_tasklet; struct tasklet_struct pre_tbtt_tasklet;
}; };
......
...@@ -332,7 +332,7 @@ static int __maybe_unused mt76x0_resume(struct usb_interface *usb_intf) ...@@ -332,7 +332,7 @@ static int __maybe_unused mt76x0_resume(struct usb_interface *usb_intf)
goto err; goto err;
tasklet_enable(&usb->rx_tasklet); tasklet_enable(&usb->rx_tasklet);
tasklet_enable(&usb->tx_tasklet); tasklet_enable(&dev->mt76.tx_tasklet);
ret = mt76x0u_init_hardware(dev); ret = mt76x0u_init_hardware(dev);
if (ret) if (ret)
......
...@@ -180,7 +180,8 @@ int mt76x02_dma_init(struct mt76x02_dev *dev) ...@@ -180,7 +180,8 @@ int mt76x02_dma_init(struct mt76x02_dev *dev)
if (!status_fifo) if (!status_fifo)
return -ENOMEM; return -ENOMEM;
tasklet_init(&dev->tx_tasklet, mt76x02_tx_tasklet, (unsigned long) dev); tasklet_init(&dev->mt76.tx_tasklet, mt76x02_tx_tasklet,
(unsigned long) dev);
tasklet_init(&dev->pre_tbtt_tasklet, mt76x02_pre_tbtt_tasklet, tasklet_init(&dev->pre_tbtt_tasklet, mt76x02_pre_tbtt_tasklet,
(unsigned long)dev); (unsigned long)dev);
...@@ -250,7 +251,7 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance) ...@@ -250,7 +251,7 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance)
if (intr & MT_INT_TX_DONE_ALL) { if (intr & MT_INT_TX_DONE_ALL) {
mt76x02_irq_disable(dev, MT_INT_TX_DONE_ALL); mt76x02_irq_disable(dev, MT_INT_TX_DONE_ALL);
tasklet_schedule(&dev->tx_tasklet); tasklet_schedule(&dev->mt76.tx_tasklet);
} }
if (intr & MT_INT_RX_DONE(0)) { if (intr & MT_INT_RX_DONE(0)) {
...@@ -276,7 +277,7 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance) ...@@ -276,7 +277,7 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance)
if (intr & MT_INT_TX_STAT) { if (intr & MT_INT_TX_STAT) {
mt76x02_mac_poll_tx_status(dev, true); mt76x02_mac_poll_tx_status(dev, true);
tasklet_schedule(&dev->tx_tasklet); tasklet_schedule(&dev->mt76.tx_tasklet);
} }
if (intr & MT_INT_GPTIMER) { if (intr & MT_INT_GPTIMER) {
...@@ -306,7 +307,7 @@ static void mt76x02_dma_enable(struct mt76x02_dev *dev) ...@@ -306,7 +307,7 @@ static void mt76x02_dma_enable(struct mt76x02_dev *dev)
void mt76x02_dma_cleanup(struct mt76x02_dev *dev) void mt76x02_dma_cleanup(struct mt76x02_dev *dev)
{ {
tasklet_kill(&dev->tx_tasklet); tasklet_kill(&dev->mt76.tx_tasklet);
mt76_dma_cleanup(&dev->mt76); mt76_dma_cleanup(&dev->mt76);
} }
EXPORT_SYMBOL_GPL(mt76x02_dma_cleanup); EXPORT_SYMBOL_GPL(mt76x02_dma_cleanup);
...@@ -425,7 +426,7 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev) ...@@ -425,7 +426,7 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev)
set_bit(MT76_RESET, &dev->mt76.state); set_bit(MT76_RESET, &dev->mt76.state);
tasklet_disable(&dev->pre_tbtt_tasklet); tasklet_disable(&dev->pre_tbtt_tasklet);
tasklet_disable(&dev->tx_tasklet); tasklet_disable(&dev->mt76.tx_tasklet);
for (i = 0; i < ARRAY_SIZE(dev->mt76.napi); i++) for (i = 0; i < ARRAY_SIZE(dev->mt76.napi); i++)
napi_disable(&dev->mt76.napi[i]); napi_disable(&dev->mt76.napi[i]);
...@@ -478,8 +479,8 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev) ...@@ -478,8 +479,8 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev)
clear_bit(MT76_RESET, &dev->mt76.state); clear_bit(MT76_RESET, &dev->mt76.state);
tasklet_enable(&dev->tx_tasklet); tasklet_enable(&dev->mt76.tx_tasklet);
tasklet_schedule(&dev->tx_tasklet); tasklet_schedule(&dev->mt76.tx_tasklet);
tasklet_enable(&dev->pre_tbtt_tasklet); tasklet_enable(&dev->pre_tbtt_tasklet);
......
...@@ -124,7 +124,7 @@ static int __maybe_unused mt76x2u_resume(struct usb_interface *intf) ...@@ -124,7 +124,7 @@ static int __maybe_unused mt76x2u_resume(struct usb_interface *intf)
goto err; goto err;
tasklet_enable(&usb->rx_tasklet); tasklet_enable(&usb->rx_tasklet);
tasklet_enable(&usb->tx_tasklet); tasklet_enable(&dev->mt76.tx_tasklet);
err = mt76x2u_init_hardware(dev); err = mt76x2u_init_hardware(dev);
if (err < 0) if (err < 0)
......
...@@ -702,7 +702,7 @@ static void mt76u_complete_tx(struct urb *urb) ...@@ -702,7 +702,7 @@ static void mt76u_complete_tx(struct urb *urb)
dev_err(dev->dev, "tx urb failed: %d\n", urb->status); dev_err(dev->dev, "tx urb failed: %d\n", urb->status);
e->done = true; e->done = true;
tasklet_schedule(&dev->usb.tx_tasklet); tasklet_schedule(&dev->tx_tasklet);
} }
static int static int
...@@ -843,7 +843,7 @@ static void mt76u_stop_tx(struct mt76_dev *dev) ...@@ -843,7 +843,7 @@ static void mt76u_stop_tx(struct mt76_dev *dev)
void mt76u_stop_queues(struct mt76_dev *dev) void mt76u_stop_queues(struct mt76_dev *dev)
{ {
tasklet_disable(&dev->usb.rx_tasklet); tasklet_disable(&dev->usb.rx_tasklet);
tasklet_disable(&dev->usb.tx_tasklet); tasklet_disable(&dev->tx_tasklet);
mt76u_stop_rx(dev); mt76u_stop_rx(dev);
mt76u_stop_tx(dev); mt76u_stop_tx(dev);
...@@ -898,7 +898,7 @@ int mt76u_init(struct mt76_dev *dev, ...@@ -898,7 +898,7 @@ int mt76u_init(struct mt76_dev *dev,
struct mt76_usb *usb = &dev->usb; struct mt76_usb *usb = &dev->usb;
tasklet_init(&usb->rx_tasklet, mt76u_rx_tasklet, (unsigned long)dev); tasklet_init(&usb->rx_tasklet, mt76u_rx_tasklet, (unsigned long)dev);
tasklet_init(&usb->tx_tasklet, mt76u_tx_tasklet, (unsigned long)dev); tasklet_init(&dev->tx_tasklet, mt76u_tx_tasklet, (unsigned long)dev);
INIT_DELAYED_WORK(&usb->stat_work, mt76u_tx_status_data); INIT_DELAYED_WORK(&usb->stat_work, mt76u_tx_status_data);
skb_queue_head_init(&dev->rx_skb[MT_RXQ_MAIN]); skb_queue_head_init(&dev->rx_skb[MT_RXQ_MAIN]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment