tzh
2024-08-15 d4a1bd480003f3e1a0590bc46fbcb24f05652ca7
longan/kernel/linux-4.9/drivers/net/wireless/aic8800/aic8800_fdrv/aicwf_usb.c
old mode 100644new mode 100755
....@@ -14,12 +14,15 @@
1414 #include "rwnx_defs.h"
1515 #include "usb_host.h"
1616 #include "rwnx_platform.h"
17
+#include "rwnx_wakelock.h"
1718
1819 void aicwf_usb_tx_flowctrl(struct rwnx_hw *rwnx_hw, bool state)
1920 {
2021 struct rwnx_vif *rwnx_vif;
2122 list_for_each_entry(rwnx_vif, &rwnx_hw->vifs, list) {
2223 if (!rwnx_vif->up)
24
+ continue;
25
+ if (!rwnx_vif->ndev)
2326 continue;
2427 if (state)
2528 netif_stop_queue(rwnx_vif->ndev);
....@@ -151,6 +154,7 @@
151154 spin_unlock_irqrestore(&rx_priv->rxqlock, flags);
152155 usb_err("rx_priv->rxq is over flow!!!\n");
153156 aicwf_dev_skb_free(skb);
157
+ aicwf_usb_rx_buf_put(usb_dev, usb_buf);
154158 return;
155159 }
156160 spin_unlock_irqrestore(&rx_priv->rxqlock, flags);
....@@ -294,9 +298,11 @@
294298 }
295299 if (!wait_for_completion_interruptible(&bus->bustx_trgg)) {
296300 if (usbdev->bus_if->state == BUS_DOWN_ST)
297
- break;
301
+ continue;
302
+ rwnx_wakeup_lock(usbdev->rwnx_hw->ws_tx);
298303 if (usbdev->tx_post_count > 0)
299304 aicwf_usb_tx_process(usbdev);
305
+ rwnx_wakeup_unlock(usbdev->rwnx_hw->ws_tx);
300306 }
301307 }
302308
....@@ -307,6 +313,7 @@
307313 {
308314 struct aicwf_rx_priv *rx_priv = (struct aicwf_rx_priv *)data;
309315 struct aicwf_bus *bus_if = rx_priv->usbdev->bus_if;
316
+ struct aic_usb_dev *usbdev = rx_priv->usbdev;
310317
311318 while (1) {
312319 if (kthread_should_stop()) {
....@@ -315,8 +322,10 @@
315322 }
316323 if (!wait_for_completion_interruptible(&bus_if->busrx_trgg)) {
317324 if (bus_if->state == BUS_DOWN_ST)
318
- break;
325
+ continue;
326
+ rwnx_wakeup_lock(usbdev->rwnx_hw->ws_rx);
319327 aicwf_process_rxframes(rx_priv);
328
+ rwnx_wakeup_unlock(usbdev->rwnx_hw->ws_rx);
320329 }
321330 }
322331
....@@ -554,7 +563,7 @@
554563 complete(&bus_if->bustx_trgg);
555564 ret = 0;
556565
557
- flow_ctrl:
566
+flow_ctrl:
558567 spin_lock_irqsave(&usb_dev->tx_flow_lock, flags);
559568 if (usb_dev->tx_free_count < AICWF_USB_TX_LOW_WATER) {
560569 usb_dev->tbusy = true;
....@@ -778,8 +787,6 @@
778787 exit:
779788 return ret;
780789 }
781
-
782
-
783790
784791 static struct aicwf_bus_ops aicwf_usb_bus_ops = {
785792 .start = aicwf_usb_bus_start,