[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230724155013.442d566c@kernel.org>
Date: Mon, 24 Jul 2023 15:50:13 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Thinh Tran <thinhtr@...ux.vnet.ibm.com>
Cc: aelior@...vell.com, davem@...emloft.net, edumazet@...gle.com,
manishc@...vell.com, netdev@...r.kernel.org, pabeni@...hat.com,
skalluru@...vell.com, drc@...ux.vnet.ibm.com, abdhalee@...ibm.com
Subject: Re: [Patch v3] bnx2x: Fix error recovering in switch configuration
On Wed, 19 Jul 2023 22:02:01 +0000 Thinh Tran wrote:
> - /* Disable HW interrupts, NAPI */
> - bnx2x_netif_stop(bp, 1);
> - /* Delete all NAPI objects */
> - bnx2x_del_all_napi(bp);
> - if (CNIC_LOADED(bp))
> - bnx2x_del_all_napi_cnic(bp);
> - /* Release IRQs */
> - bnx2x_free_irq(bp);
> + if (!bp->nic_stopped) {
> + /* Disable HW interrupts, NAPI */
> + bnx2x_netif_stop(bp, 1);
> + /* Delete all NAPI objects */
> + bnx2x_del_all_napi(bp);
> + if (CNIC_LOADED(bp))
> + bnx2x_del_all_napi_cnic(bp);
> + /* Release IRQs */
> + bnx2x_free_irq(bp);
> + bp->nic_stopped = true;
> + }
You're sprinkling this if around the same piece of code in multiple
places. Please factor it out into a function, and add return early
from it if needed. If possible please keep the code symmetric (i.e.
also factor out the inverse of this code for starting the NIC).
--
pw-bot: cr
Powered by blists - more mailing lists