From patchwork Fri Dec 15 13:00:10 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: 122085 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp436918qgn; Fri, 15 Dec 2017 05:00:26 -0800 (PST) X-Google-Smtp-Source: ACJfBov1bGrotZhE2d8oa5JBndtHSyu9OTL2T/pEUGxiCsn24lFAaD2T8zm7Ljwdp8Bt8L7yV2jQ X-Received: by 10.200.44.154 with SMTP id 26mr21067759qtw.186.1513342825934; Fri, 15 Dec 2017 05:00:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513342825; cv=none; d=google.com; s=arc-20160816; b=TA/AkEc86QqXVpuasomzQfkRw1RRcZJibKswYo1wxBTG8SoYjugVb7XTjAmFaF7NY+ mrzM84qV5yYl54tmYtXutAfxw2/Ck8QykHIf1ZbZA6UPYZ17rxx/PTgOvSd2jiZeUXq+ m9suvvJmbE7RevlemE2geKydGe2PJ1AKsHmV+fg6jktyAWi9iHuW1OhPowUCC1Ln5er2 +1rvp3a9r/JuIkMb/CfGSIsZ7TU7UG/EyVDbrKb0cizVVPpr+qcposYNtAMyRUzyOxmA ypF9YLDXQAETwLRHgms3+Yvz/ioUmnCOWWve58jl5k6p6/kSy2bGWJIbIlNJLXaT0iRq 0F9A== 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=MVHBgv2g3PbdTk5o3XkjsfpsI98NnKXXPw6QB9L8118=; b=EtEj56izkjv/CoN6HwcQyRB9SNoo675BqIjJuGZxourt55no43FeMBaiZlr3JCpu0d xb0nF+DV4bQjc1klKIbqIVsTXFrCdKp5a6YORYmCS1l+ClXGlmzi6VhnHKw4sq0nOX6a SH9tdawH1kTX2QKmvkITRy9nTnVcnLd9dVmRVWK9jcRkeq/FsrI+AGui5J8wXG62AOqw otwv7O6gHXSVoWzae+gBfb34Zj5UOU3kKVjpdLRq9AFF39BM+mN5Wu6Ydu/hQzhqx+PR VceZsPRRW0W3sRsObKfSdheR/coMArAmlGPJdx5wqLPn/5COYEL9l2joE9a+ko5pkHqH hatg== 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 t16si106058qth.62.2017.12.15.05.00.25; Fri, 15 Dec 2017 05:00:25 -0800 (PST) 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 248E660926; Fri, 15 Dec 2017 13:00:25 +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,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 3BCF2608E9; Fri, 15 Dec 2017 13:00:20 +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 0A568608FF; Fri, 15 Dec 2017 13:00:16 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id A66EA606A7 for ; Fri, 15 Dec 2017 13:00:14 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward100o.mail.yandex.net (Yandex) with ESMTP id 71D4A2A219FE for ; Fri, 15 Dec 2017 16:00:13 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id bctwIfD4pw-0DqavXrW; Fri, 15 Dec 2017 16:00:13 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 9445s1E51K-0CDuBfak; Fri, 15 Dec 2017 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: Fri, 15 Dec 2017 16:00:10 +0300 Message-Id: <1513342811-4728-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513342811-4728-1-git-send-email-odpbot@yandex.ru> References: <1513342811-4728-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 343 Subject: [lng-odp] [PATCH v2 1/2] example: generator: add configuration option for RX burst size 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: Bogdan Pricope Add CLI option to configure RX burst size. Bigger RX burst size may increase packet RX rate. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 343 (bogdanPricope:generator_rx_direct_pr) ** https://github.com/Linaro/odp/pull/343 ** Patch: https://github.com/Linaro/odp/pull/343.patch ** Base sha: 6b5cdc77eb9759a2349b10372a964648559bc92c ** Merge commit sha: d3f54aff752fe7ae7f51c4caa2f714dc659dd7a5 **/ example/generator/odp_generator.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 861e98369..956161a61 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -28,7 +28,8 @@ #define DEFAULT_PKT_INTERVAL 1000 /* Interval between each packet */ #define DEFAULT_UDP_TX_BURST 16 #define MAX_UDP_TX_BURST 512 -#define MAX_RX_BURST 32 +#define DEFAULT_RX_BURST 32 +#define MAX_RX_BURST 512 #define APPL_MODE_UDP 0 /**< UDP mode */ #define APPL_MODE_PING 1 /**< ping mode */ @@ -79,6 +80,8 @@ typedef struct { each packet */ int udp_tx_burst; /**< number of udp packets to send with one API call */ + int rx_burst; /**< number of packets to receive with one + API call */ odp_bool_t csum; /**< use platform csum support if available */ } appl_args_t; @@ -129,6 +132,7 @@ typedef struct { /** Global arguments */ int thread_cnt; int tx_burst_size; + int rx_burst_size; } args_t; /** Global pointer to args */ @@ -819,11 +823,13 @@ static int gen_recv_thread(void *arg) odp_packet_t pkts[MAX_RX_BURST], pkt; odp_event_t events[MAX_RX_BURST]; int pkt_cnt, ev_cnt, i; + int burst_size; interface_t *itfs, *itf; thr = odp_thread_id(); thr_args = (thread_args_t *)arg; itfs = thr_args->rx.ifs; + burst_size = args->rx_burst_size; printf(" [%02i] created mode: RECEIVE\n", thr); odp_barrier_wait(&barrier); @@ -834,7 +840,7 @@ static int gen_recv_thread(void *arg) /* Use schedule to get buf from any input queue */ ev_cnt = odp_schedule_multi(NULL, ODP_SCHED_NO_WAIT, - events, MAX_RX_BURST); + events, burst_size); if (ev_cnt == 0) continue; for (i = 0, pkt_cnt = 0; i < ev_cnt; i++) { @@ -1074,12 +1080,16 @@ int main(int argc, char *argv[]) args->thread_cnt = num_workers; /* Burst size */ - if (args->appl.mode == APPL_MODE_PING) + if (args->appl.mode == APPL_MODE_PING) { args->tx_burst_size = 1; - else if (args->appl.mode == APPL_MODE_UDP) + args->rx_burst_size = 1; + } else if (args->appl.mode == APPL_MODE_UDP) { args->tx_burst_size = args->appl.udp_tx_burst; - else + args->rx_burst_size = 0; + } else { args->tx_burst_size = 0; + args->rx_burst_size = args->appl.rx_burst; + } /* Create packet pool */ odp_pool_param_init(¶ms); @@ -1376,11 +1386,12 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {"interval", required_argument, NULL, 'i'}, {"help", no_argument, NULL, 'h'}, {"udp_tx_burst", required_argument, NULL, 'x'}, + {"rx_burst", required_argument, NULL, 'r'}, {"csum", no_argument, NULL, 'y'}, {NULL, 0, NULL, 0} }; - static const char *shortopts = "+I:a:b:s:d:p:i:m:n:t:w:c:x:he:f:y"; + static const char *shortopts = "+I:a:b:s:d:p:i:m:n:t:w:c:x:he:f:yr:"; /* let helper collect its own arguments (e.g. --odph_proc) */ odph_parse_options(argc, argv, shortopts, longopts); @@ -1391,6 +1402,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) appl_args->timeout = -1; appl_args->interval = DEFAULT_PKT_INTERVAL; appl_args->udp_tx_burst = DEFAULT_UDP_TX_BURST; + appl_args->rx_burst = DEFAULT_RX_BURST; appl_args->srcport = 0; appl_args->dstport = 0; appl_args->csum = 0; @@ -1533,6 +1545,14 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) exit(EXIT_FAILURE); } break; + case 'r': + appl_args->rx_burst = atoi(optarg); + if (appl_args->rx_burst > MAX_RX_BURST) { + EXAMPLE_ERR("wrong Rx burst size (max %d)\n", + MAX_RX_BURST); + exit(EXIT_FAILURE); + } + break; case 'y': appl_args->csum = 1; @@ -1623,6 +1643,7 @@ static void usage(char *progname) " -n, --count the number of packets to be send\n" " -c, --cpumask to set on cores\n" " -x, --udp_tx_burst size of UDP TX burst\n" + " -r, --rx_burst size of RX burst\n" " -y, --csum use platform checksum support if available\n" " default is disabled\n" "\n", NO_PATH(progname), NO_PATH(progname)