From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2D6CBA034F; Fri, 8 Oct 2021 12:58:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 61B80411CC; Fri, 8 Oct 2021 12:56:27 +0200 (CEST) Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by mails.dpdk.org (Postfix) with ESMTP id 1A41B411E0 for ; Thu, 7 Oct 2021 20:45:25 +0200 (CEST) Received: by mail-pj1-f41.google.com with SMTP id g13-20020a17090a3c8d00b00196286963b9so7590350pjc.3 for ; Thu, 07 Oct 2021 11:45:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oneconvergence.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CGinMGlmXFKb29BXBNqt7ojZUhc1uWhA8vQNSwsjpNA=; b=fIuTnSfq11qw6Xr2UIGJcrLaT9h0d7GUEfbtQ7FgrHsz9Nma0n1pjZnX5qvnzXZv/4 Yr0HZ8ySNzhyy0pUmlcm4vK5/iYXYSWh3uNdP9rjw3IQdUnjpJHIuGio7wsoPZn04nKe iVTLMF4HvxYWP/6KG81wtV87xYjntiyB6BQAk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CGinMGlmXFKb29BXBNqt7ojZUhc1uWhA8vQNSwsjpNA=; b=UO+L3/KK94DTl3cB/KlgKzEYyx+Dde/fpApwLQGms7y/KuouCz0v6WmHdV8yRSyTSD rnIzkc9j88KSW8IdJOAEyvwyWSTPNM4X+fYp8KD4kMotqWBz8bUKaaog6UsJNt4XSNVh bF987HBcTxdXFDJKfAw7yNyb8CQ8HuoYuOrHRXLu5yzZYiGAV/07pt7RguSJkgl8Z0KB WCaaqb2rWMKuL4qf4Fime8l3bdSyd+HW/HRUp04j4PxsJBH6OShjJN+l3zgdM/qQzcxP GWhyw8ljufQxTkzmaxSixsc3QYZrn7RqTICHGlxpN1RERP2vBjOX7hfzU9nTaQw1O1cd DnuQ== X-Gm-Message-State: AOAM533o0lSyZjiZWcN1Wk/5y+KZGv1LkP6hRWUPuomemJfIVzEQPZrV tvzuRbHdVVkTLjuSBf6ct2Xqhg== X-Google-Smtp-Source: ABdhPJxemaXqzCVQOJYVoAa79RIC6eX9MDl1LZ25GVxvTvu/JkWXcYGDMRrbytsAIUrApcAgONm0qw== X-Received: by 2002:a17:903:1252:b0:13d:f3f6:2e1c with SMTP id u18-20020a170903125200b0013df3f62e1cmr5405601plh.73.1633632324317; Thu, 07 Oct 2021 11:45:24 -0700 (PDT) Received: from srikanth-ThinkPad-T450.domain.name ([136.185.113.102]) by smtp.gmail.com with ESMTPSA id c11sm3311586pji.38.2021.10.07.11.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 11:45:23 -0700 (PDT) From: Srikanth Kaka To: Matan Azrad , Viacheslav Ovsiienko Cc: dev@dpdk.org, Vag Singh , Anand Thulasiram , Srikanth Kaka Date: Fri, 8 Oct 2021 00:13:35 +0530 Message-Id: <20211007184350.73858-27-srikanth.k@oneconvergence.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211007184350.73858-1-srikanth.k@oneconvergence.com> References: <20211007184350.73858-1-srikanth.k@oneconvergence.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Fri, 08 Oct 2021 12:55:54 +0200 Subject: [dpdk-dev] [PATCH v2 26/41] net/mlx5: add callback to check dev is removed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" add callback to check dev is removed Signed-off-by: Srikanth Kaka Signed-off-by: Vag Singh Signed-off-by: Anand Thulasiram --- drivers/net/mlx5/freebsd/mlx5_ethdev_os.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/mlx5/freebsd/mlx5_ethdev_os.c b/drivers/net/mlx5/freebsd/mlx5_ethdev_os.c index b10ffb36fc..5b66e1802b 100644 --- a/drivers/net/mlx5/freebsd/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/freebsd/mlx5_ethdev_os.c @@ -616,6 +616,26 @@ mlx5_set_link_up(struct rte_eth_dev *dev) return mlx5_set_flags(dev, ~IFF_UP, IFF_UP); } +/** + * 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 ibv_device_attr device_attr; + struct mlx5_priv *priv = dev->data->dev_private; + + if (mlx5_glue->query_device(priv->sh->ctx, &device_attr) == EIO) + return 1; + return 0; +} + /** * Get MAC address by querying netdevice. * -- 2.30.2