From patchwork Thu Aug 9 13:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 143843 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2065733ljj; Thu, 9 Aug 2018 06:01:21 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzkneg3mzhoXiWr2lMFNho+nMmQCPIUY31xSxTpTAKsc6aVghXAWwPgIJnvGk7YxzM3+dOV X-Received: by 2002:a37:4248:: with SMTP id p69-v6mr1610885qka.238.1533819681130; Thu, 09 Aug 2018 06:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533819681; cv=none; d=google.com; s=arc-20160816; b=qLDXIuH0/ovaWwe7EbpBFUBLMPSfFY+6zSJGWF90uldaAGDIgCLokgHTzliBfxhJMT yBaXxU0R2s+uveLMoUZrovt5xd0aqr7gFmdpVJVQSIrLcgj7uqT7HYe9kpjAoj3zZ43q RII8C9aIGbDYr9ePfj6eXGL9mns8sYIfnAh4DHQwqhY7W5ChzlMtIRaTCcqMx190vf3b hbNKe9+hyQz4qErSc+H8rcUYgij8CsI5RulEsce+udteLPpf3wpyWzXiVvMb4mMc8UmC u9GgaCP/R/EoLywkoAhBF8374621oiwKd9R3z4WILOCMugsD76qwk8obuPO9iYm5ZYlR OHZg== 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:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=+jqDa8yIQCyIFjVXQ3t8so+pv20tlA9HC/8nwBF+21U=; b=esXuENgNihSRdtYhCfgK61DKXnaoQK53HmXXevYr0IPFB7Vhnm6Tzd/rY99oJKP6qD P/hzwcF8Q2DBZiN6pjZyYHHf0Oky5syhg3lI2raAj/7rCcd4g5eblP+c91C1dqQuogYn X0qyEIBVebwg97D5H8Vxf75Fnut4FTKss0a9x6CGvnS3k5MKNRjH8fyQFj1cZxTZT5nh q+xEvkjjHUt5px5CJVw6wHm25etzyCf+A3rXizQzHeJwaB3WIWH75nd5ggju586ATepF Ys3cfKurDoont3PF7dcxWZqBFT10dO4gyy7zQtyQ1ZC9BU8Ltm+ivLEJRoZ/3wRX5l32 x4/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id g25-v6si2623572qkm.263.2018.08.09.06.01.20; Thu, 09 Aug 2018 06:01:21 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id BE3F668622; Thu, 9 Aug 2018 13:01:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 7CFE06860D; Thu, 9 Aug 2018 13:00:38 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 707846860D; Thu, 9 Aug 2018 13:00:30 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 1A90E68618 for ; Thu, 9 Aug 2018 13:00:14 +0000 (UTC) Received: from mxback12j.mail.yandex.net (mxback12j.mail.yandex.net [IPv6:2a02:6b8:0:1619::87]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 061CE5105661 for ; Thu, 9 Aug 2018 16:00:13 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback12j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 6QsB1lVPco-0CHq3KPO; Thu, 09 Aug 2018 16:00:12 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id NB1Fb3jYn0-0CJWxacI; Thu, 09 Aug 2018 16:00:12 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 9 Aug 2018 13:00:08 +0000 Message-Id: <1533819610-30956-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533819610-30956-1-git-send-email-odpbot@yandex.ru> References: <1533819610-30956-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 670 Subject: [lng-odp] [PATCH v1 2/4] example: tm: add tm queues destroy X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Maxim Uvarov Signed-off-by: Maxim Uvarov --- /** Email created from pull request 670 (muvarov:devel/master_tm) ** https://github.com/Linaro/odp/pull/670 ** Patch: https://github.com/Linaro/odp/pull/670.patch ** Base sha: 7c87b66edc84e8c713fefc68d46464660adaf71e ** Merge commit sha: 37f8e9b0f4297cc96c5271e3e082cf0f39454538 **/ example/traffic_mgmt/odp_traffic_mgmt.c | 57 ++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/example/traffic_mgmt/odp_traffic_mgmt.c b/example/traffic_mgmt/odp_traffic_mgmt.c index 2af106ab8..42fff66fe 100644 --- a/example/traffic_mgmt/odp_traffic_mgmt.c +++ b/example/traffic_mgmt/odp_traffic_mgmt.c @@ -743,6 +743,47 @@ static void signal_handler(int signal) abort(); } +static int destroy_tm_queues(void) +{ + int i; + int class; + int ret; + + for (i = 0; i < NUM_SVC_CLASSES; i++) + for (class = 0; class < TM_QUEUES_PER_CLASS; class++) { + odp_tm_queue_t tm_queue; + odp_tm_queue_info_t info; + + tm_queue = queue_num_tbls[i][class + 1]; + + ret = odp_tm_queue_info(tm_queue, &info); + if (ret) { + printf("Err: odp_tm_queue_info %d\n", ret); + return -1; + } + + ret = odp_tm_node_disconnect(info.next_tm_node); + if (ret) { + printf("Err: odp_tm_node_disconnect %d\n", ret); + return -1; + } + + ret = odp_tm_queue_disconnect(tm_queue); + if (ret) { + printf("odp_tm_queue_disconnect %d\n", ret); + return -1; + } + + ret = odp_tm_queue_destroy(tm_queue); + if (ret) { + printf("odp_tm_queue_destroy %d\n", ret); + return -1; + } + } + + return 0; +} + int main(int argc, char *argv[]) { struct sigaction signal_action; @@ -796,6 +837,12 @@ int main(int argc, char *argv[]) odp_tm_stats_print(odp_tm_test); + rc = destroy_tm_queues(); + if (rc != 0) { + printf("Error: destroy_tm_queues() failed, rc = %d\n", rc); + return -1; + } + rc = odp_pool_destroy(odp_pool); if (rc != 0) { printf("Error: odp_pool_destroy() failed, rc = %d\n", rc); @@ -814,11 +861,11 @@ int main(int argc, char *argv[]) return -1; } - /* Trying to keep this example as simple as possible we avoid - * clean termination of TM queues. This will error on global - * termination code - */ - (void)odp_term_global(instance); + rc = odp_term_global(instance); + if (rc != 0) { + printf("Error: odp_term_global() failed, rc = %d\n", rc); + return -1; + } return 0; }