From patchwork Thu Feb 8 03:53:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13549307 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 23E6931A93 for ; Thu, 8 Feb 2024 03:54:17 +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=1707364458; cv=none; b=AVb8RJcrGUrtWMpKDhPZ1WYkwilaMl9K66nqREGOEA2qjuLqT+2B57G2rKI5x2VfkNG3W+BcA0t3EPUwdhHeX+RvqAiU1Mc1robfIhViOC5ZWhf4sSOGn2I+HeoER5l+odtSy3yMwk/FIH5qINx8Hy/nnB8WONKgeVnuXG4ELmM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707364458; c=relaxed/simple; bh=gdaMdGQEJCu4Xd6PrV+dN2V36u0p4zM4fRxfVDBbQ/c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eUcbsAH1eRTIXlOAoErU5cd4/XV46u59B5Us/9v4psJjQm7oI7PzSJjHlM1lQ7/rdq2M6MR6S0eHgXGzItUtS24kcQgwJwpva5jHv6xdOtgrTD8++ZrfoLN8/orYHvijF0XgDmyVa4DMha0DM+woiDAdsTdZFzKWSdaZTjpT6KI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fYgNndtU; 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="fYgNndtU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D738C433F1; Thu, 8 Feb 2024 03:54:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707364457; bh=gdaMdGQEJCu4Xd6PrV+dN2V36u0p4zM4fRxfVDBbQ/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fYgNndtUp6AtRWxq/h8WAuE9pfNPgZEE3mV+0zO99bFPcr94nbMIAbXXM7j9AbMW3 gNlHlfEXszbMKO9nt17VtYZ//n6h6/Fdnr3F0V3ZJOjKhHBBSrCt85LPm/gZaOEETy vokqwZTpnhB+lArKNS61wLc/aaQMn2a4TPolgIJoQDG4qXEQ7RzInJeqawwRNTHHfH XWYMXjXZ2gWg5ONKS7xp2Ec1diQR/A+odDVBY2NWOKwHFw21WpdNcaYguF5lCwhmmu L0KYnXTrte5NdoOxXFnB/N9rQClIZwy2LeIDUdu5t5i0trf3hXewM1Q0WmMkI0tu2d 8McgCw5o1ANlw== 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 V2 09/15] net/mlx5e: Create EN core HW resources for all secondary devices Date: Wed, 7 Feb 2024 19:53:46 -0800 Message-ID: <20240208035352.387423-10-saeed@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240208035352.387423-1-saeed@kernel.org> References: <20240208035352.387423-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 2c47c9076aa6..90a02fd3357a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -5988,22 +5988,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) @@ -6029,15 +6036,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; }