From patchwork Tue Jul 19 14:42:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 72337 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp118024qga; Tue, 19 Jul 2016 07:42:56 -0700 (PDT) X-Received: by 10.55.75.207 with SMTP id y198mr50470095qka.57.1468939376165; Tue, 19 Jul 2016 07:42:56 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j1si19704226qkf.317.2016.07.19.07.42.55; Tue, 19 Jul 2016 07:42:56 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C166A6823E; Tue, 19 Jul 2016 14:42:55 +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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 352AC67472; Tue, 19 Jul 2016 14:42:52 +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 21C25675D0; Tue, 19 Jul 2016 14:42:50 +0000 (UTC) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by lists.linaro.org (Postfix) with ESMTPS id 2B87467452 for ; Tue, 19 Jul 2016 14:42:49 +0000 (UTC) Received: by mail-lf0-f49.google.com with SMTP id b199so16437589lfe.0 for ; Tue, 19 Jul 2016 07:42:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3oxzaIYnIC2w7iXZVW69KJYJwL9Dw7PWQcUUendqECY=; b=duj5mHhqPLRKk9AMWPTjcAHYlUOdGelxP0UXIQo/H+g30jfH/OOu52J3aIm1I/BC1M 029jWa9kNNIepl+hncMVcG8FayWSt1IrM4hSpQaPHOB//pnSsmioKKoZiXHEAM+NUouq wqNLXk7fHhd6cbjPnP6w1olqiT/g2twyilIRrEH7KdprdbSIrMxMOBu+WTUe7EioLl0U 5MH+lcaZK/edHYaSkfDfxhQtEBbZQny8+ukkZoiXJUYBbC3GxIkK4HyTxZ3YbshfQEwZ HGBw+93qC0+D8HDsL0hgMizQsvbjkgGRyv9qAU0lBs+fpYDgMgmN5wuCdklN7bbz3s8y V3ZQ== X-Gm-Message-State: ALyK8tKTCO0NmWk60X7BvLhTs37drN9rz0AenkBgUushIDBpCXFdWyVaUDkln1SqV/Ujs/b+rGk= X-Received: by 10.25.126.2 with SMTP id z2mr17936302lfc.195.1468939367984; Tue, 19 Jul 2016 07:42:47 -0700 (PDT) Received: from localhost.localdomain ([83.220.238.101]) by smtp.gmail.com with ESMTPSA id m82sm5783708lfm.2.2016.07.19.07.42.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 07:42:47 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Tue, 19 Jul 2016 17:42:42 +0300 Message-Id: <1468939362-22943-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.7.1.250.gff4ea60 X-Topics: patch Subject: [lng-odp] [PATCH] example: odp_switch add 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" Signed-off-by: Maxim Uvarov --- example/switch/odp_switch.c | 19 +++++++++++++++++-- example/switch/switch_run.sh | 11 +++-------- 2 files changed, 20 insertions(+), 10 deletions(-) -- 2.7.1.250.gff4ea60 Reviewed-by: Mike Holmes diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c index c48a202..4b944fe 100644 --- a/example/switch/odp_switch.c +++ b/example/switch/odp_switch.c @@ -376,7 +376,7 @@ static int print_speed_stats(int num_workers, stats_t (*thr_stats)[MAX_PKTIOS], } while (loop_forever || (elapsed < duration)); - return rx_pkts_tot > 100 ? 0 : -1; + return rx_pkts_tot >= 100 ? 0 : -1; } /** @@ -1033,7 +1033,22 @@ int main(int argc, char **argv) free(gbl_args->appl.if_names); free(gbl_args->appl.if_str); - printf("Exit\n\n"); + if (odp_pool_destroy(gbl_args->pool)) { + printf("Error: pool destroy\n"); + exit(EXIT_FAILURE); + } + + if (odp_term_local()) { + printf("Error: term local\n"); + exit(EXIT_FAILURE); + } + + if (odp_term_global(instance)) { + printf("Error: term global\n"); + exit(EXIT_FAILURE); + } + + printf("Exit: %d\n\n", ret); return ret; } diff --git a/example/switch/switch_run.sh b/example/switch/switch_run.sh index 3f8f9db..d9aa8bd 100755 --- a/example/switch/switch_run.sh +++ b/example/switch/switch_run.sh @@ -19,15 +19,10 @@ do RX_PORTS="${RX_PORTS},pcap:out=pcapout${i}.pcap" done -./odp_switch -i pcap:in=${PCAP_IN}${RX_PORTS} & - -sleep 1 -kill $! -wait $! +./odp_switch -i pcap:in=${PCAP_IN}${RX_PORTS} -t 1 STATUS=$? - -if [ "$STATUS" -ne 143 ]; then - echo "Error: status was: $STATUS, expected 143" +if [ "$STATUS" -ne 0 ]; then + echo "Error: status was: $STATUS, expected 0" RETVAL=1 fi