From: <Ajay.Kathat@microchip.com>
To: <Prasurjya.Rohansaikia@microchip.com>, <linux-wireless@vger.kernel.org>
Cc: <claudiu.beznea@microchip.com>
Subject: Re: [PATCH v4] wifi: wilc1000: add back-off algorithm to balance tx queue packets
Date: Fri, 15 Sep 2023 19:20:45 +0000 [thread overview]
Message-ID: <2f9fd8fe-af4f-2957-ae5f-3e1729317d8e@microchip.com> (raw)
In-Reply-To: <20230915175946.4361-1-prasurjya.rohansaikia@microchip.com>
On 9/15/23 11:00, Prasurjya Rohan saikia - I73664 wrote:
> From: Prasurjya Rohan Saikia <prasurjya.rohansaikia@microchip.com>
>
> 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: Prasurjya Rohan Saikia <prasurjya.rohansaikia@microchip.com>
Acked-by: Ajay Singh <ajay.kathat@microchip.com>
> ---
> v3 -> v4: As per review comments, replaced
> schedule_timeout_interruptible() by msleep_interruptible().
>
> v2 -> v3: Replaced schedule_timeout() by
> schedule_timeout_interruptible().
>
> v1 -> v2: Removed the unused `timeout` variable.
> ---
> .../net/wireless/microchip/wilc1000/netdev.c | 20 +++++++++++++++----
> .../net/wireless/microchip/wilc1000/netdev.h | 2 ++
> 2 files changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c
> index e9f59de31b0b..91d71e0f7ef2 100644
> --- a/drivers/net/wireless/microchip/wilc1000/netdev.c
> +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
> @@ -148,8 +148,8 @@ static int wilc_txq_task(void *vp)
>
> complete(&wl->txq_thread_started);
> while (1) {
> - wait_for_completion(&wl->txq_event);
> -
> + if (wait_for_completion_interruptible(&wl->txq_event))
> + continue;
> if (wl->close) {
> complete(&wl->txq_thread_started);
>
> @@ -166,12 +166,24 @@ static int wilc_txq_task(void *vp)
> srcu_idx = srcu_read_lock(&wl->srcu);
> list_for_each_entry_rcu(ifc, &wl->vif_list,
> list) {
> - if (ifc->mac_opened && ifc->ndev)
> + if (ifc->mac_opened &&
> + netif_queue_stopped(ifc->ndev))
> netif_wake_queue(ifc->ndev);
> }
> 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;
> }
> diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h
> index bb1a315a7b7e..aafe3dc44ac6 100644
> --- a/drivers/net/wireless/microchip/wilc1000/netdev.h
> +++ b/drivers/net/wireless/microchip/wilc1000/netdev.h
> @@ -27,6 +27,8 @@
> #define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
> #define DEFAULT_LINK_SPEED 72
>
> +#define TX_BACKOFF_WEIGHT_MS 1
> +
> struct wilc_wfi_stats {
> unsigned long rx_packets;
> unsigned long tx_packets;
next prev parent reply other threads:[~2023-09-15 19:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 18:00 [PATCH v4] wifi: wilc1000: add back-off algorithm to balance tx queue packets Prasurjya.Rohansaikia
2023-09-15 19:20 ` Ajay.Kathat [this message]
2023-09-21 6:30 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2f9fd8fe-af4f-2957-ae5f-3e1729317d8e@microchip.com \
--to=ajay.kathat@microchip.com \
--cc=Prasurjya.Rohansaikia@microchip.com \
--cc=claudiu.beznea@microchip.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.