Commit a08bb28f authored by Prasurjya Rohan Saikia's avatar Prasurjya Rohan Saikia Committed by Kalle Valo

wifi: wilc1000: add back-off algorithm to balance tx queue packets

Add an algorithm to backoff the Tx Task when low memory scenario is
triggered at firmware. During high data transfer from host, the firmware
runs out of VMM memory, which is used to hold the frames from the host.
So, adding the flow control delays the transmit from host side when
there is not enough space to accommodate frames in firmware side.
Signed-off-by: default avatarPrasurjya Rohan Saikia <prasurjya.rohansaikia@microchip.com>
Acked-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230915175946.4361-1-prasurjya.rohansaikia@microchip.com
parent 260323c3
...@@ -148,8 +148,8 @@ static int wilc_txq_task(void *vp) ...@@ -148,8 +148,8 @@ static int wilc_txq_task(void *vp)
complete(&wl->txq_thread_started); complete(&wl->txq_thread_started);
while (1) { while (1) {
wait_for_completion(&wl->txq_event); if (wait_for_completion_interruptible(&wl->txq_event))
continue;
if (wl->close) { if (wl->close) {
complete(&wl->txq_thread_started); complete(&wl->txq_thread_started);
...@@ -166,12 +166,24 @@ static int wilc_txq_task(void *vp) ...@@ -166,12 +166,24 @@ static int wilc_txq_task(void *vp)
srcu_idx = srcu_read_lock(&wl->srcu); srcu_idx = srcu_read_lock(&wl->srcu);
list_for_each_entry_rcu(ifc, &wl->vif_list, list_for_each_entry_rcu(ifc, &wl->vif_list,
list) { list) {
if (ifc->mac_opened && ifc->ndev) if (ifc->mac_opened &&
netif_queue_stopped(ifc->ndev))
netif_wake_queue(ifc->ndev); netif_wake_queue(ifc->ndev);
} }
srcu_read_unlock(&wl->srcu, srcu_idx); srcu_read_unlock(&wl->srcu, srcu_idx);
} }
} while (ret == WILC_VMM_ENTRY_FULL_RETRY && !wl->close); if (ret != WILC_VMM_ENTRY_FULL_RETRY)
break;
/* Back off TX task from sending packets for some time.
* msleep_interruptible will allow RX task to run and
* free buffers. TX task will be in TASK_INTERRUPTIBLE
* state which will put the thread back to CPU running
* queue when it's signaled even if the timeout isn't
* elapsed. This gives faster chance for reserved SK
* buffers to be free.
*/
msleep_interruptible(TX_BACKOFF_WEIGHT_MS);
} while (!wl->close);
} }
return 0; return 0;
} }
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54 #define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
#define DEFAULT_LINK_SPEED 72 #define DEFAULT_LINK_SPEED 72
#define TX_BACKOFF_WEIGHT_MS 1
struct wilc_wfi_stats { struct wilc_wfi_stats {
unsigned long rx_packets; unsigned long rx_packets;
unsigned long tx_packets; unsigned long tx_packets;
......
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