Commit 9daf27e6 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: mt76u: use dedicated thread for status work

Split tx and status path in mt76-usb module relying on mt76 workers APIs
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent be83a7e2
......@@ -430,7 +430,9 @@ struct mt76_usb {
u8 *data;
u16 data_len;
struct mt76_worker status_worker;
struct mt76_worker rx_worker;
struct work_struct stat_work;
u8 out_ep[__MT_EP_OUT_MAX];
......
......@@ -805,9 +805,10 @@ int mt76u_resume_rx(struct mt76_dev *dev)
}
EXPORT_SYMBOL_GPL(mt76u_resume_rx);
static void mt76u_tx_worker(struct mt76_worker *w)
static void mt76u_status_worker(struct mt76_worker *w)
{
struct mt76_dev *dev = container_of(w, struct mt76_dev, tx_worker);
struct mt76_usb *usb = container_of(w, struct mt76_usb, status_worker);
struct mt76_dev *dev = container_of(usb, struct mt76_dev, usb);
struct mt76_queue_entry entry;
struct mt76_queue *q;
bool wake;
......@@ -833,7 +834,7 @@ static void mt76u_tx_worker(struct mt76_worker *w)
if (!q->queued)
wake_up(&dev->tx_wait);
mt76_txq_schedule(&dev->phy, i);
mt76_worker_schedule(&dev->tx_worker);
if (dev->drv->tx_status_data &&
!test_and_set_bit(MT76_READING_STATS, &dev->phy.state))
......@@ -877,7 +878,7 @@ static void mt76u_complete_tx(struct urb *urb)
dev_err(dev->dev, "tx urb failed: %d\n", urb->status);
e->done = true;
mt76_worker_schedule(&dev->tx_worker);
mt76_worker_schedule(&dev->usb.status_worker);
}
static int
......@@ -1016,6 +1017,8 @@ static void mt76u_free_tx(struct mt76_dev *dev)
{
int i;
mt76_worker_teardown(&dev->usb.status_worker);
for (i = 0; i < IEEE80211_NUM_ACS; i++) {
struct mt76_queue *q;
int j;
......@@ -1036,6 +1039,7 @@ void mt76u_stop_tx(struct mt76_dev *dev)
int ret;
mt76_worker_disable(&dev->tx_worker);
mt76_worker_disable(&dev->usb.status_worker);
ret = wait_event_timeout(dev->tx_wait, !mt76_has_tx_pending(&dev->phy),
HZ / 5);
......@@ -1074,6 +1078,7 @@ void mt76u_stop_tx(struct mt76_dev *dev)
clear_bit(MT76_READING_STATS, &dev->phy.state);
mt76_worker_enable(&dev->tx_worker);
mt76_worker_enable(&dev->usb.status_worker);
mt76_tx_status_check(dev, NULL, true);
}
......@@ -1124,7 +1129,6 @@ 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;
INIT_WORK(&usb->stat_work, mt76u_tx_status_data);
usb->data_len = usb_maxpacket(udev, usb_sndctrlpipe(udev, 0), 1);
......@@ -1152,7 +1156,13 @@ int mt76u_init(struct mt76_dev *dev,
if (err)
return err;
err = mt76_worker_setup(dev->hw, &usb->status_worker,
mt76u_status_worker, "usb-status");
if (err)
return err;
sched_set_fifo_low(usb->rx_worker.task);
sched_set_fifo_low(usb->status_worker.task);
return 0;
}
......
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