From patchwork Thu Dec 7 13:00:05 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: 120966 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp8323729qgn; Thu, 7 Dec 2017 05:02:04 -0800 (PST) X-Google-Smtp-Source: AGs4zMbgROfPJZDtaSge/0KUYv+oG2yvMsSuQwupFP56hkWH4qn6+TCRv9jkcJnfs5P3nu6buIFt X-Received: by 10.55.12.135 with SMTP id 129mr8440133qkm.137.1512651724803; Thu, 07 Dec 2017 05:02:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512651724; cv=none; d=google.com; s=arc-20160816; b=iL5e2OIS2DEV/aiOM25ciaYqrSmhH9ZfaNJDI+reVyMGZiip6B4E5iGr0RUFVVSQ9m xLSOBioFHoagJZGRUSSUrl4Nz+5B5xoZg0YjU7oIGRa3z8OKd+Ta6rMBB92xmpsjZ+st ZnXaUjc1RAulFrA6MeMiwe3AwQa4k2ylbHy13BHhJeC+2v6zYdw5T+KO2w5wQeePwEV4 KTSYRLE2YF3V0iD8er1HWbcCTBOqQIswtZb0wCxCvYSyrHJJPsZ5YQbEeWiIvLohza5T B7+LVxPLl1Ed/HnWMxQzQpYcmovRzMd/yEY0qZh7wBWhDxziEp7f/059t1WsSyG7hShW QOPw== 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=izRUukjXYyiE7eddvaUqOqd0rfEZLinAS2yRsYoyAlo=; b=IBG1y8fLPfLro6umHDCUVM13zfNtRDvZd9PHFbhYZQVdK4vROdMqH6owIRGnQGKmSV PEE6anGxgqAQ0hqkjdruH/077u9E0qTlkJaIiQ4WRasxYfM/nyFaPKumuixl7DfNtMIy MZBBTLaqccvu47iXCcx2v55o5idxRz2y8CQzuJTTWJvD9BPFHcihyPQpOERUXbYXul5r yq32QSeUpK9ulOU68dpjb/DnsNEo9i4SVoi4ob4I0gmq70CwUSNBXhm+61zsaLzbawsR 87wL44LLDi/g8PyiEGXbKVE/IuGDpWhMlG8MNz2cekmF9RD72IVqFNfrcjR9GrsrlT8r 529Q== 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 g27si3444263qtb.187.2017.12.07.05.02.04; Thu, 07 Dec 2017 05:02:04 -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 69E7B6091D; Thu, 7 Dec 2017 13:02:04 +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_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 2487F60926; Thu, 7 Dec 2017 13:00: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 A80596091D; Thu, 7 Dec 2017 13:00:18 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id 154EA6065D for ; Thu, 7 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 A91742A24227 for ; Thu, 7 Dec 2017 16:00:12 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 3shDH6gVPk-0CXKdtOI; Thu, 07 Dec 2017 16:00:12 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 5HyJRBoKQy-0BQmlNSN; Thu, 07 Dec 2017 16:00:11 +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: Thu, 7 Dec 2017 16:00:05 +0300 Message-Id: <1512651606-28483-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512651606-28483-1-git-send-email-odpbot@yandex.ru> References: <1512651606-28483-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 327 Subject: [lng-odp] [PATCH v1 3/4] 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 --- /** Email created from pull request 327 (bogdanPricope:master_update_generator_pr) ** https://github.com/Linaro/odp/pull/327 ** Patch: https://github.com/Linaro/odp/pull/327.patch ** Base sha: 811281a22b6274b7f41b926a9cfbe09e48a366bd ** Merge commit sha: 9edce40a148dd5654384464f71ff62c58d5105fa **/ 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) ); }