From patchwork Mon Dec 11 16:00:11 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: 121430 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2982700qgn; Mon, 11 Dec 2017 08:10:18 -0800 (PST) X-Google-Smtp-Source: ACJfBosLofuGuqenDudFaU1Rw5s7MjjPQKFuk8qKO3W7nGasOGOrceazHiaXHPTusTJal6cIffBr X-Received: by 10.55.20.156 with SMTP id 28mr1186808qku.253.1513008618870; Mon, 11 Dec 2017 08:10:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513008618; cv=none; d=google.com; s=arc-20160816; b=EL3H1dzGlE9G1XgCItXrobr2fZ4TDCiUjncCgI2GXWawzEvTsMygUHHXEXsI2jODrH 0sovRVKOuURX+/nblwjtIlucPy6RE2FnDHNg9TgZ8dS5tRsu1i5Emc45t3kZoVQojBuM 8Ox0xxhldJ5TtT5j9wLU95gF4VnYrFcQZmsj1xbRCITxOs6R+0BpC5uJZS8OTDz2rVOI 48G3BjC3Ng0zSz8NTAvxEnXvqT3KPGxWTo2qRNQ4fhi/MUWIZXUO8h++z40lPkDduRv2 C21RSBx4dlsin1v/YdIeqvn8k5ZUFO1GOtjxSShHR/ZbdtuhwpvhfYnnElZR8V3LOapX eK5A== 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=rogLnlYvwCUFSCEzrAjLFws+cNljWsMxUvQCMqvF4zw=; b=ZqxgEziqZebwFNvN1z4GOofIrxi/tZuE8lxkFbA7KzGZmJzVtyVQTYqVTd8GppQT1j 20Yu6GAqBiKHeB3ZX9o7TRa5nvLwAyeAQzHLsedBw261WaMLolvZxOl84ffs3WtghvM6 094BxI8yTct+9T6gAnV4V0G4xxjweAePctsJLhQR+5Inxd6ApsulTX+eZEqvlfTMOsTY lQUlcLYa3B1uAqd5Nge39RyFiIqsj098zMCJM+k9ZJ0NA963Wamun6rqgsJImVLijj+M rRrNp4GJcSpEGgDuqFvHQyV748lAims8eohdX9EaNcsDqcPWOU5IPaz7aoUyffBA4Zfc sTjw== 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 u78si12362761qkl.203.2017.12.11.08.10.18; Mon, 11 Dec 2017 08:10:18 -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 68D846097A; Mon, 11 Dec 2017 16:10:18 +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 E4C75609B3; Mon, 11 Dec 2017 16:01:30 +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 2DC586095D; Mon, 11 Dec 2017 16:00:40 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 280F360956 for ; Mon, 11 Dec 2017 16:00:22 +0000 (UTC) Received: from mxback11j.mail.yandex.net (mxback11j.mail.yandex.net [IPv6:2a02:6b8:0:1619::84]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 81E732D8234B for ; Mon, 11 Dec 2017 19:00:20 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback11j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id YpLcaapVus-0K7a65IS; Mon, 11 Dec 2017 19:00:20 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id BifhbGdIDb-0JT8f8q1; Mon, 11 Dec 2017 19:00:20 +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: Mon, 11 Dec 2017 19:00:11 +0300 Message-Id: <1513008012-9231-14-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513008012-9231-1-git-send-email-odpbot@yandex.ru> References: <1513008012-9231-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 335 Subject: [lng-odp] [PATCH API-NEXT v1 13/14] example: generator: add configuration option for csum support 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 configuration option to enable platform checksum support (if available) for calculation and validation. By default, checksum calculation is performed in software and validation is disabled. Signed-off-by: Bogdan Pricope Reviewed-by: Ilias Apalodimas Signed-off-by: Maxim Uvarov --- /** Email created from pull request 335 (muvarov:devel/api-next_master_merge) ** https://github.com/Linaro/odp/pull/335 ** Patch: https://github.com/Linaro/odp/pull/335.patch ** Base sha: 630d8422564ebf4991b468cb38a29e9483fc2ec2 ** Merge commit sha: 2de2af9eca01b713e51c66fee7a5c7e535502f85 **/ example/generator/odp_generator.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 47b91d6ef..0a81cdeb3 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -76,6 +76,7 @@ typedef struct { each packet */ int udp_tx_burst; /**< number of udp packets to send with one API call */ + odp_bool_t csum; /**< use platform csum support if available */ } appl_args_t; /** @@ -516,14 +517,26 @@ static int create_pktio(const char *dev, odp_pool_t pool, return -1; } odp_pktio_config_init(&itf->config); - itf->config.pktin.bit.ipv4_chksum = capa.config.pktin.bit.ipv4_chksum; - itf->config.pktin.bit.udp_chksum = capa.config.pktin.bit.udp_chksum; - itf->config.pktin.bit.drop_ipv4_err = - capa.config.pktin.bit.drop_ipv4_err; - itf->config.pktin.bit.drop_udp_err = capa.config.pktin.bit.drop_udp_err; - - itf->config.pktout.bit.ipv4_chksum = capa.config.pktout.bit.ipv4_chksum; - itf->config.pktout.bit.udp_chksum = capa.config.pktout.bit.udp_chksum; + if (args->appl.csum) { + itf->config.pktin.bit.ipv4_chksum = + capa.config.pktin.bit.ipv4_chksum; + itf->config.pktin.bit.udp_chksum = + capa.config.pktin.bit.udp_chksum; + itf->config.pktin.bit.drop_ipv4_err = + capa.config.pktin.bit.drop_ipv4_err; + itf->config.pktin.bit.drop_udp_err = + capa.config.pktin.bit.drop_udp_err; + + itf->config.pktout.bit.ipv4_chksum = + capa.config.pktout.bit.ipv4_chksum; + itf->config.pktout.bit.udp_chksum = + capa.config.pktout.bit.udp_chksum; + } else { /* explicit disable */ + itf->config.pktin.bit.ipv4_chksum = 0; + itf->config.pktin.bit.udp_chksum = 0; + itf->config.pktout.bit.ipv4_chksum = 0; + itf->config.pktout.bit.udp_chksum = 0; + } if (odp_pktio_config(itf->pktio, &itf->config)) { EXAMPLE_ERR("Error: Failed to set interface configuration %s\n", @@ -1299,10 +1312,11 @@ 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'}, + {"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:"; + static const char *shortopts = "+I:a:b:s:d:p:i:m:n:t:w:c:x:he:f:y"; /* let helper collect its own arguments (e.g. --odph_proc) */ odph_parse_options(argc, argv, shortopts, longopts); @@ -1315,6 +1329,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) appl_args->udp_tx_burst = DEFAULT_UDP_TX_BURST; appl_args->srcport = 0; appl_args->dstport = 0; + appl_args->csum = 0; opterr = 0; /* do not issue errors on helper options */ @@ -1455,6 +1470,9 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) } break; + case 'y': + appl_args->csum = 1; + break; case 'h': usage(argv[0]); exit(EXIT_SUCCESS); @@ -1541,6 +1559,8 @@ 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" + " -y, --csum use platform checksum support if available\n" + " default is disabled\n" "\n", NO_PATH(progname), NO_PATH(progname) ); }