From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id B5888A04B5;
	Wed, 28 Oct 2020 00:33:12 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 06C3AA8E9;
	Wed, 28 Oct 2020 00:24:57 +0100 (CET)
Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])
 by dpdk.org (Postfix) with ESMTP id CE32D3257
 for <dev@dpdk.org>; Wed, 28 Oct 2020 00:24:00 +0100 (CET)
Received: from Internal Mail-Server by MTLPINE1 (envelope-from
 ophirmu@nvidia.com) with SMTP; 28 Oct 2020 01:23:55 +0200
Received: from nvidia.com (pegasus05.mtr.labs.mlnx [10.210.16.100])
 by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 09RNNrrc026642;
 Wed, 28 Oct 2020 01:23:55 +0200
From: Ophir Munk <ophirmu@nvidia.com>
To: dev@dpdk.org, Raslan Darawsheh <rasland@nvidia.com>
Cc: Ophir Munk <ophirmu@nvidia.com>, Matan Azrad <matan@nvidia.com>,
 Tal Shnaiderman <talshn@nvidia.com>, Thomas Monjalon <thomas@monjalon.net>
Date: Tue, 27 Oct 2020 23:22:49 +0000
Message-Id: <20201027232335.31427-27-ophirmu@nvidia.com>
X-Mailer: git-send-email 2.8.4
In-Reply-To: <20201027232335.31427-1-ophirmu@nvidia.com>
References: <20201027232335.31427-1-ophirmu@nvidia.com>
Subject: [dpdk-dev] [PATCH v1 26/72] common/mlx5/windows: add getter
	functions
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Add file mlx5/windows/mlx5_common_os.h the equivalent of Linux file
mlx5/linux/mlx5_common_os.h. It contains getters functions
mlx5_os_get_dev_device_name, mlx5_os_get_ctx_device_name,
mlx5_os_get_ctx_device_path, mlx5_os_get_umem_id,
mlx5_os_get_devx_channel_fd.

Signed-off-by: Ophir Munk <ophirmu@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/windows/mlx5_common_os.h | 91 ++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/drivers/common/mlx5/windows/mlx5_common_os.h b/drivers/common/mlx5/windows/mlx5_common_os.h
index cce7c88..2abdb2c 100644
--- a/drivers/common/mlx5/windows/mlx5_common_os.h
+++ b/drivers/common/mlx5/windows/mlx5_common_os.h
@@ -48,4 +48,95 @@ mlx5_os_free(void *addr)
 {
 	_aligned_free(addr);
 }
+
+/**
+ * Get fd. Given a pointer to DevX channel object of type
+ * 'struct mlx5dv_devx_event_channel*' - return its fd.
+ * Under Windows it is a stub.
+ *
+ * @param[in] channel
+ *    Pointer to channel object.
+ *
+ * @return
+ *    0
+ */
+static inline int
+mlx5_os_get_devx_channel_fd(void *channel)
+{
+	if (!channel)
+		return 0;
+	return 0;
+}
+
+/**
+ * Get device name. Given a device pointer - return a
+ * pointer to the corresponding device name.
+ *
+ * @param[in] dev
+ *   Pointer to device.
+ *
+ * @return
+ *   Pointer to device name if dev is valid, NULL otherwise.
+ */
+static inline const char *
+mlx5_os_get_dev_device_name(void *dev)
+{
+	if (!dev)
+		return NULL;
+	return ((struct devx_device *)dev)->name;
+}
+
+/**
+ * Get device name. Given a context pointer - return a
+ * pointer to the corresponding device name.
+ *
+ * @param[in] ctx
+ *   Pointer to context.
+ *
+ * @return
+ *   Pointer to device name if ctx is valid, NULL otherwise.
+ */
+static inline const char *
+mlx5_os_get_ctx_device_name(void *ctx)
+{
+	if (!ctx)
+		return NULL;
+	return ((mlx5_context_st *)ctx)->mlx5_dev.name;
+}
+
+/**
+ * Get a device path name. Given acontext pointer - return a
+ * pointer to the corresponding device path name.
+ *
+ * @param[in] ctx
+ *   Pointer to context.
+ *
+ * @return
+ *   Pointer to device path name if ctx is valid, NULL otherwise.
+ */
+
+static inline const char *
+mlx5_os_get_ctx_device_path(void *ctx)
+{
+	if (!ctx)
+		return NULL;
+	return ((mlx5_context_st *)ctx)->mlx5_dev.dev_pnp_id;
+}
+
+/**
+ * Get umem id. Given a pointer to umem object of type return its id.
+ *
+ * @param[in] umem
+ *    Pointer to umem object.
+ *
+ * @return
+ *    The umem id if umem is valid, 0 otherwise.
+ */
+static inline uint32_t
+mlx5_os_get_umem_id(void *umem)
+{
+	if (!umem)
+		return 0;
+	return ((struct mlx5_devx_umem *)umem)->umem_id;
+}
 #endif /* RTE_PMD_MLX5_COMMON_OS_H_ */
-- 
2.8.4