* Loading fallback firmware in rtl8723be and rtl8821ae fails @ 2017-07-28 11:14 Sven Joachim 2017-07-29 9:21 ` [PATCH] rtlwifi: Fix fallback firmware loading Sven Joachim 0 siblings, 1 reply; 5+ messages in thread From: Sven Joachim @ 2017-07-28 11:14 UTC (permalink / raw) To: Larry Finger, linux-wireless; +Cc: Ping-Ke Shih, Kalle Valo After upgrading my laptop to kernel 4.12 I found that the firmware for my WiFi card was no longer loaded, rendering the WiFi non-functional. In the dmesg are (only) these related lines: [ 6.854609] rtl8723be: Using firmware rtlwifi/rtl8723befw_36.bin [ 6.854990] rtl8723be 0000:02:00.0: Direct firmware load for rtlwifi/rtl8723befw_36.bin failed with error -2 [ 6.854993] rtlwifi: Selected firmware is not available Now, by commit f70e4df2b384d21e36a7c30a591639592692e0ec ("Add code to read new versions of firmware"), supposedly rtlwifi/rtl8723befw.bin should be loaded if rtlwifi/rtl8723befw_36.bin is not available, but that does not actually work. AFAICS the problem is that request_firmware_nowait() does not wait for the firmware to show up and returns 0 even if the file is not there, so the code to load the fallback file will never be reached. Cheers, Sven ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] rtlwifi: Fix fallback firmware loading 2017-07-28 11:14 Loading fallback firmware in rtl8723be and rtl8821ae fails Sven Joachim @ 2017-07-29 9:21 ` Sven Joachim 2017-07-30 23:57 ` Larry Finger 0 siblings, 1 reply; 5+ messages in thread From: Sven Joachim @ 2017-07-29 9:21 UTC (permalink / raw) To: Larry Finger; +Cc: linux-wireless, Ping-Ke Shih, Kalle Valo Commit f70e4df2 ("rtlwifi: Add code to read new versions of firmware") added code to load an old firmware file if the new one is not available. Unfortunately that code is never reached because request_firmware_nowait() does not wait for the firmware to show up and returns 0 even if the file is not there. Use the existing fallback mechanism introduced by commit 62009b7f ("rtlwifi: rtl8192cu: Add new firmware") instead. Fixes: f70e4df2b384d21e36a7c30a591639592692e0ec Cc: stable@vger.kernel.org Signed-off-by: Sven Joachim <svenjoac@gmx.de> --- drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 13 +++---------- drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c | 13 +++---------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c index f9d10f1e7cf8..1c2d5f6dd3ff 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c @@ -187,16 +187,8 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw) rtlpriv->io.dev, GFP_KERNEL, hw, rtl_fw_cb); if (err) { - /* Failed to get firmware. Check if old version available */ - fw_name = "rtlwifi/rtl8723befw.bin"; - pr_info("Using firmware %s\n", fw_name); - err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { - pr_err("Failed to request firmware!\n"); - return 1; - } + pr_err("Failed to request firmware!\n"); + return 1; } return 0; } @@ -287,6 +279,7 @@ static const struct rtl_hal_cfg rtl8723be_hal_cfg = { .bar_id = 2, .write_readback = true, .name = "rtl8723be_pci", + .alt_fw_name = "rtlwifi/rtl8723befw.bin", .ops = &rtl8723be_hal_ops, .mod_params = &rtl8723be_mod_params, .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c index d71d2776ca03..0801576bfa89 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c @@ -214,16 +214,8 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) rtlpriv->io.dev, GFP_KERNEL, hw, rtl_fw_cb); if (err) { - /* Failed to get firmware. Check if old version available */ - fw_name = "rtlwifi/rtl8821aefw.bin"; - pr_info("Using firmware %s\n", fw_name); - err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { - pr_err("Failed to request normal firmware!\n"); - return 1; - } + pr_err("Failed to request normal firmware!\n"); + return 1; } /*load wowlan firmware*/ pr_info("Using firmware %s\n", wowlan_fw_name); @@ -325,6 +317,7 @@ static const struct rtl_hal_cfg rtl8821ae_hal_cfg = { .bar_id = 2, .write_readback = true, .name = "rtl8821ae_pci", + .alt_fw_name = "rtlwifi/rtl8821aefw.bin", .ops = &rtl8821ae_hal_ops, .mod_params = &rtl8821ae_mod_params, .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, -- 2.13.3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] rtlwifi: Fix fallback firmware loading 2017-07-29 9:21 ` [PATCH] rtlwifi: Fix fallback firmware loading Sven Joachim @ 2017-07-30 23:57 ` Larry Finger 2017-07-31 16:10 ` [PATCH v2] " Sven Joachim 0 siblings, 1 reply; 5+ messages in thread From: Larry Finger @ 2017-07-30 23:57 UTC (permalink / raw) To: Sven Joachim; +Cc: linux-wireless, Ping-Ke Shih, Kalle Valo On 07/29/2017 04:21 AM, Sven Joachim wrote: > Commit f70e4df2 ("rtlwifi: Add code to read new versions of firmware") > added code to load an old firmware file if the new one is not > available. Unfortunately that code is never reached because > request_firmware_nowait() does not wait for the firmware to show up > and returns 0 even if the file is not there. > > Use the existing fallback mechanism introduced by commit > 62009b7f ("rtlwifi: rtl8192cu: Add new firmware") instead. > > Fixes: f70e4df2b384d21e36a7c30a591639592692e0ec > Cc: stable@vger.kernel.org > Signed-off-by: Sven Joachim <svenjoac@gmx.de> Your solution seems to be correct; however, your patch fails to apply. Make certain that you have the latest pull on the wireless-drivers-next repo. In particular, it needs commit f2764f61fa105 by Souptik Jarder, which changed the error return. NACK. Larry ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] rtlwifi: Fix fallback firmware loading 2017-07-30 23:57 ` Larry Finger @ 2017-07-31 16:10 ` Sven Joachim 2017-08-03 9:36 ` [v2] " Kalle Valo 0 siblings, 1 reply; 5+ messages in thread From: Sven Joachim @ 2017-07-31 16:10 UTC (permalink / raw) To: Larry Finger; +Cc: linux-wireless, Ping-Ke Shih, Kalle Valo Commit f70e4df2b384 ("rtlwifi: Add code to read new versions of firmware") added code to load an old firmware file if the new one is not available. Unfortunately that code is never reached because request_firmware_nowait() does not wait for the firmware to show up and returns 0 even if the file is not there. Use the existing fallback mechanism introduced by commit 62009b7f1279 ("rtlwifi: rtl8192cu: Add new firmware") instead. Fixes: f70e4df2b384 ("rtlwifi: Add code to read new versions of firmware") Cc: stable@vger.kernel.org Signed-off-by: Sven Joachim <svenjoac@gmx.de> --- drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 17 +++++------------ drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c index 56c05c4e1499..f47d839f388d 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c @@ -187,18 +187,10 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw) rtlpriv->io.dev, GFP_KERNEL, hw, rtl_fw_cb); if (err) { - /* Failed to get firmware. Check if old version available */ - fw_name = "rtlwifi/rtl8723befw.bin"; - pr_info("Using firmware %s\n", fw_name); - err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { - pr_err("Failed to request firmware!\n"); - vfree(rtlpriv->rtlhal.pfirmware); - rtlpriv->rtlhal.pfirmware = NULL; - return 1; - } + pr_err("Failed to request firmware!\n"); + vfree(rtlpriv->rtlhal.pfirmware); + rtlpriv->rtlhal.pfirmware = NULL; + return 1; } return 0; } @@ -289,6 +281,7 @@ static const struct rtl_hal_cfg rtl8723be_hal_cfg = { .bar_id = 2, .write_readback = true, .name = "rtl8723be_pci", + .alt_fw_name = "rtlwifi/rtl8723befw.bin", .ops = &rtl8723be_hal_ops, .mod_params = &rtl8723be_mod_params, .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c index ec2d577ba85b..5925edf7877f 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c @@ -216,18 +216,10 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) rtlpriv->io.dev, GFP_KERNEL, hw, rtl_fw_cb); if (err) { - /* Failed to get firmware. Check if old version available */ - fw_name = "rtlwifi/rtl8821aefw.bin"; - pr_info("Using firmware %s\n", fw_name); - err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { - pr_err("Failed to request normal firmware!\n"); - vfree(rtlpriv->rtlhal.wowlan_firmware); - vfree(rtlpriv->rtlhal.pfirmware); - return 1; - } + pr_err("Failed to request normal firmware!\n"); + vfree(rtlpriv->rtlhal.wowlan_firmware); + vfree(rtlpriv->rtlhal.pfirmware); + return 1; } /*load wowlan firmware*/ pr_info("Using firmware %s\n", wowlan_fw_name); @@ -331,6 +323,7 @@ static const struct rtl_hal_cfg rtl8821ae_hal_cfg = { .bar_id = 2, .write_readback = true, .name = "rtl8821ae_pci", + .alt_fw_name = "rtlwifi/rtl8821aefw.bin", .ops = &rtl8821ae_hal_ops, .mod_params = &rtl8821ae_mod_params, .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, -- 2.13.3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [v2] rtlwifi: Fix fallback firmware loading 2017-07-31 16:10 ` [PATCH v2] " Sven Joachim @ 2017-08-03 9:36 ` Kalle Valo 0 siblings, 0 replies; 5+ messages in thread From: Kalle Valo @ 2017-08-03 9:36 UTC (permalink / raw) To: Sven Joachim; +Cc: Larry Finger, linux-wireless, Ping-Ke Shih Sven Joachim <svenjoac@gmx.de> wrote: > Commit f70e4df2b384 ("rtlwifi: Add code to read new versions of > firmware") added code to load an old firmware file if the new one is > not available. Unfortunately that code is never reached because > request_firmware_nowait() does not wait for the firmware to show up > and returns 0 even if the file is not there. > > Use the existing fallback mechanism introduced by commit 62009b7f1279 > ("rtlwifi: rtl8192cu: Add new firmware") instead. > > Fixes: f70e4df2b384 ("rtlwifi: Add code to read new versions of firmware") > Cc: stable@vger.kernel.org > Signed-off-by: Sven Joachim <svenjoac@gmx.de> Patch applied to wireless-drivers-next.git, thanks. 1d9b168d8ea9 rtlwifi: Fix fallback firmware loading -- https://patchwork.kernel.org/patch/9872413/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-03 9:36 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-07-28 11:14 Loading fallback firmware in rtl8723be and rtl8821ae fails Sven Joachim 2017-07-29 9:21 ` [PATCH] rtlwifi: Fix fallback firmware loading Sven Joachim 2017-07-30 23:57 ` Larry Finger 2017-07-31 16:10 ` [PATCH v2] " Sven Joachim 2017-08-03 9:36 ` [v2] " Kalle Valo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).