From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EED56C2B9F4 for ; Thu, 17 Jun 2021 08:15:01 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 81477613D5 for ; Thu, 17 Jun 2021 08:15:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81477613D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EEB7C410E2; Thu, 17 Jun 2021 10:14:57 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 6B490410DC for ; Thu, 17 Jun 2021 10:14:55 +0200 (CEST) IronPort-SDR: ISMFv5c733IRnHhtA/xwH+daFRXPeHYpIeRNAFEsvDlT4+kbNuch04AgG3OGR2dzdpy/9yfLMc u557M6sIi6oQ== X-IronPort-AV: E=McAfee;i="6200,9189,10017"; a="206361072" X-IronPort-AV: E=Sophos;i="5.83,280,1616482800"; d="scan'208";a="206361072" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2021 01:14:55 -0700 IronPort-SDR: 7YzPHihZ7dmVxVO7Y6Kt3xHyULGOxOCi52t/+QWHxOh/nmokkJUZylOpf9y0/oXZ8WSjGqSwfa DC/ZwWbXi5ug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,280,1616482800"; d="scan'208";a="488573254" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.27]) by fmsmga002.fm.intel.com with ESMTP; 17 Jun 2021 01:14:54 -0700 From: Ferruh Yigit To: dev@dpdk.org Cc: Ferruh Yigit Date: Thu, 17 Jun 2021 09:14:47 +0100 Message-Id: <20210617081449.2045195-2-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617081449.2045195-1-ferruh.yigit@intel.com> References: <20210617081449.2045195-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC 2/4] test/virtual_pmd: clean rings on close 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" Not cleaning the rings prevents creating devices again, which breaks to run some unit tests multiple times. Signed-off-by: Ferruh Yigit --- app/test/virtual_pmd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index 4d6ce302a563..17f28c5a304c 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -34,7 +34,7 @@ struct virtual_ethdev_queue { }; static int -virtual_ethdev_start_success(struct rte_eth_dev *eth_dev __rte_unused) +virtual_ethdev_start_success(struct rte_eth_dev *eth_dev) { eth_dev->data->dev_started = 1; @@ -42,13 +42,13 @@ virtual_ethdev_start_success(struct rte_eth_dev *eth_dev __rte_unused) } static int -virtual_ethdev_start_fail(struct rte_eth_dev *eth_dev __rte_unused) +virtual_ethdev_start_fail(struct rte_eth_dev *eth_dev) { eth_dev->data->dev_started = 0; return -1; } -static int virtual_ethdev_stop(struct rte_eth_dev *eth_dev __rte_unused) +static int virtual_ethdev_stop(struct rte_eth_dev *eth_dev) { void *pkt = NULL; struct virtual_ethdev_private *prv = eth_dev->data->dev_private; @@ -65,8 +65,13 @@ static int virtual_ethdev_stop(struct rte_eth_dev *eth_dev __rte_unused) } static int -virtual_ethdev_close(struct rte_eth_dev *dev __rte_unused) +virtual_ethdev_close(struct rte_eth_dev *eth_dev) { + struct virtual_ethdev_private *prv = eth_dev->data->dev_private; + + rte_ring_free(prv->rx_queue); + rte_ring_free(prv->tx_queue); + return 0; } -- 2.31.1