From patchwork Fri Sep 27 07:58:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 174596 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3156797ill; Fri, 27 Sep 2019 01:01:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqypOlxmJkT74kQZ3Fagi/PIon0MzgdsBwvYnQWoZ+L4lfxvK4H7dKbxeDAn8quJ8nkONj2l X-Received: by 2002:a50:cf8b:: with SMTP id h11mr2919805edk.236.1569571285050; Fri, 27 Sep 2019 01:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569571285; cv=none; d=google.com; s=arc-20160816; b=guUq4xLyd4dPuOgCqL/3IOMXrhEvdG2/EILSH2mH9khAoRlpHDWNL2t+3JWMuhcfrw W4pzVH5kdcUD1tpjG/RcVUadUMHJddrFHqsPS1EywQAz3CI6JcmPlj29jL0DzU5wX89S tAWmvk0fGo/STnuG7/1FhGenzLrqILEHiDZAaQ1Egvf4q/2ZWT+GTccIdc3O14W77LAC 0oOsha2Bo/WtKfUUtzKAPVjhxDhNgxqmO4d7RjPuhzRJrEBg5oqZ/bOwoRfQQWrzi8QQ e7/Ndz5QG9LAb9zTeZVlPtqFBAoTwYQpLZZMqTPn1/T129cK1Vv4PSFAeQj+FsMgKfPy V2jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=vkjrvWg/t+b3kL8BzyfC68n3g0+4dxB09gryVKFI6a4=; b=E0oD5bDQAtZjqxvGQC0VcsZBBc4VumcXALJkF62BAb/0kKIDKkKKOzof1O50iiazmy HieRlCxX8zHDXXmqR5B52eBKQHhrW+fNnBjiVAqQ3H8o14zrx0kbPqbT65n1JaNVu5d/ PNG7qSP7EJlMowBy+rJi70iYD/Nm/ThOaklhkxnq28Cz98GIQrQFx1Xe3tjSEBc7ouws boDKzj9nA9M0zJC/kkvDi2nlkaM5Nwc6BwAvf1K+WK8dNHeIB32M1mfyRGCn9YWDdDaB GwyTwY/kYGl0xW7nGvGRIWnZ4IMgJ5Yd+z6ibmIB3T8EAdU/xoMScS36vnxeQzfLAufc LYuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id v13si1075824eds.375.2019.09.27.01.01.24; Fri, 27 Sep 2019 01:01:25 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 289A52E8F; Fri, 27 Sep 2019 10:01:13 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 79C442BF4 for ; Fri, 27 Sep 2019 10:01:01 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 14AF31A0AD3; Fri, 27 Sep 2019 10:01:01 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id AF9701A065B; Fri, 27 Sep 2019 10:00:59 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 869064030F; Fri, 27 Sep 2019 16:00:57 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: jerinj@marvell.com Date: Fri, 27 Sep 2019 13:28:38 +0530 Message-Id: <20190927075841.21841-4-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190927075841.21841-1-hemant.agrawal@nxp.com> References: <20190907064209.30686-1-hemant.agrawal@nxp.com> <20190927075841.21841-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 3/6] event/dpaa2: add destroy support 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 patch add support to destroy the event device Signed-off-by: Hemant Agrawal --- drivers/event/dpaa2/dpaa2_eventdev.c | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) -- 2.17.1 diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index 98b487603..9255de16f 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -1059,6 +1059,39 @@ dpaa2_eventdev_create(const char *name) return -EFAULT; } +static int +dpaa2_eventdev_destroy(const char *name) +{ + struct rte_eventdev *eventdev; + struct dpaa2_eventdev *priv; + int i; + + eventdev = rte_event_pmd_get_named_dev(name); + if (eventdev == NULL) { + RTE_EDEV_LOG_ERR("eventdev with name %s not allocated", name); + return -1; + } + + /* For secondary processes, the primary has done all the work */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + priv = eventdev->data->dev_private; + for (i = 0; i < priv->max_event_queues; i++) { + if (priv->evq_info[i].dpcon) + rte_dpaa2_free_dpcon_dev(priv->evq_info[i].dpcon); + + if (priv->evq_info[i].dpci) + rte_dpaa2_free_dpci_dev(priv->evq_info[i].dpci); + + } + priv->max_event_queues = 0; + + RTE_LOG(INFO, PMD, "%s eventdev cleaned\n", name); + return 0; +} + + static int dpaa2_eventdev_probe(struct rte_vdev_device *vdev) { @@ -1077,6 +1110,8 @@ dpaa2_eventdev_remove(struct rte_vdev_device *vdev) name = rte_vdev_device_name(vdev); DPAA2_EVENTDEV_INFO("Closing %s", name); + dpaa2_eventdev_destroy(name); + return rte_event_pmd_vdev_uninit(name); }