Skip to content

Commit ae8defc

Browse files
jw14812mcb30
authored andcommitted
[bnxt] Do not abort teardown on command failure
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>
1 parent 822d4b1 commit ae8defc

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

src/drivers/net/bnxt/bnxt.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,28 +2145,35 @@ hwrm_func_t bring_up_nic[] = {
21452145
NULL,
21462146
};
21472147

2148-
int bnxt_hwrm_run ( hwrm_func_t cmds[], struct bnxt *bp )
2148+
int bnxt_hwrm_run ( hwrm_func_t cmds[], struct bnxt *bp, int flag )
21492149
{
21502150
hwrm_func_t *ptr;
21512151
int ret;
2152+
u8 Status = 0;
21522153

21532154
for ( ptr = cmds; *ptr; ++ptr ) {
21542155
memset ( ( void * ) REQ_DMA_ADDR ( bp ), 0, REQ_BUFFER_SIZE );
21552156
memset ( ( void * ) RESP_DMA_ADDR ( bp ), 0, RESP_BUFFER_SIZE );
21562157
ret = ( *ptr ) ( bp );
21572158
if ( ret ) {
21582159
DBGP ( "- %s ( ): Failed\n", __func__ );
2159-
return STATUS_FAILURE;
2160+
Status = STATUS_FAILURE;
2161+
2162+
// Initialization path failure,
2163+
// return failure immediately
2164+
// else cleanup the resources
2165+
if ( flag )
2166+
return STATUS_FAILURE;
21602167
}
21612168
}
2162-
return STATUS_SUCCESS;
2169+
return Status;
21632170
}
21642171

2165-
#define bnxt_down_chip( bp ) bnxt_hwrm_run ( bring_down_chip, bp )
2166-
#define bnxt_up_chip( bp ) bnxt_hwrm_run ( bring_up_chip, bp )
2167-
#define bnxt_down_nic( bp ) bnxt_hwrm_run ( bring_down_nic, bp )
2168-
#define bnxt_up_nic( bp ) bnxt_hwrm_run ( bring_up_nic, bp )
2169-
#define bnxt_up_init( bp ) bnxt_hwrm_run ( bring_up_init, bp )
2172+
#define bnxt_down_chip( bp ) bnxt_hwrm_run ( bring_down_chip, bp, 0 )
2173+
#define bnxt_up_chip( bp ) bnxt_hwrm_run ( bring_up_chip, bp, 1 )
2174+
#define bnxt_down_nic( bp ) bnxt_hwrm_run ( bring_down_nic, bp, 0 )
2175+
#define bnxt_up_nic( bp ) bnxt_hwrm_run ( bring_up_nic, bp, 1 )
2176+
#define bnxt_up_init( bp ) bnxt_hwrm_run ( bring_up_init, bp, 1 )
21702177

21712178
static int bnxt_open ( struct net_device *dev )
21722179
{

0 commit comments

Comments
 (0)