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 2B983A04B5; Wed, 28 Oct 2020 00:44:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8E89CC8FC; Wed, 28 Oct 2020 00:25:46 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id C547E3253 for ; Wed, 28 Oct 2020 00:24:03 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from ophirmu@nvidia.com) with SMTP; 28 Oct 2020 01:23:58 +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 09RNNrs8026642; Wed, 28 Oct 2020 01:23:58 +0200 From: Ophir Munk To: dev@dpdk.org, Raslan Darawsheh Cc: Ophir Munk , Matan Azrad , Tal Shnaiderman , Thomas Monjalon Date: Tue, 27 Oct 2020 23:23:19 +0000 Message-Id: <20201027232335.31427-57-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 56/72] net/mlx5/windows: support open device 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" This commit implements mlx5_os_open_device() API. It calls glue API open_device() then glue API query_device() to fill in 'struct mlx5_context' with data for later usage. Signed-off-by: Ophir Munk --- drivers/net/mlx5/windows/mlx5_os.c | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index 56bb969..fbfc044 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -103,6 +103,49 @@ mlx5_os_set_nonblock_channel_fd(int fd) } /** + * Function API open device under Windows + * + * This function calls the Windows glue APIs to open a device. + * + * @param[in] spawn + * Pointer to the device attributes (name, port, etc). + * @param[out] config + * Pointer to device configuration structure. + * @param[out] sh + * Pointer to shared context structure. + * + * @return + * 0 on success, a positive error value otherwise. + */ +int +mlx5_os_open_device(const struct mlx5_dev_spawn_data *spawn, + const struct mlx5_dev_config *config, + struct mlx5_dev_ctx_shared *sh) +{ + (void)config; + int err = 0; + /* Set numa node from pci probe */ + sh->numa_node = spawn->pci_dev->device.numa_node; + + /* Try to open device with DevX */ + rte_errno = 0; + sh->ctx = mlx5_glue->open_device(spawn->phys_dev); + if (!sh->ctx) { + DRV_LOG(ERR, "open_device failed"); + err = errno; + return err; + } + sh->devx = 1; + + struct mlx5_context *mlx5_ctx = (struct mlx5_context *)sh->ctx; + err = mlx5_glue->query_device(spawn->phys_dev, &mlx5_ctx->mlx5_dev); + if (err) + DRV_LOG(ERR, "query_device failed"); + + return err; +} + +/** * This function should share events between multiple ports of single IB * device. Currently it has no support under Windows. * -- 2.8.4