From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8F70CA09F6; Thu, 17 Dec 2020 18:44:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 882C0CCEC; Thu, 17 Dec 2020 18:34:02 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 513CECA41 for ; Thu, 17 Dec 2020 18:33:09 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from talshn@nvidia.com) with SMTP; 17 Dec 2020 19:33:04 +0200 Received: from nvidia.com (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0BHHX45P021771; Thu, 17 Dec 2020 19:33:04 +0200 From: Tal Shnaiderman To: dev@dpdk.org Cc: thomas@monjalon.net, matan@nvidia.com, rasland@nvidia.com, ophirmu@nvidia.com Date: Thu, 17 Dec 2020 19:30:06 +0200 Message-Id: <20201217173037.11396-5-talshn@nvidia.com> X-Mailer: git-send-email 2.16.1.windows.4 In-Reply-To: <20201217173037.11396-1-talshn@nvidia.com> References: <20201217173037.11396-1-talshn@nvidia.com> Subject: [dpdk-dev] [PATCH 04/35] common/mlx5/windows: add DevX UAR getters X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Ophir Munk The following getters are added: mlx5_os_get_devx_uar_mmap_offset, mlx5_os_get_devx_uar_base_addr, mlx5_os_get_devx_uar_reg_addr, mlx5_os_get_devx_uar_page_id. This commit is the Windows equivalent of the Linux implementation in [1]. [1] commit 8638e19a10aa ("net/mlx5: remove more DV dependencies") Signed-off-by: Ophir Munk Acked-by: Matan Azrad --- drivers/common/mlx5/windows/mlx5_common_os.h | 75 ++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/drivers/common/mlx5/windows/mlx5_common_os.h b/drivers/common/mlx5/windows/mlx5_common_os.h index ba166412cc..ac5b848bc2 100644 --- a/drivers/common/mlx5/windows/mlx5_common_os.h +++ b/drivers/common/mlx5/windows/mlx5_common_os.h @@ -6,6 +6,7 @@ #define RTE_PMD_MLX5_COMMON_OS_H_ #include +#include #include @@ -15,6 +16,8 @@ #include "mlx5_common_mr.h" #include "mlx5_win_ext.h" +#define MLX5_BF_OFFSET 0x800 + /** * This API allocates aligned or non-aligned memory. The free can be on either * aligned or nonaligned memory. To be protected - even though there may be no @@ -144,6 +147,78 @@ mlx5_os_get_umem_id(void *umem) return ((struct mlx5_devx_umem *)umem)->umem_id; } +/** + * Get mmap offset. Given a pointer to an DevX UAR object of type + * 'struct mlx5dv_devx_uar *' - return its mmap offset. + * In Windows, mmap_offset is unused. + * + * @param[in] uar + * Pointer to UAR object. + * + * @return + * 0 as mmap_offset is unused + */ +static inline off_t +mlx5_os_get_devx_uar_mmap_offset(void *uar) +{ + RTE_SET_USED(uar); + return 0; +} + +/** + * Get base addr pointer. Given a pointer to an UAR object of type + * 'struct mlx5dv_devx_uar *' - return its base address. + * + * @param[in] uar + * Pointer to an UAR object. + * + * @return + * The base address if UAR is valid, NULL otherwise. + */ +static inline void * +mlx5_os_get_devx_uar_base_addr(void *uar) +{ + if (!uar) + return NULL; + return ((devx_uar_handle *)uar)->uar_page; +} + +/** + * Get reg addr pointer. Given a pointer to an UAR object of type + * 'struct mlx5dv_devx_uar *' - return its reg address. + * + * @param[in] uar + * Pointer to an UAR object. + * + * @return + * The reg address if UAR is valid, NULL otherwise. + */ +static inline void * +mlx5_os_get_devx_uar_reg_addr(void *uar) +{ + if (!uar) + return NULL; + return ((char *)((devx_uar_handle *)uar)->uar_page) + MLX5_BF_OFFSET; +} + +/** + * Get page id. Given a pointer to an UAR object of type + * 'struct mlx5dv_devx_uar *' - return its page id. + * + * @param[in] uar + * Pointer to an UAR object. + * + * @return + * The page id if UAR is valid, 0 otherwise. + */ +static inline uint32_t +mlx5_os_get_devx_uar_page_id(void *uar) +{ + if (!uar) + return 0; + return ((devx_uar_handle *)uar)->uar_index; +} + void *mlx5_os_alloc_pd(void *ctx); int mlx5_os_dealloc_pd(void *pd); void *mlx5_os_umem_reg(void *ctx, void *addr, size_t size, uint32_t access); -- 2.16.1.windows.4