From patchwork Fri May 20 16:30:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 68265 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp3855492qge; Fri, 20 May 2016 08:48:43 -0700 (PDT) X-Received: by 10.140.197.5 with SMTP id s5mr4206671qha.17.1463759323161; Fri, 20 May 2016 08:48:43 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id n134si12063227qka.10.2016.05.20.08.48.42; Fri, 20 May 2016 08:48:43 -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 C108C615F3; Fri, 20 May 2016 15:48:42 +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 CA8D3617F1; Fri, 20 May 2016 15:34:44 +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 36EF761866; Fri, 20 May 2016 15:34:41 +0000 (UTC) Received: from mail-lf0-f41.google.com (mail-lf0-f41.google.com [209.85.215.41]) by lists.linaro.org (Postfix) with ESMTPS id 9B707617F1 for ; Fri, 20 May 2016 15:32:17 +0000 (UTC) Received: by mail-lf0-f41.google.com with SMTP id e130so16103538lfe.3 for ; Fri, 20 May 2016 08:32:17 -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:in-reply-to :references; bh=SvNNg+xbpf3HUzLWGNOudcL+a3/+mNazeFDUpQMIcXM=; b=UQPdvOm9xbm3czy4b5/d3ubIj8BWTlGtRv0RB9mbgbK60KXX/lqqXdgWhttmDXSVtQ KmyGCkmkOMmx4Ffkm8XxDi6v6AEwiaBY0E+lvRGStGQRllh5WK8Q/SGIssGZE1tjHWvP Zx5rwfIstz1XhK47icHUsDY7vAEv/5XRBps0NFcofBNjh/9gfKc5fjGKZVrS/ApfAwtV xUPsIOeGdxCPCQHCAuKrZ2dVjUnGH/8PaBZh1BLKQS+JHlNfR6SQnmZGTomjO8+SrUQf 2ntwBV8koKEv5b3tacxFiIqhAuTCy/YCwjC5J5ihOSStfMihrLo9S70dM7C2fqZoUEoa hWyw== X-Gm-Message-State: AOPr4FXwXf1JjwzJCf6Ac/nXTjGp5JnTjQAg7UCaM/Gv09xShQxRtHZg7nWUBSjqKRqdJygzeeg= X-Received: by 10.25.135.5 with SMTP id j5mr1394755lfd.15.1463758335021; Fri, 20 May 2016 08:32:15 -0700 (PDT) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id tg1sm3348847lbb.7.2016.05.20.08.32.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 May 2016 08:32:13 -0700 (PDT) From: Christophe Milard To: maxim.uvarov@linaro.com, lng-odp@lists.linaro.org Date: Fri, 20 May 2016 18:30:30 +0200 Message-Id: <1463761851-37121-15-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463761851-37121-1-git-send-email-christophe.milard@linaro.org> References: <1463761851-37121-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv9 14/35] performance: odp_l2fwd: adding helper cmd line parsing 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" odp_l2fwd now calls the helper command line parsing so that helper can collect its options. Hence enabling process mode run. Signed-off-by: Christophe Milard --- test/performance/odp_l2fwd.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 9a8d578..e38e6f8 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -1051,7 +1051,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) char *addr_str; size_t len; int i; - static struct option longopts[] = { + static const struct option longopts[] = { {"count", required_argument, NULL, 'c'}, {"time", required_argument, NULL, 't'}, {"accuracy", required_argument, NULL, 'a'}, @@ -1066,15 +1066,21 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {NULL, 0, NULL, 0} }; + static const char *shortopts = "+c:+t:+a:i:m:o:r:d:s:e:h"; + + /* let helper collect its own arguments (e.g. --odph_proc) */ + odph_parse_options(argc, argv, shortopts, longopts); + appl_args->time = 0; /* loop forever if time to run is 0 */ appl_args->accuracy = 1; /* get and print pps stats second */ appl_args->dst_change = 1; /* change eth dst address by default */ appl_args->src_change = 1; /* change eth src address by default */ appl_args->error_check = 0; /* don't check packet errors by default */ + opterr = 0; /* do not issue errors on helper options */ + while (1) { - opt = getopt_long(argc, argv, "+c:+t:+a:i:m:o:r:d:s:e:h", - longopts, &long_index); + opt = getopt_long(argc, argv, shortopts, longopts, &long_index); if (opt == -1) break; /* No more options */