All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Soeren Moch <smoch@web.de>, Kalle Valo <kvalo@kernel.org>
Cc: Jes Sorensen <Jes.Sorensen@gmail.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] wifi: rtl8xxxu: retry firmware download on error
Date: Thu, 23 Jan 2025 00:21:08 +0000	[thread overview]
Message-ID: <e08051130a124fcfab8d42e6893c581a@realtek.com> (raw)
In-Reply-To: <20250122153156.373470-1-smoch@web.de>

Soeren Moch <smoch@web.de> wrote:
> Occasionally there is an EPROTO error during firmware download.
> This error is converted to EAGAIN in the download function.
> But nobody tries again and so device probe fails.
> 
> Implement download retry to fix this.
> 
> Signed-off-by: Soeren Moch <smoch@web.de>
> ---
> Cc: Jes Sorensen <Jes.Sorensen@gmail.com>
> Cc: Kalle Valo <kvalo@kernel.org>
> Cc: linux-wireless@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> 
> This error was observed (and fix tested) on a tbs2910 board [1]
> with an embedded RTL8188EU (0bda:8179) device behind a USB hub.
> 
> [1] arch/arm/boot/dts/nxp/imx/imx6q-tbs2910.dts

These can be in formal commit message. 

> ---
>  drivers/net/wireless/realtek/rtl8xxxu/core.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c
> b/drivers/net/wireless/realtek/rtl8xxxu/core.c
> index 7891c988dd5f..cd7d904eae62 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
> @@ -4064,8 +4064,14 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
>          */
>         rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, fops->trxff_boundary);
> 
> -       ret = rtl8xxxu_download_firmware(priv);
> -       dev_dbg(dev, "%s: download_firmware %i\n", __func__, ret);
> +       for (int retry = 5; retry ; retry--) {
> +               ret = rtl8xxxu_download_firmware(priv);
> +               dev_dbg(dev, "%s: download_firmware %i\n", __func__, ret);
> +               if (ret != -EAGAIN)
> +                       break;
> +               if (retry)
> +                       dev_info(dev, "retry firmware download\n");

It looks like 'if (retry)' is always true and unnecessary. Also, this message
isn't so important to user, so dev_dbg() is more suitable, but already printing
"%s: download_firmware %i\n" for every retry is enough? Or move it out of loop?

> +       }
>         if (ret)
>                 goto exit;
>         ret = rtl8xxxu_start_firmware(priv);
> --
> 2.43.0
> 


  reply	other threads:[~2025-01-23  0:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-22 15:31 [PATCH] wifi: rtl8xxxu: retry firmware download on error Soeren Moch
2025-01-23  0:21 ` Ping-Ke Shih [this message]
2025-01-23  1:22   ` Soeren Moch
2025-01-23  2:52     ` Ping-Ke Shih

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=e08051130a124fcfab8d42e6893c581a@realtek.com \
    --to=pkshih@realtek.com \
    --cc=Jes.Sorensen@gmail.com \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=smoch@web.de \
    /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.