* [PATCH v2] wifi: rtl8xxxu: retry firmware download on error
@ 2025-01-27 19:48 Soeren Moch
2025-01-28 5:45 ` Ping-Ke Shih
2025-02-03 2:46 ` Ping-Ke Shih
0 siblings, 2 replies; 3+ messages in thread
From: Soeren Moch @ 2025-01-27 19:48 UTC (permalink / raw)
To: Kalle Valo
Cc: Soeren Moch, Jes Sorensen, linux-wireless, linux-kernel,
Ping-Ke Shih
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.
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
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
Cc: Ping-Ke Shih <pkshih@realtek.com>
Changes in v2:
- mention related device in formal commit message
- fix loop iterations
- adapt download retry message to common style including
function name
- hide firmware write error and retry messages behind
debug settings, according to feedback by Ping-Ke Shih
---
drivers/net/wireless/realtek/rtl8xxxu/core.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 7891c988dd5f..9008c619d833 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -860,9 +860,10 @@ rtl8xxxu_writeN(struct rtl8xxxu_priv *priv, u16 addr, u8 *buf, u16 len)
return len;
write_error:
- dev_info(&udev->dev,
- "%s: Failed to write block at addr: %04x size: %04x\n",
- __func__, addr, blocksize);
+ if (rtl8xxxu_debug & RTL8XXXU_DEBUG_REG_WRITE)
+ dev_info(&udev->dev,
+ "%s: Failed to write block at addr: %04x size: %04x\n",
+ __func__, addr, blocksize);
return -EAGAIN;
}
@@ -4064,8 +4065,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 >= 0 ; retry--) {
+ ret = rtl8xxxu_download_firmware(priv);
+ dev_dbg(dev, "%s: download_firmware %i\n", __func__, ret);
+ if (ret != -EAGAIN)
+ break;
+ if (retry)
+ dev_dbg(dev, "%s: retry firmware download\n", __func__);
+ }
if (ret)
goto exit;
ret = rtl8xxxu_start_firmware(priv);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] wifi: rtl8xxxu: retry firmware download on error
2025-01-27 19:48 [PATCH v2] wifi: rtl8xxxu: retry firmware download on error Soeren Moch
@ 2025-01-28 5:45 ` Ping-Ke Shih
2025-02-03 2:46 ` Ping-Ke Shih
1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2025-01-28 5:45 UTC (permalink / raw)
To: Soeren Moch, Kalle Valo
Cc: Jes Sorensen, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org
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.
>
> 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
>
> Signed-off-by: Soeren Moch <smoch@web.de>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] wifi: rtl8xxxu: retry firmware download on error
2025-01-27 19:48 [PATCH v2] wifi: rtl8xxxu: retry firmware download on error Soeren Moch
2025-01-28 5:45 ` Ping-Ke Shih
@ 2025-02-03 2:46 ` Ping-Ke Shih
1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2025-02-03 2:46 UTC (permalink / raw)
To: Soeren Moch, Kalle Valo
Cc: Soeren Moch, Jes Sorensen, linux-wireless, linux-kernel,
Ping-Ke Shih
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.
>
> 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
>
> Signed-off-by: Soeren Moch <smoch@web.de>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
1 patch(es) applied to rtw-next branch of rtw.git, thanks.
3d3e28feca7a wifi: rtl8xxxu: retry firmware download on error
---
https://github.com/pkshih/rtw.git
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-03 2:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-27 19:48 [PATCH v2] wifi: rtl8xxxu: retry firmware download on error Soeren Moch
2025-01-28 5:45 ` Ping-Ke Shih
2025-02-03 2:46 ` Ping-Ke Shih
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox