From patchwork Thu Mar 7 08:42:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13585208 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 634C183A0D for ; Thu, 7 Mar 2024 08:42:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709800966; cv=none; b=VifIiTy7Fy9lERvzeutFqbTwLjZsfbo3tyNHEFCp7e8OY7W262j/djs2VoYCoKIEA2uVCwVEnMHewRkDuZXqs33+33OcxhMFwmu3ouKF3TaWPR1FoB1lHu8qZ99etKu38ndl975UFH6TfVB6b5GbXzr+bznimUSoJnnY76dSzp4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709800966; c=relaxed/simple; bh=wyXddwULvcl3/d051VrkRLBX8+Q+gZouGu+RH1Dns4U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W5ZeM364IQl5nnM33LGgSgYVP7HQ8EIJfJiiLomHvu7XtUiT8GkwzLeu52f3TyBge41mCevoByi4D3u6TBEho179EPwrKPnxqp2GJPrzq9mp8sx7bdUQq22z6Hn75Y38ZYHNbGrP6ibsTeXDgdFSbnwEDbzVQOHadQyJJNPcOi4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K7uXpbmk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K7uXpbmk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C585CC433F1; Thu, 7 Mar 2024 08:42:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709800965; bh=wyXddwULvcl3/d051VrkRLBX8+Q+gZouGu+RH1Dns4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K7uXpbmkCQg7Xqofr/zf0SdOWWEpefDIOXN3+1MWvIral0UjX1RXIQ/qTInGsGouf nHckuManTSHgVoJN3d+AUj1YWB82fdRUc2cDRavD9ExdF7F/fDU0mScyKWj5bllYB3 ABRnyGoGEP4D73ly0P4zx/rUGMLs6oMLsGmsAWpFyg04hshLIVGoVi31vULx8IFOns xw6qrFeaiiB5ibeFn+xejUo73uvS9PLYblSBTlrnIeJNc7kPERYXDiUgu0/PPMuD6Z uh4Xuf97MZA6EyCf573PQbzKYJ/dpVOednV6vd7IE68dso+X7U8HjE2gCAj+j/DSLO 8EQlUUWQ+CW2A== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky Subject: [net-next V6 09/15] net/mlx5e: Create EN core HW resources for all secondary devices Date: Thu, 7 Mar 2024 00:42:23 -0800 Message-ID: <20240307084229.500776-10-saeed@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240307084229.500776-1-saeed@kernel.org> References: <20240307084229.500776-1-saeed@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Tariq Toukan Traffic queues will be created on all devices, including the secondaries. Create the needed core layer resources for them as well. Signed-off-by: Tariq Toukan Reviewed-by: Gal Pressman Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + .../net/ethernet/mellanox/mlx5/core/en_main.c | 32 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 55c6ace0acd5..6c143088e247 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -60,6 +60,7 @@ #include "lib/clock.h" #include "en/rx_res.h" #include "en/selq.h" +#include "lib/sd.h" extern const struct net_device_ops mlx5e_netdev_ops; struct page_pool; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index ef6a342742a2..c6c406c18b54 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -5995,22 +5995,29 @@ static int _mlx5e_resume(struct auxiliary_device *adev) struct mlx5e_priv *priv = mlx5e_dev->priv; struct net_device *netdev = priv->netdev; struct mlx5_core_dev *mdev = edev->mdev; - int err; + struct mlx5_core_dev *pos, *to; + int err, i; if (netif_device_present(netdev)) return 0; - err = mlx5e_create_mdev_resources(mdev, true); - if (err) - return err; + mlx5_sd_for_each_dev(i, mdev, pos) { + err = mlx5e_create_mdev_resources(pos, true); + if (err) + goto err_destroy_mdev_res; + } err = mlx5e_attach_netdev(priv); - if (err) { - mlx5e_destroy_mdev_resources(mdev); - return err; - } + if (err) + goto err_destroy_mdev_res; return 0; + +err_destroy_mdev_res: + to = pos; + mlx5_sd_for_each_dev_to(i, mdev, to, pos) + mlx5e_destroy_mdev_resources(pos); + return err; } static int mlx5e_resume(struct auxiliary_device *adev) @@ -6036,15 +6043,20 @@ static int _mlx5e_suspend(struct auxiliary_device *adev) struct mlx5e_priv *priv = mlx5e_dev->priv; struct net_device *netdev = priv->netdev; struct mlx5_core_dev *mdev = priv->mdev; + struct mlx5_core_dev *pos; + int i; if (!netif_device_present(netdev)) { if (test_bit(MLX5E_STATE_DESTROYING, &priv->state)) - mlx5e_destroy_mdev_resources(mdev); + mlx5_sd_for_each_dev(i, mdev, pos) + mlx5e_destroy_mdev_resources(pos); return -ENODEV; } mlx5e_detach_netdev(priv); - mlx5e_destroy_mdev_resources(mdev); + mlx5_sd_for_each_dev(i, mdev, pos) + mlx5e_destroy_mdev_resources(pos); + return 0; }