From patchwork Mon Nov 20 15: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: 119288 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3962318qgn; Mon, 20 Nov 2017 07:01:46 -0800 (PST) X-Google-Smtp-Source: AGs4zMbx8OiPI+va/NrWUoIrt/XEgYpOPiExZXpy75hB83MtfXxf5F+oO5DwRZsurxmHEvd6cUAd X-Received: by 10.200.45.168 with SMTP id p37mr21713652qta.247.1511190106338; Mon, 20 Nov 2017 07:01:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511190106; cv=none; d=google.com; s=arc-20160816; b=gPfRxiHdjbMuR3olyIXE04Wb83GU3i8qo/hDe32a3Cs983nv1QXy0r/GR6sanD7N4G c4eSymYF/hdOtqkVNr0rf4AipJG6xQLDb0DXNedFNUN86jtGthVsjiF8GOdVtYEOz4Jw E0dcKy9YS/KJYSl+XdtVUZMDqX0JO9YGqT34IaKc1P4QRtnCDYf1cVKnekvpMP+k9n8y QTugXjIJMyo46vkLboeKs0QuW122QzETJW7L3ymnXYn3ZwcD2P8diFJQ8nQMuF4q5N2M x525sOa+R7Y/awjRCmjpGU1zHWPiaOqeuFstL/BDoNQ/6AUJjpkEE1aBHrm4fZ80DX8Y jyDQ== 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=PbYOaYFF1/JKZdVasGFPJTybU/jdzb/jz5uwKUrcpxU=; b=yoQOwhIoU1gLa3jAG5RL0kgl/e5XGwgdJyZGngdy//NuddWjvW20NjAgjYOmxqdP5/ dP8UtuRLc4ZhTBRvfgYJvBwsMF/qn+GrQZIbBfnJ04HJOS5BTZts32hlxpZxMyEZW6gM MqedvNwodepn/eZTfH1zhjN4uiAVf9vkTQLzogi2k8f+SaID4FwMyQ4BBmpL+tngd4Mp sGNSyfx5L9UzbinPrdKZUFlSTLYQL9s6lA3U9ao06TXca4R3D5cCsuWkbtwPG/3UBBro bHLpee/i18+ws6+t2bHYIw1cfdLFHDQiXOtIyyMEym3XhWH2o1jkLeu3c4GbDoqEC2Dm +e3g== 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 i65si583768qkb.21.2017.11.20.07.01.46; Mon, 20 Nov 2017 07:01:46 -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 0239E608BC; Mon, 20 Nov 2017 15:01:46 +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 03B9D605D7; Mon, 20 Nov 2017 15:00:46 +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 D71E9607A0; Mon, 20 Nov 2017 15:00:28 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 36FAE60389 for ; Mon, 20 Nov 2017 15:00:22 +0000 (UTC) Received: from mxback5o.mail.yandex.net (mxback5o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1f]) by forward105j.mail.yandex.net (Yandex) with ESMTP id B6431183A41 for ; Mon, 20 Nov 2017 18:00:20 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback5o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id GtKmxMmdUN-0EAukQrA; Mon, 20 Nov 2017 18:00:14 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id hPBG8CmQZ0-0EBKK3Un; Mon, 20 Nov 2017 18:00:14 +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, 20 Nov 2017 18:00:11 +0300 Message-Id: <1511190013-8520-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511190013-8520-1-git-send-email-odpbot@yandex.ru> References: <1511190013-8520-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 280 Subject: [lng-odp] [PATCH API-NEXT v3 1/3] example: switch to using ODP chksum API 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: Dmitry Eremin-Solenikov ODP now provides odp_chksum_ones_comp16, switch examples to use it instead of odph_chksum helper function. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 280 (lumag:chksum) ** https://github.com/Linaro/odp/pull/280 ** Patch: https://github.com/Linaro/odp/pull/280.patch ** Base sha: d4b364849c4abb4c71e0c5260e1a793ebb8dc97d ** Merge commit sha: 9fda6f107cef0c4074880995a90b30cbeac27ce8 **/ example/generator/odp_generator.c | 7 ++++--- example/ipsec/odp_ipsec_stream.c | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 912fe7e9e..e1d98539f 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -355,7 +355,7 @@ static int setup_udp_pkt(odp_packet_t pkt, odp_pktout_config_opt_t *pktout_cfg) ip->id = odp_cpu_to_be_16(seq); if (!pktout_cfg->bit.ipv4_chksum) { ip->chksum = 0; - ip->chksum = odph_chksum(ip, ODPH_IPV4HDR_LEN); + ip->chksum = ~odp_chksum_ones_comp16(ip, ODPH_IPV4HDR_LEN); } if (pktout_cfg->bit.ipv4_chksum || pktout_cfg->bit.udp_chksum) { @@ -453,7 +453,7 @@ static int setup_icmp_pkt(odp_packet_t pkt, ip->id = odp_cpu_to_be_16(seq); if (!pktout_cfg->bit.ipv4_chksum) { ip->chksum = 0; - ip->chksum = odph_chksum(ip, ODPH_IPV4HDR_LEN); + ip->chksum = ~odp_chksum_ones_comp16(ip, ODPH_IPV4HDR_LEN); } /* icmp */ @@ -466,7 +466,8 @@ static int setup_icmp_pkt(odp_packet_t pkt, memcpy(tval_d, &tval, sizeof(uint64_t)); icmp->chksum = 0; - icmp->chksum = odph_chksum(icmp, args->appl.payload + ODPH_ICMPHDR_LEN); + icmp->chksum = ~odp_chksum_ones_comp16(icmp, args->appl.payload + + ODPH_ICMPHDR_LEN); if (pktout_cfg->bit.ipv4_chksum) { odp_packet_l2_offset_set(pkt, 0); diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c index e37fbee29..bc5d572f0 100644 --- a/example/ipsec/odp_ipsec_stream.c +++ b/example/ipsec/odp_ipsec_stream.c @@ -269,7 +269,8 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, inner_ip->frag_offset = 0; inner_ip->src_addr = odp_cpu_to_be_32(stream->src_ip); inner_ip->dst_addr = odp_cpu_to_be_32(stream->dst_ip); - inner_ip->chksum = odph_chksum(inner_ip, sizeof(*inner_ip)); + inner_ip->chksum = ~odp_chksum_ones_comp16(inner_ip, + sizeof(*inner_ip)); data += sizeof(*inner_ip); } @@ -290,7 +291,7 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, /* Close ICMP */ icmp->chksum = 0; - icmp->chksum = odph_chksum(icmp, data - (uint8_t *)icmp); + icmp->chksum = ~odp_chksum_ones_comp16(icmp, data - (uint8_t *)icmp); /* Close ESP if specified */ if (esp) {