diff mbox series

prestera: fix fallback to previous version on same major version

Message ID 20230802092357.163944-1-jonas.gorski@bisdn.de (mailing list archive)
State Accepted
Commit b755c25fbcd568821a3bb0e0d5c2daa5fcb00bba
Delegated to: Netdev Maintainers
Headers show
Series prestera: fix fallback to previous version on same major version | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1328 this patch: 1328
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 1351 this patch: 1351
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1351 this patch: 1351
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jonas Gorski Aug. 2, 2023, 9:23 a.m. UTC
When both supported and previous version have the same major version,
and the firmwares are missing, the driver ends in a loop requesting the
same (previous) version over and over again:

    [   76.327413] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.1.img firmware, fall-back to previous 4.0 version
    [   76.339802] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
    [   76.352162] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
    [   76.364502] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
    [   76.376848] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
    [   76.389183] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
    [   76.401522] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
    [   76.413860] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
    [   76.426199] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
    ...

Fix this by inverting the check to that we aren't yet at the previous
version, and also check the minor version.

This also catches the case where both versions are the same, as it was
after commit bb5dbf2cc64d ("net: marvell: prestera: add firmware v4.0
support").

With this fix applied:

    [   88.499622] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.1.img firmware, fall-back to previous 4.0 version
    [   88.511995] Prestera DX 0000:01:00.0: failed to request previous firmware: mrvl/prestera/mvsw_prestera_fw-v4.0.img
    [   88.522403] Prestera DX: probe of 0000:01:00.0 failed with error -2

Fixes: 47f26018a414 ("net: marvell: prestera: try to load previous fw version")
Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
---
 drivers/net/ethernet/marvell/prestera/prestera_pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Elad Nachman Aug. 2, 2023, 10:56 a.m. UTC | #1
> -----Original Message-----
> From: Jonas Gorski <jonas.gorski@bisdn.de>
> Sent: Wednesday, August 2, 2023 12:24 PM
> To: Taras Chornyi <taras.chornyi@plvision.eu>; David S. Miller
> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub
> Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Andrew
> Lunn <andrew@lunn.ch>; Vadym Kochan [C] <vkochan@marvell.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [EXT] [PATCH] prestera: fix fallback to previous version on same
> major version
> 
> External Email
> 
> ----------------------------------------------------------------------
> When both supported and previous version have the same major version,
> and the firmwares are missing, the driver ends in a loop requesting the same
> (previous) version over and over again:
> 
>     [   76.327413] Prestera DX 0000:01:00.0: missing latest
> mrvl/prestera/mvsw_prestera_fw-v4.1.img firmware, fall-back to previous
> 4.0 version
>     [   76.339802] Prestera DX 0000:01:00.0: missing latest
> mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous
> 4.0 version
>     [   76.352162] Prestera DX 0000:01:00.0: missing latest
> mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous
> 4.0 version
>     [   76.364502] Prestera DX 0000:01:00.0: missing latest
> mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous
> 4.0 version
>     [   76.376848] Prestera DX 0000:01:00.0: missing latest
> mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous
> 4.0 version
>     [   76.389183] Prestera DX 0000:01:00.0: missing latest
> mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous
> 4.0 version
>     [   76.401522] Prestera DX 0000:01:00.0: missing latest
> mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous
> 4.0 version
>     [   76.413860] Prestera DX 0000:01:00.0: missing latest
> mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous
> 4.0 version
>     [   76.426199] Prestera DX 0000:01:00.0: missing latest
> mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous
> 4.0 version
>     ...
> 
> Fix this by inverting the check to that we aren't yet at the previous version,
> and also check the minor version.
> 
> This also catches the case where both versions are the same, as it was after
> commit bb5dbf2cc64d ("net: marvell: prestera: add firmware v4.0 support").
> 
> With this fix applied:
> 
>     [   88.499622] Prestera DX 0000:01:00.0: missing latest
> mrvl/prestera/mvsw_prestera_fw-v4.1.img firmware, fall-back to previous
> 4.0 version
>     [   88.511995] Prestera DX 0000:01:00.0: failed to request previous
> firmware: mrvl/prestera/mvsw_prestera_fw-v4.0.img
>     [   88.522403] Prestera DX: probe of 0000:01:00.0 failed with error -2
> 
> Fixes: 47f26018a414 ("net: marvell: prestera: try to load previous fw
> version")
> Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
> ---
>  drivers/net/ethernet/marvell/prestera/prestera_pci.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/marvell/prestera/prestera_pci.c
> b/drivers/net/ethernet/marvell/prestera/prestera_pci.c
> index f328d957b2db..35857dc19542 100644
> --- a/drivers/net/ethernet/marvell/prestera/prestera_pci.c
> +++ b/drivers/net/ethernet/marvell/prestera/prestera_pci.c
> @@ -727,7 +727,8 @@ static int prestera_fw_get(struct prestera_fw *fw)
> 
>  	err = request_firmware_direct(&fw->bin, fw_path, fw->dev.dev);
>  	if (err) {
> -		if (ver_maj == PRESTERA_SUPP_FW_MAJ_VER) {
> +		if (ver_maj != PRESTERA_PREV_FW_MAJ_VER ||
> +		    ver_min != PRESTERA_PREV_FW_MIN_VER) {
>  			ver_maj = PRESTERA_PREV_FW_MAJ_VER;
>  			ver_min = PRESTERA_PREV_FW_MIN_VER;
> 
> --
> 2.41.0
> 
> 
> --
> BISDN GmbH
> Körnerstraße 7-10
> 10785 Berlin
> Germany
> 
> 
> Phone:
> +49-30-6108-1-6100
> 
> 
> Managing Directors:
> Dr.-Ing. Hagen Woesner, Andreas
> Köpsel
> 
> 
> Commercial register:
> Amtsgericht Berlin-Charlottenburg HRB 141569
> B
> VAT ID No: DE283257294
> 

Acked-by: Elad Nachman <enachman@marvell.com>
Jesse Brandeburg Aug. 3, 2023, 1:30 a.m. UTC | #2
On 8/2/2023 2:23 AM, Jonas Gorski wrote:
> When both supported and previous version have the same major version,
> and the firmwares are missing, the driver ends in a loop requesting the
> same (previous) version over and over again:
> 
>     [   76.327413] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.1.img firmware, fall-back to previous 4.0 version
>     [   76.339802] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.352162] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.364502] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.376848] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.389183] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.401522] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.413860] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.426199] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     ...
> 
> Fix this by inverting the check to that we aren't yet at the previous
> version, and also check the minor version.
> 
> This also catches the case where both versions are the same, as it was
> after commit bb5dbf2cc64d ("net: marvell: prestera: add firmware v4.0
> support").
> 
> With this fix applied:
> 
>     [   88.499622] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.1.img firmware, fall-back to previous 4.0 version
>     [   88.511995] Prestera DX 0000:01:00.0: failed to request previous firmware: mrvl/prestera/mvsw_prestera_fw-v4.0.img
>     [   88.522403] Prestera DX: probe of 0000:01:00.0 failed with error -2
> 
> Fixes: 47f26018a414 ("net: marvell: prestera: try to load previous fw version")
> Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>

Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Taras Chornyi Aug. 3, 2023, 9:28 a.m. UTC | #3
> Fix this by inverting the check to that we aren't yet at the previous
> version, and also check the minor version.
>
> This also catches the case where both versions are the same, as it was
> after commit bb5dbf2cc64d ("net: marvell: prestera: add firmware v4.0
> support").
>
> With this fix applied:
>
>      [   88.499622] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.1.img firmware, fall-back to previous 4.0 version
>      [   88.511995] Prestera DX 0000:01:00.0: failed to request previous firmware: mrvl/prestera/mvsw_prestera_fw-v4.0.img
>      [   88.522403] Prestera DX: probe of 0000:01:00.0 failed with error -2
>
> Fixes: 47f26018a414 ("net: marvell: prestera: try to load previous fw version")
> Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
> ---
>   drivers/net/ethernet/marvell/prestera/prestera_pci.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/prestera/prestera_pci.c b/drivers/net/ethernet/marvell/prestera/prestera_pci.c
> index f328d957b2db..35857dc19542 100644
> --- a/drivers/net/ethernet/marvell/prestera/prestera_pci.c
> +++ b/drivers/net/ethernet/marvell/prestera/prestera_pci.c
> @@ -727,7 +727,8 @@ static int prestera_fw_get(struct prestera_fw *fw)
>   
>   	err = request_firmware_direct(&fw->bin, fw_path, fw->dev.dev);
>   	if (err) {
> -		if (ver_maj == PRESTERA_SUPP_FW_MAJ_VER) {
> +		if (ver_maj != PRESTERA_PREV_FW_MAJ_VER ||
> +		    ver_min != PRESTERA_PREV_FW_MIN_VER) {
>   			ver_maj = PRESTERA_PREV_FW_MAJ_VER;
>   			ver_min = PRESTERA_PREV_FW_MIN_VER;
>   

Acked-by: Taras Chornyi <taras.chornyi@plvision.eu>
patchwork-bot+netdevbpf@kernel.org Aug. 3, 2023, 6:10 p.m. UTC | #4
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  2 Aug 2023 11:23:56 +0200 you wrote:
> When both supported and previous version have the same major version,
> and the firmwares are missing, the driver ends in a loop requesting the
> same (previous) version over and over again:
> 
>     [   76.327413] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.1.img firmware, fall-back to previous 4.0 version
>     [   76.339802] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.352162] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.364502] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.376848] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.389183] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.401522] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.413860] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     [   76.426199] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
>     ...
> 
> [...]

Here is the summary with links:
  - prestera: fix fallback to previous version on same major version
    https://git.kernel.org/netdev/net/c/b755c25fbcd5

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/prestera/prestera_pci.c b/drivers/net/ethernet/marvell/prestera/prestera_pci.c
index f328d957b2db..35857dc19542 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_pci.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_pci.c
@@ -727,7 +727,8 @@  static int prestera_fw_get(struct prestera_fw *fw)
 
 	err = request_firmware_direct(&fw->bin, fw_path, fw->dev.dev);
 	if (err) {
-		if (ver_maj == PRESTERA_SUPP_FW_MAJ_VER) {
+		if (ver_maj != PRESTERA_PREV_FW_MAJ_VER ||
+		    ver_min != PRESTERA_PREV_FW_MIN_VER) {
 			ver_maj = PRESTERA_PREV_FW_MAJ_VER;
 			ver_min = PRESTERA_PREV_FW_MIN_VER;