From patchwork Wed Jun 3 18:02:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 49494 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EBDB020DDC for ; Wed, 3 Jun 2015 18:02:56 +0000 (UTC) Received: by labpg10 with SMTP id pg10sf5182568lab.2 for ; Wed, 03 Jun 2015 11:02:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=YBbc5lejYdakWb9qyuIxYja/M1yz1M6xKOrLX9ZFxJI=; b=WnJFhLPgrXV1nv28KbLcyQ5K0NoPthgxrZ2oU4wE6OhPJp15f1H6jhGOwO4tbb27/B XtAcq0qyvjZodUxUZIi0Sv3zAnNtOS+AlXsLFvwFANuzq8P6x67aoAOR1pSgdhn0VHct VOlTxCp+2s8nl849lRTZ44BvXr/xNTDCP/bP+Z4Mekxs2MGAG5yDbbfELCqlHT5ChIkS OMyANSW2Mx/bY8kim3bNGcOeVDMP6dJWG6jMrTHXf9sAF/ZB3/BDR0MKEXrBI43y8GKn 4bjvS3eQ0vAfPV5rrJPXrbJBbhzFu0C6HiAhZDQJT91XRNnQhKomYjAnBVgwCv3Q/wzi dfpg== X-Gm-Message-State: ALoCoQkGUs0XxcTvRRsgX5V0xms7nyCbdz9R3qIyjV6B6rAx1VQV66dvKla4T9WbZfsiw+xcLjaw X-Received: by 10.112.203.168 with SMTP id kr8mr31822539lbc.10.1433354575911; Wed, 03 Jun 2015 11:02:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.105 with SMTP id bf9ls95004lab.103.gmail; Wed, 03 Jun 2015 11:02:55 -0700 (PDT) X-Received: by 10.112.83.135 with SMTP id q7mr33697539lby.13.1433354575758; Wed, 03 Jun 2015 11:02:55 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id t8si18598275lae.163.2015.06.03.11.02.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jun 2015 11:02:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by labko7 with SMTP id ko7so14418165lab.2 for ; Wed, 03 Jun 2015 11:02:55 -0700 (PDT) X-Received: by 10.152.37.228 with SMTP id b4mr10837827lak.117.1433354575619; Wed, 03 Jun 2015 11:02:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp4046405lbb; Wed, 3 Jun 2015 11:02:54 -0700 (PDT) X-Received: by 10.229.185.68 with SMTP id cn4mr39236938qcb.12.1433354573879; Wed, 03 Jun 2015 11:02:53 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a83si1334413qkh.109.2015.06.03.11.02.51; Wed, 03 Jun 2015 11:02:53 -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; Received: by lists.linaro.org (Postfix, from userid 109) id 2CB9B61FC1; Wed, 3 Jun 2015 18:02:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal 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 ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 141EE61E2E; Wed, 3 Jun 2015 18:02:47 +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 DC27761C93; Wed, 3 Jun 2015 18:02:44 +0000 (UTC) Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com [74.125.82.42]) by lists.linaro.org (Postfix) with ESMTPS id ECEBF61C93 for ; Wed, 3 Jun 2015 18:02:43 +0000 (UTC) Received: by wgv5 with SMTP id 5so15815291wgv.1 for ; Wed, 03 Jun 2015 11:02:43 -0700 (PDT) X-Received: by 10.180.99.69 with SMTP id eo5mr42801899wib.92.1433354563143; Wed, 03 Jun 2015 11:02:43 -0700 (PDT) Received: from localhost.localdomain ([90.152.119.35]) by mx.google.com with ESMTPSA id hn7sm2724237wib.5.2015.06.03.11.02.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Jun 2015 11:02:42 -0700 (PDT) From: Zoltan Kiss To: lng-odp@lists.linaro.org Date: Wed, 3 Jun 2015 19:02:28 +0100 Message-Id: <1433354548-30651-1-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCH v2] odp_l2fwd: add unidirectional test X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zoltan.kiss@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 If you want to test traffic going only in one direction, you might be better off with one thread for a pair of interfaces. Signed-off-by: Zoltan Kiss --- test/performance/odp_l2fwd.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 5d4b833..0cb6e55 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -71,6 +71,7 @@ typedef struct { int cpu_count; int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ + int unidir; /**< Unidirectional test */ int mode; /**< Packet IO mode */ int time; /**< Time in seconds to run. */ int accuracy; /**< Number of seconds to get and print statistics */ @@ -397,9 +398,11 @@ int main(int argc, char *argv[]) printf("first CPU: %i\n", odp_cpumask_first(&cpumask)); printf("cpu mask: %s\n", cpumaskstr); - if (num_workers < gbl_args->appl.if_count) { - LOG_ERR("Error: CPU count %d less than interface count\n", - num_workers); + if (num_workers < gbl_args->appl.if_count || + (gbl_args->appl.unidir && + num_workers * 2 < gbl_args->appl.if_count)) { + LOG_ERR("Error: CPU count %d not enough for %d interface\n", + num_workers, gbl_args->appl.if_count); exit(EXIT_FAILURE); } if (gbl_args->appl.if_count % 2 != 0) { @@ -446,7 +449,13 @@ int main(int argc, char *argv[]) else /* APPL_MODE_PKT_QUEUE */ thr_run_func = pktio_queue_thread; - gbl_args->thread[i].src_idx = i % gbl_args->appl.if_count; + if (gbl_args->appl.unidir) + /* The first of every pair will be the ingress if */ + gbl_args->thread[i].src_idx = + (i * 2) % gbl_args->appl.if_count; + else + gbl_args->thread[i].src_idx = + i % gbl_args->appl.if_count; gbl_args->thread[i].stats = &stats[i]; odp_cpumask_zero(&thd_mask); @@ -522,6 +531,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {"time", required_argument, NULL, 't'}, {"accuracy", required_argument, NULL, 'a'}, {"interface", required_argument, NULL, 'i'}, /* return 'i' */ + {"unidir", optional_argument, NULL, 'u'}, {"mode", required_argument, NULL, 'm'}, /* return 'm' */ {"help", no_argument, NULL, 'h'}, /* return 'h' */ {NULL, 0, NULL, 0} @@ -530,6 +540,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) appl_args->time = 0; /* loop forever if time to run is 0 */ appl_args->accuracy = 1; /* get and print pps stats second */ appl_args->mode = -1; /* Invalid, must be changed by parsing */ + appl_args->unidir = 0; /* Do bidirectional tests by default */ while (1) { opt = getopt_long(argc, argv, "+c:+t:+a:i:m:h", @@ -589,6 +600,10 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) } break; + case 'u': + appl_args->unidir = 1; + break; + case 'm': i = atoi(optarg); if (i == 0) @@ -667,6 +682,8 @@ static void usage(char *progname) "\n" "Mandatory OPTIONS:\n" " -i, --interface Eth interfaces (comma-separated, no spaces)\n" + " -u, --unidir Unidirectional test, first in the pair of\n" + " interfaces above is the source\n" " -m, --mode 0: Burst send&receive packets (no queues)\n" " 1: Send&receive packets through ODP queues.\n" "\n"