]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[bnxt] Do not abort teardown on command failure 1700/head
authorJoseph Wong <joseph.wong@broadcom.com>
Thu, 30 Apr 2026 21:03:29 +0000 (14:03 -0700)
committerMichael Brown <mcb30@ipxe.org>
Fri, 1 May 2026 16:09:32 +0000 (17:09 +0100)
Modify bnxt_hwrm_run() to accept a flag indicating whether to abort
immediately upon a command failure.  During initialization path,
driver will continue to abort on first error.  During teardown,
sequence will continue executing subsequent cleanup commands even if
one fails.  This ensures a best-effort cleanup.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
src/drivers/net/bnxt/bnxt.c

index 43b86c96c309ff6df883c585c3ec352645a8e226..3cdf4705f58816cd010a7e0f70cd48b9922768eb 100644 (file)
@@ -2145,10 +2145,11 @@ hwrm_func_t bring_up_nic[] = {
        NULL,
 };
 
-int bnxt_hwrm_run ( hwrm_func_t cmds[], struct bnxt *bp )
+int bnxt_hwrm_run ( hwrm_func_t cmds[], struct bnxt *bp, int flag )
 {
        hwrm_func_t *ptr;
        int ret;
+       u8 Status = 0;
 
        for ( ptr = cmds; *ptr; ++ptr ) {
                memset ( ( void * ) REQ_DMA_ADDR ( bp ),  0, REQ_BUFFER_SIZE );
@@ -2156,17 +2157,23 @@ int bnxt_hwrm_run ( hwrm_func_t cmds[], struct bnxt *bp )
                ret = ( *ptr ) ( bp );
                if ( ret ) {
                        DBGP ( "- %s (  ): Failed\n", __func__ );
-                       return STATUS_FAILURE;
+                       Status = STATUS_FAILURE;
+
+                       // Initialization path failure,
+                       // return failure immediately
+                       // else cleanup the resources
+                       if ( flag )
+                               return STATUS_FAILURE;
                }
        }
-       return STATUS_SUCCESS;
+       return Status;
 }
 
-#define bnxt_down_chip( bp )   bnxt_hwrm_run ( bring_down_chip, bp )
-#define bnxt_up_chip( bp )     bnxt_hwrm_run ( bring_up_chip, bp )
-#define bnxt_down_nic( bp )    bnxt_hwrm_run ( bring_down_nic, bp )
-#define bnxt_up_nic( bp )      bnxt_hwrm_run ( bring_up_nic, bp )
-#define bnxt_up_init( bp )     bnxt_hwrm_run ( bring_up_init, bp )
+#define bnxt_down_chip( bp )   bnxt_hwrm_run ( bring_down_chip, bp, 0 )
+#define bnxt_up_chip( bp )     bnxt_hwrm_run ( bring_up_chip, bp, 1 )
+#define bnxt_down_nic( bp )    bnxt_hwrm_run ( bring_down_nic, bp, 0 )
+#define bnxt_up_nic( bp )      bnxt_hwrm_run ( bring_up_nic, bp, 1 )
+#define bnxt_up_init( bp )     bnxt_hwrm_run ( bring_up_init, bp, 1 )
 
 static int bnxt_open ( struct net_device *dev )
 {