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 36E56A04B5; Wed, 28 Oct 2020 00:43:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8511BC8F4; Wed, 28 Oct 2020 00:25:42 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id BCD1B49E0 for ; Wed, 28 Oct 2020 00:24:02 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from ophirmu@nvidia.com) with SMTP; 28 Oct 2020 01:23:57 +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 09RNNrs4026642; Wed, 28 Oct 2020 01:23:57 +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:15 +0000 Message-Id: <20201027232335.31427-53-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 52/72] net/mlx5/windows: support is removed 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: Tal Shnaiderman This commit implements mlx5_is_removed() API. A new glue call 'init_shutdown_event' is added to support the new API. Signed-off-by: Tal Shnaiderman --- drivers/common/mlx5/windows/mlx5_glue.c | 21 +++++++++++++++++++++ drivers/common/mlx5/windows/mlx5_glue.h | 1 + drivers/common/mlx5/windows/mlx5_win_ext.h | 2 +- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 20 ++++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/common/mlx5/windows/mlx5_glue.c b/drivers/common/mlx5/windows/mlx5_glue.c index 1675318..aef6d3b 100644 --- a/drivers/common/mlx5/windows/mlx5_glue.c +++ b/drivers/common/mlx5/windows/mlx5_glue.c @@ -308,6 +308,26 @@ mlx5_glue_query_rt_values(void *ctx, void *devx_clock) return 0; } +static int +mlx5_glue_devx_init_showdown_event(void *ctx) +{ + struct mlx5_context *mlx5_ctx; + int err; + + if (!ctx) { + errno = EINVAL; + return errno; + } + mlx5_ctx = (struct mlx5_context *)ctx; + err = devx_query_shutdown_event(mlx5_ctx->devx_ctx, + &mlx5_ctx->shutdown_event_obj); + if (err) { + errno = err; + return errno; + } + return 0; +} + alignas(RTE_CACHE_LINE_SIZE) const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){ .version = MLX5_GLUE_VERSION, @@ -330,4 +350,5 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){ .devx_fs_rule_del = mlx5_glue_devx_fs_rule_del, .devx_query_eqn = mlx5_glue_devx_query_eqn, .query_rt_values = mlx5_glue_query_rt_values, + .devx_init_showdown_event = mlx5_glue_devx_init_showdown_event, }; diff --git a/drivers/common/mlx5/windows/mlx5_glue.h b/drivers/common/mlx5/windows/mlx5_glue.h index bfaaa2a..420bfb2 100644 --- a/drivers/common/mlx5/windows/mlx5_glue.h +++ b/drivers/common/mlx5/windows/mlx5_glue.h @@ -52,6 +52,7 @@ struct mlx5_glue { int (*devx_fs_rule_del)(void *flow); int (*devx_query_eqn)(void *context, uint32_t cpus, uint32_t *eqn); int (*query_rt_values)(void *ctx, void *devx_clock); + int (*devx_init_showdown_event)(void *ctx); }; extern const struct mlx5_glue *mlx5_glue; diff --git a/drivers/common/mlx5/windows/mlx5_win_ext.h b/drivers/common/mlx5/windows/mlx5_win_ext.h index a14a6cc..111af2e 100644 --- a/drivers/common/mlx5/windows/mlx5_win_ext.h +++ b/drivers/common/mlx5/windows/mlx5_win_ext.h @@ -14,7 +14,7 @@ extern "C" { typedef struct mlx5_context { devx_device_ctx *devx_ctx; struct devx_device mlx5_dev; - + struct devx_shutdown_event shutdown_event_obj; } mlx5_context_st; typedef struct { diff --git a/drivers/net/mlx5/windows/mlx5_ethdev_os.c b/drivers/net/mlx5/windows/mlx5_ethdev_os.c index 05f25cc..c843605 100644 --- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c @@ -364,3 +364,23 @@ mlx5_read_clock(struct rte_eth_dev *dev, uint64_t *clock) *clock = *(u64 volatile *)mlx5_clock.p_iseg_internal_timer; return 0; } + +/** + * Check if mlx5 device was removed. + * + * @param dev + * Pointer to Ethernet device structure. + * + * @return + * 1 when device is removed, otherwise 0. + */ +int +mlx5_is_removed(struct rte_eth_dev *dev) +{ + struct mlx5_priv *priv = dev->data->dev_private; + mlx5_context_st *context_obj = (mlx5_context_st *)priv->sh->ctx; + + if (*context_obj->shutdown_event_obj.p_flag) + return 1; + return 0; +} -- 2.8.4