From patchwork Mon Oct 23 10:00:23 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: 116673 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4459997qgn; Mon, 23 Oct 2017 03:07:48 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Srb5S1gfj21Dl0WNlzeaGzi8p3afJ+CG5bJN4D5kMw/o5JmmyPv5VEvpHkQTmqm63eK4Bc X-Received: by 10.55.50.71 with SMTP id y68mr18459487qky.136.1508753268029; Mon, 23 Oct 2017 03:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508753268; cv=none; d=google.com; s=arc-20160816; b=cfnmlbf94wFOCLRNSoKnoG5rxPGdQu3voYIHY0bmYIcz+FaE/CuYvB/FfedJmeuzn6 RaVTBXBNFy1kEmqZyvYxtBrZGsujoCvQPCiX5LZJaKSgmpViRtOqaNaslgyhC4EvKXOR KiZ7OHu178IWCqXyStMEVESFtbjxfu919IQIsrPOwsfrrWPrDt5fjuOKMTEkm9VZknKi Kcd24BekOTInVoEC7yaXmE1YwYeomW0ca2mRjdTv/kD7vdSs+SfBzQsBCHs9/EE84sXi p8yzlQcl+QXsOqe3Q2lH/A39kVCGXGNd7BScW5wYkCFqLue9Vhn79M8Khc5iDcrNEj6n en3g== 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=w4x9JTnfznqLyqquWGRZprq/8Sk//oDB4fLT9E3ONAg=; b=uoVFgvFI+0VegvfWBNZpBT1KX55AXGoH1zv7panMh+o7d/jpbR6lQQaCPCGe5f63LV pV8XnXkTyUrS1HuPCmel1PwhH0Z9rANMLiX9i/GCbKS59oSbG+4yCNyCBAQ9Ta66xdI6 bJV1mJovrTDHx1mcGDkwBXUJ3fFsnLA7HjzewS7i03IHvkQHNMK5GG3MuFWVIQDxd09m kae9w52Zskm93Nff2ip0JpvXUu+QA99hUSr/DNpTZ6lGva4RjTVIrnNzEbJE2rlFgttE KLuims7qOTXhA0l6zpH6GsYsD1gwF+1npbSDjvWogN1VsuIRbJrdLQMscCc65lDNJ8kz l0UQ== 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 k34si5879079qtb.61.2017.10.23.03.07.47; Mon, 23 Oct 2017 03:07:48 -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 B519C61D23; Mon, 23 Oct 2017 10:07:47 +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 58F2B619C5; Mon, 23 Oct 2017 10:03:31 +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 4481561DE2; Mon, 23 Oct 2017 10:03:18 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 0F37F6185A for ; Mon, 23 Oct 2017 10:00:42 +0000 (UTC) Received: from mxback5j.mail.yandex.net (mxback5j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10e]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 760074304803 for ; Mon, 23 Oct 2017 13:00:40 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback5j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Py9FE40C0G-0eF4OWu4; Mon, 23 Oct 2017 13:00:40 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id AuFEnCuXXk-0dRiekXi; Mon, 23 Oct 2017 13:00:39 +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, 23 Oct 2017 13:00:23 +0300 Message-Id: <1508752825-12017-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508752825-12017-1-git-send-email-odpbot@yandex.ru> References: <1508752825-12017-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 242 Subject: [lng-odp] [PATCH API-NEXT v2 1/3] api: packet: ones complement sum 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: Petri Savolainen Added packet metadata for ones complement sum over IP payload in a packet. Some NICs calculate the sum during packet input (at least for IP fragments) and store the value into the packet descriptor. This offloads L4 checksum calculation for IP fragments as SW does not need sum all payload data, but just combine pre-calculated sums from packet descriptors and remove extra header fields from the sum. Signed-off-by: Petri Savolainen --- /** Email created from pull request 242 (psavol:next-checksum-metadata) ** https://github.com/Linaro/odp/pull/242 ** Patch: https://github.com/Linaro/odp/pull/242.patch ** Base sha: ec6510b33e8b96d6d6670efb9dc3c9101baed6c6 ** Merge commit sha: 19351e51472213736d5301c666500b459ccabff7 **/ include/odp/api/spec/packet.h | 17 +++++++++++++++++ include/odp/api/spec/packet_flags.h | 9 +++++++++ 2 files changed, 26 insertions(+) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 62ecf70e1..55793ff20 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1437,6 +1437,23 @@ void odp_packet_l3_chksum_insert(odp_packet_t pkt, int l3); void odp_packet_l4_chksum_insert(odp_packet_t pkt, int l4); /** + * Ones' complement sum of IP payload data + * + * Returns 16-bit ones' complement sum calculated over IP payload data in the + * packet (includes L4 headers, excludes Ethernet CRC). In case of odd number of + * bytes, calculation uses a zero byte as padding at the end. The sum may be + * used as part of e.g. UDP/TCP checksum checking, especially with IP + * fragments. + * + * Use odp_packet_has_ones_comp() to check if the sum has been set. + * + * @param pkt Packet handle + * + * @return Ones' complement sum of IP payload data + */ +uint16_t odp_packet_ones_comp(odp_packet_t pkt); + +/** * Packet flow hash value * * Returns the hash generated from the packet header. Use diff --git a/include/odp/api/spec/packet_flags.h b/include/odp/api/spec/packet_flags.h index 377b75ba0..31979ac4b 100644 --- a/include/odp/api/spec/packet_flags.h +++ b/include/odp/api/spec/packet_flags.h @@ -277,6 +277,15 @@ int odp_packet_has_sctp(odp_packet_t pkt); int odp_packet_has_icmp(odp_packet_t pkt); /** + * Check for ones' complement sum + * + * @param pkt Packet handle + * @retval non-zero if packet contains ones' complement sum + * @retval 0 if packet does not contain ones' complement sum + */ +int odp_packet_has_ones_comp(odp_packet_t pkt); + +/** * Check for packet flow hash * * @param pkt Packet handle From patchwork Mon Oct 23 10:00:24 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: 116672 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4459482qgn; Mon, 23 Oct 2017 03:07:13 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RxN6g/E9Nc9nZKGaJ9Tqfw/377/8pB3Y9U49iEdlBPMmRT9UsVX6Bu/gQIju5/bJcBuqMA X-Received: by 10.200.49.92 with SMTP id h28mr19568268qtb.340.1508753233593; Mon, 23 Oct 2017 03:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508753233; cv=none; d=google.com; s=arc-20160816; b=S+0KESSSRnrLqkgDAoEtQrX+SPjSnsNSBu5rffet8GsnzVjvu6Y9YFlOcq15ZFaAK4 k+ddE7tdqoUCT3CQTKpSYZoBIhDcUjPTb9Lo7V2KJDUr+2WC8qC/J+/0dcAq0Cc6txAy VEBe3O6wb3KxI5SLqf40qPjodEaJGObq+Rgi292sVD2qWHpq7V7Bzjmw2zFK5JihXT0x X6RABjwZgMd3eJHnsdxFoT7N/14A+SHSY0bmttjkatodi/nkWuN2A0OeRmKQXOpzxFnC eVyHKY7u8R2dDsMYVZbrIV0x5mBSt8eY6qvBvI3LiSG8w5rV5z2HaSL+ylYLdkfRhFiv z1Vw== 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=2V0/nDcJpNT2vLdFwTj1q8hQQnIXoGMJ364KT/WUe8E=; b=yXP4RJqCdd38RR7D426OL9o1rk0W4g/h34806ZP8YQayx+Y+AwUN1W8xiVrNJN5+N4 w759Lt96FRc1A31QK3bLR8Op2bwqbr7rfLHNzsiJbwSGmhw5K4MCvxHcG2EuH+6MMA6W 2fCbiMMSquOmvkjaiV1s4Z3CGEcTJgWSZa7NhtN8thvO971/PsPP2PXgohs62Wfgo4Zf oBt3IOnduDe3gpDwq5+Je2AJBHRjifsw+OS0WoUH5abx3X6kKLSZ1wBJ0l/rSFEON50L N4buZfAaErmYdLRjKBFnTfQcjZtuA2BVxmwW0JY2Wwgpj25kYe76XojOIxJ+zmAD8Lni wjDg== 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 n189si5670164qkb.75.2017.10.23.03.07.13; Mon, 23 Oct 2017 03:07:13 -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 44F4F6162D; Mon, 23 Oct 2017 10:07:13 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, 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 1BBF561A03; Mon, 23 Oct 2017 10:03:22 +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 54BC561DDC; Mon, 23 Oct 2017 10:03:13 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id 8E1DC61A03 for ; Mon, 23 Oct 2017 10:00:42 +0000 (UTC) Received: from mxback5g.mail.yandex.net (mxback5g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:166]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 11E5943B62 for ; Mon, 23 Oct 2017 13:00:41 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback5g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id KDJQOtDKYb-0en8ki66; Mon, 23 Oct 2017 13:00:41 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id AuFEnCuXXk-0eRmBIKB; Mon, 23 Oct 2017 13:00:40 +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, 23 Oct 2017 13:00:24 +0300 Message-Id: <1508752825-12017-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508752825-12017-1-git-send-email-odpbot@yandex.ru> References: <1508752825-12017-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 242 Subject: [lng-odp] [PATCH API-NEXT v2 2/3] linux-gen: packet: dummy ones complement implementation 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: Petri Savolainen Added dummy implementation of ones complement calls. Linux generic implementation does not calculate the sum for all incoming packets as it would be wasteful in SW. It's better to wait until application asks it with odp_chksum_ones_comp16(). Later on, the sum could be stored into the packet header, if we found a way to get it from the HW. Signed-off-by: Petri Savolainen --- /** Email created from pull request 242 (psavol:next-checksum-metadata) ** https://github.com/Linaro/odp/pull/242 ** Patch: https://github.com/Linaro/odp/pull/242.patch ** Base sha: ec6510b33e8b96d6d6670efb9dc3c9101baed6c6 ** Merge commit sha: 19351e51472213736d5301c666500b459ccabff7 **/ platform/linux-generic/odp_packet.c | 6 ++++++ platform/linux-generic/odp_packet_flags.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 603ac7181..1ad51339d 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -1255,6 +1255,12 @@ int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset) return 0; } +uint16_t odp_packet_ones_comp(odp_packet_t pkt) +{ + (void)pkt; + return 0; +} + void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t flow_hash) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 2e26ad601..1436bf303 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -143,6 +143,12 @@ int odp_packet_has_icmp(odp_packet_t pkt) retflag(pkt, input_flags.icmp); } +int odp_packet_has_ones_comp(odp_packet_t pkt) +{ + (void)pkt; + return 0; +} + odp_packet_color_t odp_packet_color(odp_packet_t pkt) { retflag(pkt, input_flags.color); From patchwork Mon Oct 23 10:00:25 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: 116674 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4461095qgn; Mon, 23 Oct 2017 03:08:53 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QHrNSxTNGSGiiUPwJokCgm3Zqh1I5hWYRvTkAhhKCmOWaTEGiV4LWMN49KyGTnghNC7JZs X-Received: by 10.200.26.216 with SMTP id h24mr18626492qtk.175.1508753332995; Mon, 23 Oct 2017 03:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508753332; cv=none; d=google.com; s=arc-20160816; b=Yufzvut4IO1uGmRziYy7Rg/bFiueMfHtedQ7Xi7YRSRVtlJSQt1a0YYuFHYXeW5kp9 5RLHyxqfaf0/MK8PdGeDgQ3aTJjwGg+XvDlSAbYsRqrJJYIP6bSYhP5BNjbLzsfn9XJF aVrzcRmTEAQSsOVr3f3RG5q+hmZNx6OnYnlcWyk6aZqhNAd7qUhZWXUsPimSzsnEjIPv 5FYSrqsC9QXRyeoAw9qmAebpwbv/H1GanIewfQCXwjkiWC+dSkp7PWQcK95piXL9hA1j lHX0V6AeguTxrI8FIc+g6JSs9p7sois1MPPPPQJPEHL8DW2U2soAZaTr+OO6zdcAIeOQ AGsA== 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=X26cCZsFy6imcqGsD37dA96OQsYmWJZhxV5hFZBez44=; b=BvN6hN0GHo6lmycKHXe7AuVYyrLUFRA1XXbWJ3lrIff2WTbzclPRctDEiVoT5wmd5r 4c/ADmt/gZvVtaeWvpu/rhYmXiDuggEJOc/Ql5u/7PLeMb6rUu0y+5OVuPv5Y6I9ADw9 hDjauKtRg6UFpGjZkmqZoHcDF++J6ns0EnhQ3SML7Kf/XuuvJLQTZk8r8CLMn8WiFsQ7 k58/xnysMDBv5PcZcwCYC6BYV4MQa48MC0+til9SagcVIkVcbfDjmebhu56T19m9ofdu gJMcFs92sxyngwlZzUUeB+LExZIiFMcXmzlG5129Kev/PfZcSH4Ur94g0aWNLaZURGww ZaBQ== 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 q65si2743395qkl.482.2017.10.23.03.08.52; Mon, 23 Oct 2017 03:08:52 -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 A119861D29; Mon, 23 Oct 2017 10:08:52 +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 339AA61C9E; Mon, 23 Oct 2017 10:04:03 +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 C67026185A; Mon, 23 Oct 2017 10:03:56 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 095C761BBA for ; Mon, 23 Oct 2017 10:00:43 +0000 (UTC) Received: from mxback1g.mail.yandex.net (mxback1g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:162]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 90B8D181303 for ; Mon, 23 Oct 2017 13:00:41 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Sh53t6twKm-0fSO5Ush; Mon, 23 Oct 2017 13:00:41 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id AuFEnCuXXk-0fRaZlV8; Mon, 23 Oct 2017 13:00:41 +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, 23 Oct 2017 13:00:25 +0300 Message-Id: <1508752825-12017-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508752825-12017-1-git-send-email-odpbot@yandex.ru> References: <1508752825-12017-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 242 Subject: [lng-odp] [PATCH API-NEXT v2 3/3] validation: packet: add calls to ones complement 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: Petri Savolainen Call ones complement functions. Actual validation of correctness of the sum is to be done, when an implementation exist which sets the sum on packet input. Signed-off-by: Petri Savolainen --- /** Email created from pull request 242 (psavol:next-checksum-metadata) ** https://github.com/Linaro/odp/pull/242 ** Patch: https://github.com/Linaro/odp/pull/242.patch ** Base sha: ec6510b33e8b96d6d6670efb9dc3c9101baed6c6 ** Merge commit sha: 19351e51472213736d5301c666500b459ccabff7 **/ test/validation/api/packet/packet.c | 13 +++++++++++++ test/validation/api/pktio/pktio.c | 22 ++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 431444cf3..340b81159 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -30,6 +30,9 @@ static odp_bool_t segmentation_supported = true; odp_packet_t test_packet, segmented_test_packet; +/* Dummy global variable to avoid compiler optimizing out API calls */ +uint64_t odp_valid_test_packet_u64; + static struct udata_struct { uint64_t u64; uint32_t u32; @@ -512,6 +515,15 @@ void packet_test_basic_metadata(void) CU_ASSERT(odp_packet_input(pkt) == ODP_PKTIO_INVALID); CU_ASSERT(odp_packet_input_index(pkt) < 0); + /* Packet was not received from a packet IO, shouldn't have ones + * complement calculated. */ + CU_ASSERT(odp_packet_has_ones_comp(pkt) == 0); + + /* Usually odp_packet_ones_comp() is not called here. This ensures that + * the function exists. */ + if (odp_packet_has_ones_comp(pkt)) + odp_valid_test_packet_u64 += odp_packet_ones_comp(pkt); + odp_packet_flow_hash_set(pkt, UINT32_MAX); CU_ASSERT(odp_packet_has_flow_hash(pkt)); CU_ASSERT(odp_packet_flow_hash(pkt) == UINT32_MAX); @@ -1112,6 +1124,7 @@ static void _packet_compare_inflags(odp_packet_t pkt1, odp_packet_t pkt2) COMPARE_HAS_INFLAG(pkt1, pkt2, tcp); COMPARE_HAS_INFLAG(pkt1, pkt2, sctp); COMPARE_HAS_INFLAG(pkt1, pkt2, icmp); + COMPARE_HAS_INFLAG(pkt1, pkt2, ones_comp); COMPARE_HAS_INFLAG(pkt1, pkt2, flow_hash); COMPARE_HAS_INFLAG(pkt1, pkt2, ts); diff --git a/test/validation/api/pktio/pktio.c b/test/validation/api/pktio/pktio.c index 720707358..e3f9ab22a 100644 --- a/test/validation/api/pktio/pktio.c +++ b/test/validation/api/pktio/pktio.c @@ -48,6 +48,9 @@ static int num_ifaces; interface that just become up.*/ static bool wait_for_network; +/* Dummy global variable to avoid compiler optimizing out API calls */ +uint64_t odp_valid_test_pktio_u64; + /** local container for pktio attributes */ typedef struct { const char *name; @@ -661,10 +664,21 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b, CU_ASSERT(num_rx == num_pkts); for (i = 0; i < num_rx; ++i) { - CU_ASSERT_FATAL(rx_pkt[i] != ODP_PACKET_INVALID); - CU_ASSERT(odp_packet_input(rx_pkt[i]) == pktio_b->id); - CU_ASSERT(odp_packet_has_error(rx_pkt[i]) == 0); - odp_packet_free(rx_pkt[i]); + odp_packet_t pkt = rx_pkt[i]; + + CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); + CU_ASSERT(odp_packet_input(pkt) == pktio_b->id); + CU_ASSERT(odp_packet_has_error(pkt) == 0); + + /* Dummy read to ones complement in case pktio has set it */ + if (odp_packet_has_ones_comp(pkt)) + odp_valid_test_pktio_u64 += odp_packet_ones_comp(pkt); + + /* Dummy read to flow hash in case pktio has set it */ + if (odp_packet_has_flow_hash(pkt)) + odp_valid_test_pktio_u64 += odp_packet_flow_hash(pkt); + + odp_packet_free(pkt); } }