From patchwork Thu Oct 12 17:00:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 115660 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2162184qgn; Thu, 12 Oct 2017 10:03:11 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCBW3l6Hvk7chtzoTDEFLq7wzEWrguzerKMJcQP3DHas2CgmYWIYfI2T2YvKcvRuU7rS3M8 X-Received: by 10.107.164.105 with SMTP id n102mr4296961ioe.45.1507827791115; Thu, 12 Oct 2017 10:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507827791; cv=none; d=google.com; s=arc-20160816; b=zQNC+Sm86KCC1+ueo2y+bLwASSlbBoTbPc898osi4t9BowW6IhURF2E0atJtZOL9Oy cw0f0NOqC+IW0/JxfqZttPRzma2Y0L79svMbD45MlDAhGHFh9TdNi32lK7hBTqX6cbdS yHXif0TBuo9t5vPcYl65uQVHjO6fa5r6mnJmujwzpw5fWPbGCi8C+chpB4AmwIJIf3y2 68pHgAgEDXQOY7nIjSjpwWK8EojqFWSUdDLIiVuxRe4bUnPkupUzpliFuce+1NRwfoiH F2wws8GjSxt7BQUMtQJk7JGRzjAByGyLTfMDzyklwYpcgOVnF2FLAkZQuWdlWCU6VP8b ISdw== 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=a/sfnUxIZlp3oWSX8x+hFo4KbzNqcnLq0ZydDRgiTc8=; b=lF3fIgskaMtsKrujQLtwD1wh84peDnbHLQo/0x0+7hXUlz/tLLTu/DkjrzSMX/58Tg U6CS+q2hOvBzUss9sA09E2IgnHVEzcmW6EOfEdvcw6bnbJynYLbQymKGYeaQ7QdM1gvP uEUKhkIsBQvoI2/mXKoUE2i0Nqb3fa7imB4vpi0yzeoY7NlHB/ThFHqa6um2T5CImBmA wP+Gr+bIPTeYyyZ03Pc0/8FAR8lWixP6XrldmNGpl/Z4UAyHLoEwO58TPNl1p3qycScY O6slCfFlhf4PnOm8UKTUFJ5dLOyK0ZE61dryc9d3nAeQqwmyB/wvRoolohKnBnWeYy5t vM3A== 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 j140si11546038ioj.384.2017.10.12.10.03.07; Thu, 12 Oct 2017 10:03:11 -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 A854660BFB; Thu, 12 Oct 2017 17:03:07 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED 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 511D160A46; Thu, 12 Oct 2017 17:01:42 +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 D35576097C; Thu, 12 Oct 2017 17:01:31 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id 4F4B46064C for ; Thu, 12 Oct 2017 17:00:59 +0000 (UTC) Received: from mxback16j.mail.yandex.net (mxback16j.mail.yandex.net [IPv6:2a02:6b8:0:1619::92]) by forward103o.mail.yandex.net (Yandex) with ESMTP id 180715880F1C for ; Thu, 12 Oct 2017 20:00:51 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback16j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id LKfWKIXczp-0pHClsnW; Thu, 12 Oct 2017 20:00:51 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id jEAUUqMMpg-0om4qwqo; Thu, 12 Oct 2017 20:00:50 +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, 12 Oct 2017 20:00:04 +0300 Message-Id: <1507827605-6030-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507827605-6030-1-git-send-email-odpbot@yandex.ru> References: <1507827605-6030-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 229 Subject: [lng-odp] [PATCH v1 2/3] example: traffic_mgmt add clean termination path 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 example aborted on exit due to missing termination path (exit terminated fd_server which signaled app on the exit from main.) https://bugs.linaro.org/show_bug.cgi?id=3024 Signed-off-by: Maxim Uvarov --- /** Email created from pull request 229 (muvarov:master_bug3024) ** https://github.com/Linaro/odp/pull/229 ** Patch: https://github.com/Linaro/odp/pull/229.patch ** Base sha: b529f843814f70068de2090e02df632113afa800 ** Merge commit sha: b5f6031413a826cccfaa4468b62e2f3e90a12fff **/ example/traffic_mgmt/odp_traffic_mgmt.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/example/traffic_mgmt/odp_traffic_mgmt.c b/example/traffic_mgmt/odp_traffic_mgmt.c index c83b61522..1f1102ddf 100644 --- a/example/traffic_mgmt/odp_traffic_mgmt.c +++ b/example/traffic_mgmt/odp_traffic_mgmt.c @@ -766,12 +766,13 @@ int main(int argc, char *argv[]) rc = odp_init_global(&instance, &ODP_INIT_PARAMS, NULL); if (rc != 0) { printf("Error: odp_init_global() failed, rc = %d\n", rc); - abort(); + return -1; } + rc = odp_init_local(instance, ODP_THREAD_CONTROL); if (rc != 0) { printf("Error: odp_init_local() failed, rc = %d\n", rc); - abort(); + return -1; } if (process_cmd_line_options(argc, argv) < 0) @@ -793,5 +794,30 @@ int main(int argc, char *argv[]) pkts_into_tm, pkts_from_tm); odp_tm_stats_print(odp_tm_test); + + rc = odp_pool_destroy(odp_pool); + if (rc != 0) { + printf("Error: odp_pool_destroy() failed, rc = %d\n", rc); + return -1; + } + + rc = odp_tm_destroy(odp_tm_test); + if (rc != 0) { + printf("Error: odp_tm_destroy() failed, rc = %d\n", rc); + return -1; + } + + rc = odp_term_local(); + if (rc != 0) { + printf("Error: odp_term_local() failed, rc = %d\n", rc); + 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); + return 0; }