From patchwork Thu Dec 14 02:08:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13492212 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 89B1C6110 for ; Thu, 14 Dec 2023 02:08:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="n5ArYq77" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05C5EC433CC; Thu, 14 Dec 2023 02:08:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702519729; bh=09QQY7G0UQ1opB2nOU0ndukHDhP/0QK0bPUOMMnu8Ug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n5ArYq77xZtf+6/YN0EsbZknXCZkxa5ku9UzfCQXxlcxnYyxAcOQNxSq3OGD34V1b nsO171AzE/pvGFO2qB5tt6yTWtYneOTHRZcou9/gD5jHfmaD6/zdKuEY6vPKtYemex ebI3uNxN8uHWRBM1SBGmVFrSMFF1AaH+j9ju9FlPPQQ93I+gLoMAmSCHufuJLFSQ0B E3sW2xUheHK8YoWy2UXMk5V0fpUbWTgg8UxSZc0vBoR4xvaplsNj2KBR5EKBX8jjFr rniyNgh8EUj4qid8nEJFcey13FCfALpM4veSQfgELntPYUZCg2bjuc7CAF54X9TFzC GOlbdnHTQDFpw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman Subject: [net-next 10/11] net/mlx5: devcom, Add component size getter Date: Wed, 13 Dec 2023 18:08:31 -0800 Message-ID: <20231214020832.50703-11-saeed@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231214020832.50703-1-saeed@kernel.org> References: <20231214020832.50703-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 Add a getter for the number of participants in a devcom component (those who share the same component id and key). Signed-off-by: Tariq Toukan Reviewed-by: Gal Pressman Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c | 7 +++++++ drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c index e8e50563e956..e7d59cfa8708 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c @@ -256,6 +256,13 @@ void mlx5_devcom_unregister_component(struct mlx5_devcom_comp_dev *devcom) devcom_free_comp_dev(devcom); } +int mlx5_devcom_comp_get_size(struct mlx5_devcom_comp_dev *devcom) +{ + struct mlx5_devcom_comp *comp = devcom->comp; + + return kref_read(&comp->ref); +} + int mlx5_devcom_send_event(struct mlx5_devcom_comp_dev *devcom, int event, int rollback_event, void *event_data) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.h b/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.h index fc23bbef87b4..ec32b686f586 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.h @@ -31,6 +31,7 @@ void mlx5_devcom_unregister_component(struct mlx5_devcom_comp_dev *devcom); int mlx5_devcom_send_event(struct mlx5_devcom_comp_dev *devcom, int event, int rollback_event, void *event_data); +int mlx5_devcom_comp_get_size(struct mlx5_devcom_comp_dev *devcom); void mlx5_devcom_comp_set_ready(struct mlx5_devcom_comp_dev *devcom, bool ready); bool mlx5_devcom_comp_is_ready(struct mlx5_devcom_comp_dev *devcom);