All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Tariq Toukan <tariqt@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Gal Pressman <gal@nvidia.com>,
	Leon Romanovsky <leonro@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org, Moshe Shemesh <moshe@nvidia.com>,
	Mark Bloch <mbloch@nvidia.com>
Subject: Re: [PATCH net 2/2] net/mlx5: Start health poll after enable hca
Date: Wed, 19 Mar 2025 10:36:53 +0100	[thread overview]
Message-ID: <Z9qQNe/M7IAkpR33@mev-dev.igk.intel.com> (raw)
In-Reply-To: <1742331077-102038-3-git-send-email-tariqt@nvidia.com>

On Tue, Mar 18, 2025 at 10:51:17PM +0200, Tariq Toukan wrote:
> From: Moshe Shemesh <moshe@nvidia.com>
> 
> The health poll mechanism performs periodic checks to detect firmware
> errors. One of the checks verifies the function is still enabled on
> firmware side, but the function is enabled only after enable_hca command
> completed. Start health poll after enable_hca command to avoid a race
> between function enabled and first health polling.
> 
> Fixes: 9b98d395b85d ("net/mlx5: Start health poll at earlier stage of driver load")
> Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
> Reviewed-by: Shay Drori <shayd@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/main.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> index ec956c4bcebd..7c3312d6aed9 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> @@ -1205,24 +1205,24 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
>  	dev->caps.embedded_cpu = mlx5_read_embedded_cpu(dev);
>  	mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_UP);
>  
> -	mlx5_start_health_poll(dev);
> -
>  	err = mlx5_core_enable_hca(dev, 0);
>  	if (err) {
>  		mlx5_core_err(dev, "enable hca failed\n");
> -		goto stop_health_poll;
> +		goto err_cmd_cleanup;
>  	}
>  
> +	mlx5_start_health_poll(dev);
> +
>  	err = mlx5_core_set_issi(dev);
>  	if (err) {
>  		mlx5_core_err(dev, "failed to set issi\n");
> -		goto err_disable_hca;
> +		goto stop_health_poll;
>  	}
>  
>  	err = mlx5_satisfy_startup_pages(dev, 1);
>  	if (err) {
>  		mlx5_core_err(dev, "failed to allocate boot pages\n");
> -		goto err_disable_hca;
> +		goto stop_health_poll;
>  	}
>  
>  	err = mlx5_tout_query_dtor(dev);
> @@ -1235,10 +1235,9 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
>  
>  reclaim_boot_pages:
>  	mlx5_reclaim_startup_pages(dev);
> -err_disable_hca:
> -	mlx5_core_disable_hca(dev, 0);
>  stop_health_poll:
>  	mlx5_stop_health_poll(dev, boot);
> +	mlx5_core_disable_hca(dev, 0);
>  err_cmd_cleanup:
>  	mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN);
>  	mlx5_cmd_disable(dev);
> @@ -1249,8 +1248,8 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
>  static void mlx5_function_disable(struct mlx5_core_dev *dev, bool boot)
>  {
>  	mlx5_reclaim_startup_pages(dev);
> -	mlx5_core_disable_hca(dev, 0);
>  	mlx5_stop_health_poll(dev, boot);
> +	mlx5_core_disable_hca(dev, 0);
>  	mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN);
>  	mlx5_cmd_disable(dev);
>  }

Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>

> -- 
> 2.31.1

  reply	other threads:[~2025-03-19  9:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 20:51 [PATCH net 0/2] mlx5 misc fixes 2025-03-18 Tariq Toukan
2025-03-18 20:51 ` [PATCH net 1/2] net/mlx5: LAG, reload representors on LAG creation failure Tariq Toukan
2025-03-19  7:13   ` Michal Swiatkowski
2025-03-19 11:36   ` Kalesh Anakkur Purayil
2025-03-18 20:51 ` [PATCH net 2/2] net/mlx5: Start health poll after enable hca Tariq Toukan
2025-03-19  9:36   ` Michal Swiatkowski [this message]
2025-03-19 11:35   ` Kalesh Anakkur Purayil
2025-03-24 22:30 ` [PATCH net 0/2] mlx5 misc fixes 2025-03-18 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=Z9qQNe/M7IAkpR33@mev-dev.igk.intel.com \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=moshe@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.