netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Michael Chan <michael.chan@broadcom.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	gospo@broadcom.com
Subject: Re: [PATCH net-next 4/5] bnxt_en: Refactor __bnxt_vf_reps_destroy().
Date: Mon, 12 Apr 2021 10:37:10 +0300	[thread overview]
Message-ID: <YHP4piIPfdXca+uB@unreal> (raw)
In-Reply-To: <1618186695-18823-5-git-send-email-michael.chan@broadcom.com>

On Sun, Apr 11, 2021 at 08:18:14PM -0400, Michael Chan wrote:
> Add a new helper function __bnxt_free_one_vf_rep() to free one VF rep.
> We also reintialize the VF rep fields to proper initial values so that
> the function can be used without freeing the VF rep data structure.  This
> will be used in subsequent patches to free and recreate VF reps after
> error recovery.
> 
> Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
> Reviewed-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
> Signed-off-by: Michael Chan <michael.chan@broadcom.com>
> ---
>  drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 21 ++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
> index b5d6cd63bea7..a4ac11f5b0e5 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
> @@ -288,6 +288,21 @@ void bnxt_vf_reps_open(struct bnxt *bp)
>  		bnxt_vf_rep_open(bp->vf_reps[i]->dev);
>  }
>  
> +static void __bnxt_free_one_vf_rep(struct bnxt *bp, struct bnxt_vf_rep *vf_rep)
> +{
> +	if (!vf_rep)
> +		return;

How can it be NULL if you check that vf_rep != NULL when called to
__bnxt_free_one_vf_rep() ?

Thanks

> +
> +	if (vf_rep->dst) {
> +		dst_release((struct dst_entry *)vf_rep->dst);
> +		vf_rep->dst = NULL;
> +	}
> +	if (vf_rep->tx_cfa_action != CFA_HANDLE_INVALID) {
> +		hwrm_cfa_vfr_free(bp, vf_rep->vf_idx);
> +		vf_rep->tx_cfa_action = CFA_HANDLE_INVALID;
> +	}
> +}
> +
>  static void __bnxt_vf_reps_destroy(struct bnxt *bp)
>  {
>  	u16 num_vfs = pci_num_vf(bp->pdev);
> @@ -297,11 +312,7 @@ static void __bnxt_vf_reps_destroy(struct bnxt *bp)
>  	for (i = 0; i < num_vfs; i++) {
>  		vf_rep = bp->vf_reps[i];
>  		if (vf_rep) {
> -			dst_release((struct dst_entry *)vf_rep->dst);
> -
> -			if (vf_rep->tx_cfa_action != CFA_HANDLE_INVALID)
> -				hwrm_cfa_vfr_free(bp, vf_rep->vf_idx);
> -
> +			__bnxt_free_one_vf_rep(bp, vf_rep);
>  			if (vf_rep->dev) {
>  				/* if register_netdev failed, then netdev_ops
>  				 * would have been set to NULL
> -- 
> 2.18.1
> 

  reply	other threads:[~2021-04-12  7:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12  0:18 [PATCH net-next 0/5] bnxt_en: Error recovery fixes Michael Chan
2021-04-12  0:18 ` [PATCH net-next 1/5] bnxt_en: Treat health register value 0 as valid in bnxt_try_reover_fw() Michael Chan
2021-04-12  0:18 ` [PATCH net-next 2/5] bnxt_en: Invalidate health register mapping at the end of probe Michael Chan
2021-04-12  0:18 ` [PATCH net-next 3/5] bnxt_en: Refactor bnxt_vf_reps_create() Michael Chan
2021-04-12  0:18 ` [PATCH net-next 4/5] bnxt_en: Refactor __bnxt_vf_reps_destroy() Michael Chan
2021-04-12  7:37   ` Leon Romanovsky [this message]
2021-04-12 16:31     ` Michael Chan
2021-04-12 17:33       ` Leon Romanovsky
2021-04-12 17:51         ` Michael Chan
2021-04-13  5:25           ` Leon Romanovsky
2021-04-12  0:18 ` [PATCH net-next 5/5] bnxt_en: Free and allocate VF-Reps during error recovery Michael Chan
2021-04-12 20:30 ` [PATCH net-next 0/5] bnxt_en: Error recovery fixes patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YHP4piIPfdXca+uB@unreal \
    --to=leon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=gospo@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).