From patchwork Wed Sep 6 13:00:04 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: 111768 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp830718qge; Wed, 6 Sep 2017 06:01:47 -0700 (PDT) X-Google-Smtp-Source: ADKCNb6fBPauy4LGwCw/l1JTeZdQooZ8kiO94bIrKIGvHbyM61RtnKlFkVOMWahXymTjMIrbhqYI X-Received: by 10.129.39.6 with SMTP id n6mr2001878ywn.216.1504702907654; Wed, 06 Sep 2017 06:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504702907; cv=none; d=google.com; s=arc-20160816; b=B5PhYWY2en8QXcmp7PHxNfCvemHJt2h707weByBzXenEaU9sdzH9FNwMJfXeyqndrj Hg2yHYEXFHkh/GB5n0Q3TD2WfFzqpP82K+ykMQtQo1sm2LbNglbqx6XhAAChx0wCgP/5 RCKRm1ysjdS93ZeTMv0dJKBRcupu37+jAKFZCILIDlOxsuZKgWnaCaG4k9HZUl+YRTLf dEHOB4laR9KQrqNDKzxMOTfnEnocAfqVmPsKko0dYizTFOqQIuTEotNJu2S/CISi9WQu cXiijQOJQqPDxBBYvdeD5DANmQTcBilDJm6QZ45yEki8+aDdlzKnkuha2W8yc1m9OMOE qNhg== 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=Ww65+UoBe1GvSBbto/AeG9P2qZ+j63Jj75zx10vJ2T8=; b=AV89Psf3L+LG6NzzbLDPH0p2d2YsInrN4XQAZ6TOr2VCkspN4adenCBuH/r7h1X7/3 2i/qBJaz0px33hBL6bF/aplhNUDV0iFknQngI78pPPk9vdkT+/5hryMNCPgQYJBUDohr VH5zc4iKzuGgIKGuvLrgTYkiqaqyvKII/oiUsqjCdgWu1ywS+cjrRxn0cww+T/Q6fInB Jjf5MswIlttXBJN638j9NM/OlPRfvZTjGM6+0wtTypWgHdFh2Df36eCwLJ97cejuy4gg 3tW4pR1PdUtfJjmhkw0jr+N9O61aUA3LcjSVfGrweK5F2RIYy4J/Szyev+X64JZsx2qQ bSdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id t7si679983qtd.280.2017.09.06.06.01.47; Wed, 06 Sep 2017 06:01:47 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 4B41E64476; Wed, 6 Sep 2017 13:01: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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 2FC5262D20; Wed, 6 Sep 2017 13:00:36 +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 D30DF61E19; Wed, 6 Sep 2017 13:00:24 +0000 (UTC) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by lists.linaro.org (Postfix) with ESMTPS id E19F060826 for ; Wed, 6 Sep 2017 13:00:18 +0000 (UTC) Received: from mxback4o.mail.yandex.net (mxback4o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1e]) by forward105p.mail.yandex.net (Yandex) with ESMTP id 90C7640844E9 for ; Wed, 6 Sep 2017 16:00:17 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback4o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id tkzreio6WJ-0H2itvuO; Wed, 06 Sep 2017 16:00:17 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id rJPyfxy80y-0GougSkx; Wed, 06 Sep 2017 16:00:16 +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: Wed, 6 Sep 2017 16:00:04 +0300 Message-Id: <1504702806-13800-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504702806-13800-1-git-send-email-odpbot@yandex.ru> References: <1504702806-13800-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 167 Subject: [lng-odp] [PATCH API-NEXT v1 1/3] api: packet_io: refine packet format on output 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 Define explicitly that (by default) packet output does not need any extra metadata to be set. Also (Ethernet) padding and CRC are added by default. Signed-off-by: Petri Savolainen --- /** Email created from pull request 167 (psavol:next-pkt-checksum) ** https://github.com/Linaro/odp/pull/167 ** Patch: https://github.com/Linaro/odp/pull/167.patch ** Base sha: 4eae04e80a634c17ac276bb06bce468cbe28cde0 ** Merge commit sha: fb1526ce83d639bbbd28205b31145e0e15153508 **/ include/odp/api/spec/packet_io.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index d42cebf0..6040a831 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -889,6 +889,11 @@ uint64_t odp_pktin_wait_time(uint64_t nsec); * is less than 'num', the remaining packets at the end of packets[] array * are not consumed, and the caller has to take care of them. * + * Entire packet data is sent out (odp_packet_len() bytes of data, starting from + * odp_packet_data()). All other packet metadata is ignored unless otherwise + * specified e.g. for protocol offload purposes. Link protocol specific frame + * checksum and padding are added to frames before transmission. + * * @param queue Packet output queue handle for sending packets * @param packets[] Array of packets to send * @param num Number of packets to send From patchwork Wed Sep 6 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: 111769 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp833092qge; Wed, 6 Sep 2017 06:03:09 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5Ojiu2WproYBBdhrxPeTFFY1u7TxX+ACEPvBtQn4DF8w2p8GFVt1lhN4a1xvWqAC0B6qMy X-Received: by 10.200.28.123 with SMTP id j56mr3261101qtk.299.1504702989680; Wed, 06 Sep 2017 06:03:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504702989; cv=none; d=google.com; s=arc-20160816; b=Hs+UDkgCN+2Gl+6zVFIz8Fie/1h+HFpxfNagRWHjyT/F1MSUo2k53whez6sEbiLKeI V7ZL8BIGMElUFMFaNKJov6bOOcy06PFs4Z1B+mYdBzdWO4jJ4EGSkb/8a+eDQUteZaXJ MwQ5PD+bwG2AA9h9J/jlu5NkNxnhcfbRHoQsrV5vvzkAncVW+SWZda6xhZcQhUbrPELl +yvgpbAhILJJcv7Sut072wdu3XLZMlPftMGJCVSV8XG1ZN+KxLWWvBJMmawbXrdMfKPf 6IfaaYfaArnTMACkhNc80o+tU4c+YWfEi1cwykGQ+iGRzcR/5P8GzZddeQQODpIkxbul mpcg== 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=nugDkFq2on7RI9VEeIbNaSydbryNT0t+XbUbU7ACalM=; b=oqsp078WOrwYRsFJvE+2QR9SBDvshTYgtFr58qvBNdUFKpqwKlqxA+ww+XW9wTSQgA n3qmXdMZA9a/HwulYRq5jQxfX7+cr0yTxcYw5s5hAzP8aEWhx9PJ5os44nXA41OU7GuA ufHxDuvuI9nD/2WfMGbBqUbgorHBAH8HBNeftMqnvKe832ZrA36UN/SquaoFDmJcjIFT tCKrxOXS9s8peg24G0mPOuMCXPXBl2T1/phGg4d1W6ofEWcGyUSr5d13T8Gyd8Pm/9ZQ LagNefvUlpM3P8dPOaNfeC073+xucYdqqNLF0b/XI81YURjQdHkoveK/JotX6BFFZQex Yqag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id d18si3135622qte.200.2017.09.06.06.03.09; Wed, 06 Sep 2017 06:03:09 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 1ABF164493; Wed, 6 Sep 2017 13:03:09 +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,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 867CA64467; Wed, 6 Sep 2017 13: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 9E69F62DF4; Wed, 6 Sep 2017 13:00:29 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id A2D1361057 for ; Wed, 6 Sep 2017 13:00:19 +0000 (UTC) Received: from mxback2o.mail.yandex.net (mxback2o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1c]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 438712D8450D for ; Wed, 6 Sep 2017 16:00:18 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback2o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id LpUAo3HoFE-0IeO2UvH; Wed, 06 Sep 2017 16:00:18 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id rJPyfxy80y-0HouUWMH; Wed, 06 Sep 2017 16:00:17 +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: Wed, 6 Sep 2017 16:00:05 +0300 Message-Id: <1504702806-13800-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504702806-13800-1-git-send-email-odpbot@yandex.ru> References: <1504702806-13800-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 167 Subject: [lng-odp] [PATCH API-NEXT v1 2/3] api: packet: add checksum status 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 functions to request L3/L4 checksum check status for a packet. Even if checksum checking is enabled on an interface, all packets may not be checked - for example L4 checksum cannot be checked for fragments (before reassembly). Also it varies how e.g. IP options affect HW checksum capability. Signed-off-by: Petri Savolainen --- /** Email created from pull request 167 (psavol:next-pkt-checksum) ** https://github.com/Linaro/odp/pull/167 ** Patch: https://github.com/Linaro/odp/pull/167.patch ** Base sha: 4eae04e80a634c17ac276bb06bce468cbe28cde0 ** Merge commit sha: fb1526ce83d639bbbd28205b31145e0e15153508 **/ include/odp/api/spec/packet.h | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 95f5349b..b3e1449f 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -83,6 +83,22 @@ typedef struct odp_packet_data_range { } odp_packet_data_range_t; +/** + * Checksum check status in packet + */ +typedef enum odp_packet_chksum_status_t { + /** Checksum was not checked. Checksum check was not attempted or + * the attempt failed. */ + ODP_PACKET_CHKSUM_UNKNOWN = 0, + + /** Checksum was checked and it was not correct */ + ODP_PACKET_CHKSUM_BAD, + + /** Checksum was checked and it was correct */ + ODP_PACKET_CHKSUM_OK + +} odp_packet_chksum_status_t; + /* * * Alloc and free @@ -1378,6 +1394,34 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt); int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset); /** + * Layer 3 checksum check status + * + * Returns the result of the latest layer 3 checksum check done for the packet. + * The status tells if checksum check was attempted and the result of the + * attempt. It depends on packet input (or IPSEC) configuration, packet content + * and implementation capabilities if checksum check is attempted for a packet. + * + * @param pkt Packet handle + * + * @return L3 checksum check status + */ +odp_packet_chksum_status_t odp_packet_l3_chksum_status(odp_packet_t pkt); + +/** + * Layer 4 checksum check status + * + * Returns the result of the latest layer 4 checksum check done for the packet. + * The status tells if checksum check was attempted and the result of the + * attempt. It depends on packet input (or IPSEC) configuration, packet content + * and implementation capabilities if checksum check is attempted for a packet. + * + * @param pkt Packet handle + * + * @return L4 checksum check status + */ +odp_packet_chksum_status_t odp_packet_l4_chksum_status(odp_packet_t pkt); + +/** * Layer 3 checksum insertion override * * Override checksum insertion configuration per packet. This per packet setting From patchwork Wed Sep 6 13:00:06 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: 111770 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp835285qge; Wed, 6 Sep 2017 06:04:23 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5BoHLN9g1swArSVIO0MNlVnow3Uj4hW/8JYeYNisOy6p25ffzXsi2Owx13Ac+7U0ZjVDAf X-Received: by 10.237.47.230 with SMTP id m93mr3280872qtd.277.1504703063427; Wed, 06 Sep 2017 06:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504703063; cv=none; d=google.com; s=arc-20160816; b=tR89p4TkWHKa6UrPZIbveYYm3v2c5Gl8sqRBMW4uRO2WrATSEbP1nd9grefLItlb6R x9r7BU5tbycbrDkjeisMX7cuCLKikWbXY+kRkMRqocLz8R2ljTG2gwsa7ycCbwHhEuIR e+crs9RE9EKhmLT7/xRrknUrIcWdbmNpF6g+7WEDjkJ2xbHRF9BGGBwUt55k46P/mDg/ UarJac8LAvO90CqZh2jOTpg/i2NB5PYaXCOVHs/+CCDwTMj6S+pzUwvovjGTe8Rqc9sI BrHA7jOaG1BtVqDIkRUXxLPUxUi77ZG08hwWQInBplGnpspQW+QJ7+KNgUXho2NuFwqw FeqA== 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=F7CIBikV+RBYMb3M3TOoJcPpT0CS32uwaHajw1HeSp4=; b=VEumJscpuwGk86P8GmfjXVgrxWtbtJVnQHDRCSjCrkwJsHNQpD6F7t9EeONd/VDIWo Du9bG8Kb9BVfSBUHEKzBArK1eX2hv0hanCkIgHCvN/FVgv3ysdch8bLL5rmHXFt1ZP5Z 3UXYdqBqOC6fe/Bx5McC15wN35OYwaQs8/bXyb6riW/HPV3pnwa36hsoRYCpfqHmBHPM CsXkmQ3USnRWnl5xKmKw6OJ7okQZZa5WkhYAIK2O8XxaS30LiY+TnnBz0Ewe6QmHBMcV ZhaXENokWrwCoctk6F56zrJL6BPeZ/6IeTycQKJBI/hLnPuxaJf2igPOZY98r1LrIVam JqUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j37si2935962qtj.324.2017.09.06.06.04.23; Wed, 06 Sep 2017 06:04:23 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 1587E644A6; Wed, 6 Sep 2017 13:04:23 +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,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 C5FC764466; Wed, 6 Sep 2017 13:00:56 +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 E173F64466; Wed, 6 Sep 2017 13:00:38 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id A5FE06080E for ; Wed, 6 Sep 2017 13:00:26 +0000 (UTC) Received: from mxback1j.mail.yandex.net (mxback1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10a]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 1433A4445FB2 for ; Wed, 6 Sep 2017 16:00:25 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Pnb7Fp5o4h-0IdCOCxL; Wed, 06 Sep 2017 16:00:19 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id rJPyfxy80y-0Io0mViA; Wed, 06 Sep 2017 16:00:18 +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: Wed, 6 Sep 2017 16:00:06 +0300 Message-Id: <1504702806-13800-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504702806-13800-1-git-send-email-odpbot@yandex.ru> References: <1504702806-13800-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 167 Subject: [lng-odp] [PATCH API-NEXT v1 3/3] api: packet_io: refine rules for checksum calculation 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 An implementation must be able to check checksum for normal IP packets. It's implementation defined if options or extension headers are supported. Parsing configuration must match the layers of checksum check configuration. Checksum insertion on packet output can expect well formed packet headers from the application. Checksum calculation ignores possible extra data in the packet. Signed-off-by: Petri Savolainen --- /** Email created from pull request 167 (psavol:next-pkt-checksum) ** https://github.com/Linaro/odp/pull/167 ** Patch: https://github.com/Linaro/odp/pull/167.patch ** Base sha: 4eae04e80a634c17ac276bb06bce468cbe28cde0 ** Merge commit sha: fb1526ce83d639bbbd28205b31145e0e15153508 **/ include/odp/api/spec/ipsec.h | 14 +++++++---- include/odp/api/spec/packet.h | 8 ++++++ include/odp/api/spec/packet_io.h | 54 +++++++++++++++++++++++++++++++--------- 3 files changed, 59 insertions(+), 17 deletions(-) diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index 7085bc0d..0b36b864 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -156,7 +156,9 @@ typedef struct odp_ipsec_inbound_config_t { odp_ipsec_proto_layer_t parse; /** Flags to control IPSEC payload data checks up to the selected parse - * level. */ + * level. Checksum checking status can be queried for each packet with + * odp_packet_l3_chksum_status() and odp_packet_l4_chksum_status(). + */ union { /** Mapping for individual bits */ struct { @@ -191,10 +193,12 @@ typedef struct odp_ipsec_inbound_config_t { */ typedef struct odp_ipsec_outbound_config_t { /** Flags to control L3/L4 checksum insertion as part of outbound - * packet processing. Packet must have set with valid L3/L4 offsets. - * Checksum configuration is ignored for packets that checksum cannot - * be computed for (e.g. IPv4 fragments). Application may use a packet - * metadata flag to disable checksum insertion per packet bases. + * packet processing. These flags control checksum insertion (for the + * payload packet) in the same way as the checksum flags in + * odp_pktout_config_opt_t control checksum insertion when sending + * packets out through a pktio interface. Also packet checksum override + * functions (e.g. odp_packet_l4_chksum_insert()) can be used in + * the same way. */ union { /** Mapping for individual bits */ diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index b3e1449f..c498e2e2 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1428,6 +1428,10 @@ odp_packet_chksum_status_t odp_packet_l4_chksum_status(odp_packet_t pkt); * overrides a higher level configuration for checksum insertion into a L3 * header during packet output processing. * + * Calling this function is always allowed but the checksum will not be + * inserted if the packet is output through a pktio that does not have + * the relevant pktout chksum bit set in the pktio capability. + * * @param pkt Packet handle * @param l3 0: do not insert L3 checksum * 1: insert L3 checksum @@ -1441,6 +1445,10 @@ void odp_packet_l3_chksum_insert(odp_packet_t pkt, int l3); * overrides a higher level configuration for checksum insertion into a L4 * header during packet output processing. * + * Calling this function is always allowed but the checksum will not be + * inserted if the packet is output through a pktio that does not have + * the relevant pktout chksum bit set in the pktio capability. + * * @param pkt Packet handle * @param l4 0: do not insert L4 checksum * 1: insert L4 checksum diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index 6040a831..b56a5205 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -256,11 +256,27 @@ typedef struct odp_pktio_param_t { * belong to time synchronization protocol (PTP). * * Packet input checksum checking may be enabled or disabled. When it is - * enabled, implementation will verify checksum correctness on incoming packets - * and depending on drop configuration either deliver erroneous packets with - * appropriate flags set (e.g. odp_packet_has_l3_error()) or drop those. - * When packet dropping is enabled, application will never receive a packet - * with the specified error and may avoid to check the error flag. + * enabled, implementation will attempt to verify checksum correctness on + * incoming packets and depending on drop configuration either deliver erroneous + * packets with appropriate flags set (e.g. odp_packet_has_l3_error(), + * odp_packet_l3_chksum_status()) or drop those. When packet dropping is + * enabled, application will never receive a packet with the specified error + * and may avoid to check the error flag. + * + * If checksum checking is enabled, IPv4 header checksum checking is always + * done for packets that do not have IP options and L4 checksum checking + * is done for unfragmented packets that do not have IPv4 options or IPv6 + * extension headers. In other cases checksum checking may or may not + * be done. For example, L4 checksum of fragmented packets is typically + * not checked. + * + * IPv4 checksum checking may be enabled only when parsing level is + * ODP_PKTIO_PARSER_LAYER_L3 or higher. Similarly, L4 level checksum checking + * may be enabled only with parsing level ODP_PKTIO_PARSER_LAYER_L4 or higher. + * + * Whether checksum checking was done and whether a checksum was correct + * can be queried for each received packet with odp_packet_l3_chksum_status() + * and odp_packet_l4_chksum_status(). */ typedef union odp_pktin_config_opt_t { /** Option flags */ @@ -314,13 +330,27 @@ typedef union odp_pktin_config_opt_t { * Packet output configuration options listed in a bit field structure. Packet * output checksum insertion may be enabled or disabled. When it is enabled, * implementation will calculate and insert checksum into every outgoing packet - * by default. Application may use a packet metadata flag to disable checksum - * insertion per packet bases. For correct operation, packet metadata must - * provide valid offsets for the appropriate protocols. For example, UDP - * checksum calculation needs both L3 and L4 offsets (to access IP and UDP - * headers). When application (e.g. a switch) does not modify L3/L4 data and - * thus checksum does not need to be updated, output checksum insertion should - * be disabled for optimal performance. + * by default. Application may disable checksum insertion (e.g. + * odp_packet_l4_chksum_insert()) on per packet basis. For correct operation, + * packet metadata must provide valid offsets for the appropriate protocols. + * For example, UDP checksum calculation needs both L3 and L4 offsets (to access + * IP and UDP headers). When application (e.g. a switch) does not modify L3/L4 + * data and thus checksum does not need to be updated, output checksum insertion + * should be disabled for optimal performance. + * + * Packet flags (odp_packet_has_*()) are ignored for the purpose of checksum + * insertion in packet output. + * + * UDP, TCP and SCTP checksum insertion must not be requested for IP fragments. + * Use checksum override function (odp_packet_l4_chksum_insert()) to disable + * checksumming when sending a fragment through a packet IO interface that has + * the relevant L4 checksum insertion enabled. + * + * Result of checksum insertion at packet output is undefined if the protocol + * headers required for checksum calculation are not well formed. Packet must + * contain at least as many data bytes after L3/L4 offsets as the headers + * indicate. Other data bytes of the packet are ignored for the checksum + * insertion. */ typedef union odp_pktout_config_opt_t { /** Option flags */