From patchwork Thu Nov 2 12:00:08 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: 117808 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2075814qgn; Thu, 2 Nov 2017 05:04:50 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Txpa8FLru6rhmBB9yE6iLCZDX1T3UAReSqTkLNDxPszHmlPOtRBrv3cXrRzcg6BfEdn0D6 X-Received: by 10.55.217.29 with SMTP id u29mr4263876qki.148.1509624290116; Thu, 02 Nov 2017 05:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509624290; cv=none; d=google.com; s=arc-20160816; b=CeXRpgtYjt4YZL4IY7uaBWB+JEnwnwo9m45sNAoaU9+hqkTxedJYwAIhqBwl2xhtLN WcDVnSn0g6KhPkipfuYtBhVYTN1Y4NU7n/cd/5SQ2tN+hu+jsHa7bE/suVlyViazAJnW QbZlXWDtqSGKArJsF+r1yjteXGx1vBvRDwTTAMW3aHXnSSdijEMgk3t8qtU07lJJGOQq XdNA/HC4M12AJchxGPpbE7WTdrk/AnjTopuRdsGCdWlX2+k2dkRBZyKKcvQ6/jyMWAlg TqQ1pNj3pDa7vk4XbbnQlKnBO9BN5hQ6W7Xyq+a+ynks2Hxn4ux1DjwP/cB8SDCy1aH2 dwxQ== 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=j0JsH73gerdpkM9U6kutoOtOknB07QYCdTRR5w8/grg=; b=aKHdIx5RPnZizw9Swyae5PbjXaAVeXkBGG6HjclDV4AC/o2rDlsRRSgTP+UOdHDipX 15XIRtBrZPXVZR7fhfK2DlpO+fEq2WAg2qhPBVwL+qJfARqiS9tY+qlu0dFtQCGyc2tz 0HzrLrj8wCcj1VArTFnHK9N3jMj4EfS0FK+G5NMHZ2nRrWqyB4bkonMlLj90nwIRcmVU 2fQueuVE5mYm+U/VGJsEb9QCqEWprPHBmsHuzTd0y35eA4yYG77C7TYbv8Ftt8XRf74T m4Qpz8VQfnRld9HNF1IhH79CVgD28zwDjETRzUuwfqAJXY54q3izkFaxP0ExnRYZlz09 Fcuw== 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 p39si2936370qtc.218.2017.11.02.05.04.49; Thu, 02 Nov 2017 05:04:50 -0700 (PDT) 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 C03F961008; Thu, 2 Nov 2017 12:04:49 +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 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 E22DD60C1C; Thu, 2 Nov 2017 12:02:42 +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 8CA0C60B14; Thu, 2 Nov 2017 12:02:21 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id 8D0A260973 for ; Thu, 2 Nov 2017 12:00:14 +0000 (UTC) Received: from mxback3j.mail.yandex.net (mxback3j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10c]) by forward101j.mail.yandex.net (Yandex) with ESMTP id F1DA61244A5C for ; Thu, 2 Nov 2017 15:00:12 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback3j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id giFpGjwaBj-0CxeY3Mr; Thu, 02 Nov 2017 15:00:12 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 0qgpfauOww-0B38kx10; Thu, 02 Nov 2017 15: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, 2 Nov 2017 15:00:08 +0300 Message-Id: <1509624008-24783-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509624008-24783-1-git-send-email-odpbot@yandex.ru> References: <1509624008-24783-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 269 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7076ea1cebe42326de76e8bb07709715222f2958 **/ 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))) {