From patchwork Thu Nov 9 09:00:17 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: 118399 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6331303qgn; Thu, 9 Nov 2017 01:01:32 -0800 (PST) X-Google-Smtp-Source: ABhQp+QMYYG/aDMGkhcKU1Zbt/mufGMPzgR/Ti/k/WZrkWF0pOgcau7DkBXoZJ7KSEgDYKwP8ZLn X-Received: by 10.107.160.148 with SMTP id j142mr4006113ioe.236.1510218092003; Thu, 09 Nov 2017 01:01:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510218091; cv=none; d=google.com; s=arc-20160816; b=EfiMteoD/34QvMW3IGm9V8abNTfdfsZg7CcJ6ugWBaLNBeDBYwyb6UKQH8ciF6vXla 8HE088hwofqrGAebAqviWveYDjsnmwxFzvw6EZVTAWCIihletmIuEu85eYf5w9I/oHXb HpgEz0gtNkHfjpW3Xj3HZTRscXYLcWCuHlfNfll0eH+uknIhcvYMBUoWEjmNqSyd1TKF rj5WiuKdcKvRsBG8cxzLmHl/QAOD8Ff1wLc2oOorDsSt6kkQKoIvWtvOMLYcbBIMDKlz 8ci9T8dCpkoMXd8jvckC6lB+mM+JOT8+Y9qTCB/7vFyCRSvb1k58hoIr3fLcI6KYH/co /raA== 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=iL20DVgFzb2YlayTqpuiTJTtZAG1rrQXW4s92YKKWug=; b=dsyXKmi45r0cl5LhIuvpwJC9VQNfGvU/S5IzMXzxS6qhtxcfhP/ZMAzFxfX6K2Rnqt fmMV7UcPp5VuTV6DTRJfz+SVEHbPKH24jWbvyV3Qcqsliy6MIVAJQlWpotI3+VP+I839 QlbDs5EisfjFD089u4+oKWSZS+Hd62u2ez+qS14pe1yHI/bc9vdyqG9khrfAR1DR7FQA MPvwpfNO5d+GWkrcHoXa4tI+qACJossCmGr2XybG7CvwMsGpjcVzsZKciimc3MfwtasV vKYurogSuX6DQg+jvcE23XDMETAADeWeTdaDkqGudVbVz24D//aw6cloD5xBuoW7JxNy aA/w== 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 x187si5875961itb.32.2017.11.09.01.01.31; Thu, 09 Nov 2017 01:01:31 -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 74376607BA; Thu, 9 Nov 2017 09:01:31 +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 594FC607F6; Thu, 9 Nov 2017 09:00:41 +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 21ABE60630; Thu, 9 Nov 2017 09:00:31 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id A38B360594 for ; Thu, 9 Nov 2017 09:00:26 +0000 (UTC) Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 1F8166A8424E for ; Thu, 9 Nov 2017 12:00:25 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id SjWKs6nQWt-0O54emcu; Thu, 09 Nov 2017 12:00:24 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id AXFYGb2yvs-0Ot4UPrY; Thu, 09 Nov 2017 12:00:24 +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, 9 Nov 2017 12:00:17 +0300 Message-Id: <1510218017-21165-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510218017-21165-1-git-send-email-odpbot@yandex.ru> References: <1510218017-21165-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 269 Subject: [lng-odp] [PATCH API-NEXT v2 4/4] example: generator: use L3/L4 checksum validation status functions 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 Update odp_generator example application to use L3/L4 checksum validation status functions. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 269 (bogdanPricope:api_next_csum_status_pr) ** https://github.com/Linaro/odp/pull/269 ** Patch: https://github.com/Linaro/odp/pull/269.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 31b12178be4753494e806513020d7706600c8382 **/ example/generator/odp_generator.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 771bd1a2e..912fe7e9e 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -784,15 +784,13 @@ static void print_pkts(int thr, odp_packet_t pkt_tbl[], unsigned len) static int gen_recv_thread(void *arg) { int thr; - thread_args_t *thr_args; odp_packet_t pkts[MAX_RX_BURST], pkt; odp_event_t events[MAX_RX_BURST]; int pkt_cnt, ev_cnt, i; - interface_t *itfs, *itf; + odp_packet_chksum_status_t csum_status; + (void)arg; thr = odp_thread_id(); - thr_args = (thread_args_t *)arg; - itfs = thr_args->rx.ifs; printf(" [%02i] created mode: RECEIVE\n", thr); odp_barrier_wait(&barrier); @@ -811,21 +809,14 @@ static int gen_recv_thread(void *arg) continue; for (i = 0, pkt_cnt = 0; i < ev_cnt; i++) { pkt = odp_packet_from_event(events[i]); - itf = &itfs[odp_pktio_index(odp_packet_input(pkt))]; - if (odp_packet_has_ipv4(pkt)) { - if (itf->config.pktin.bit.ipv4_chksum) { - if (odp_packet_has_l3_error(pkt)) - printf("HW detected L3 error\n"); - } - } + csum_status = odp_packet_l3_chksum_status(pkt); + if (csum_status == ODP_PACKET_CHKSUM_BAD) + printf("L3 checksum error detected.\n"); - if (odp_packet_has_udp(pkt)) { - if (itf->config.pktin.bit.udp_chksum) { - if (odp_packet_has_l4_error(pkt)) - printf("HW detected L4 error\n"); - } - } + csum_status = odp_packet_l4_chksum_status(pkt); + if (csum_status == ODP_PACKET_CHKSUM_BAD) + printf("L4 checksum error detected.\n"); /* Drop packets with errors */ if (odp_unlikely(odp_packet_has_error(pkt))) {