From patchwork Wed Nov 29 14:00:02 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: 120004 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3091491qgn; Wed, 29 Nov 2017 06:01:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMauhiWnWPph1/vfOyZv/MtxEZR6+PDKY9HVdAI8f4Oym9qfyBp+7h7hlUfBemVsYjIXxkns X-Received: by 10.200.19.11 with SMTP id e11mr4544262qtj.62.1511964094832; Wed, 29 Nov 2017 06:01:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511964094; cv=none; d=google.com; s=arc-20160816; b=noJHWzQ1rK7UTUvoio258P6ZYDKI5d9LIw716cZaI+j9Kwz2WjqhkJXZSvmvLZH+S0 nAOMWOP1lw5Sibm1ofeoi6mxIWlaqmrNhRCQE7FhseDed05I5iO+pfRPB/uqnze0dAzC cf3eoUHXXpcJKa+EZYpo4jDoVAiQFPrUo4CBnIKrZNXBJa/iQCd9GkwN5xl/+fK1wfPd lEeDjU4bqvcpG5sR72z9q6q15x/o2MXj2JnODhsvrn+usxYpX4BPdcUWruOy3WaaAEgf DILzbBXWrjs37ruk0GP/Ub2/fcJVy4E/rWMpqwM3oJ8OZQPRHT3B+HCrJcZHRpWKTipr J6vw== 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=IgxshvV5TtvfTQ9XOtfbtBh3QcmvQuvkpCYWdIX6Qtw=; b=clODdsl/mFtx2qrh3AC0VLxaazQDw0JuVbHwb/aa0oWc/G2DcAG4PoZPwLl4egHjWM 77z9IUCgYhPzH7qWMuWHWW+9fmsjKa2vtG47NL4nahbEUAYd32ECO4Q79ZbJDc6kgTO7 B5MeaZ8cjfqPj49BhsSCPLkHyvJdPdSeEzfvhgFHuaW+EaJ+3njj5VfuiiDVH/0jwIPK r8h+V4eCKmJAkDelMoBHq8IiDa+cVhmG0FxlVteRlOu3c7Ne5YSFOkUNx+bm/ez7+Bh2 1qXE8hv8eX1pQqR93VH4DhYUn4bna+m9kQKVkIP4Ddob3VIFxPY+9qc5qmwaiNyOo10X ppFQ== 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 m30si1785313qtd.198.2017.11.29.06.01.34; Wed, 29 Nov 2017 06:01:34 -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 8950A6074A; Wed, 29 Nov 2017 14:01:34 +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,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 291F1608ED; Wed, 29 Nov 2017 14:00:47 +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 08C9E6072F; Wed, 29 Nov 2017 14:00:32 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 50AB06072F for ; Wed, 29 Nov 2017 14:00:30 +0000 (UTC) Received: from mxback5g.mail.yandex.net (mxback5g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:166]) by forward103j.mail.yandex.net (Yandex) with ESMTP id BE2EC34C3CDC for ; Wed, 29 Nov 2017 17:00:28 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback5g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id XFypqqJ6jH-0Sg0sWrD; Wed, 29 Nov 2017 17:00:28 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id AIVWVflXkM-0Im0fRKK; Wed, 29 Nov 2017 17: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, 29 Nov 2017 17:00:02 +0300 Message-Id: <1511964006-11004-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511964006-11004-1-git-send-email-odpbot@yandex.ru> References: <1511964006-11004-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 313 Subject: [lng-odp] [PATCH API-NEXT v1 1/5] api: pktio: add checksum insert enable bits 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 bits to control if checksum insertion is enabled / disabled at packet output. Current configuration options control if checksum is inserted / not inserted by default, but leaves it open for application to request checksum always with override functions. Explicit disable allows implementation to optimize performance (e.g. DPDK does this). Signed-off-by: Petri Savolainen --- /** Email created from pull request 313 (psavol:next-pktout-config) ** https://github.com/Linaro/odp/pull/313 ** Patch: https://github.com/Linaro/odp/pull/313.patch ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905 ** Merge commit sha: 5d0d0efcb77baf5b9db803a8a8b89450e27aff38 **/ include/odp/api/spec/packet.h | 4 +-- include/odp/api/spec/packet_io.h | 62 ++++++++++++++++++++++++++++------------ 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index b897c9d3c..1dbbfafe6 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1531,7 +1531,7 @@ odp_packet_chksum_status_t odp_packet_l4_chksum_status(odp_packet_t pkt); * * 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. + * the relevant checksum insertion enabled. * * @param pkt Packet handle * @param insert 0: do not insert L3 checksum @@ -1548,7 +1548,7 @@ void odp_packet_l3_chksum_insert(odp_packet_t pkt, int insert); * * 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. + * the relevant checksum insertion enabled. * * @param pkt Packet handle * @param insert 0: do not insert L4 checksum diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index 6e4f88100..3798c048e 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -329,15 +329,29 @@ typedef union odp_pktin_config_opt_t { * Packet output configuration options bit field * * 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 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. + * output checksum insertion may be enabled or disabled (e.g. ipv4_chksum_ena): + * + * 0: Disable checksum insertion. Application will not request checksum + * insertion for any packet. This is the default value for xxx_chksum_ena + * bits. + * 1: Enable checksum insertion. Application will request checksum insertion + * for some packets. + * + * When checksum insertion is enabled, application may use configuration options + * to set the default behaviour on packet output (e.g. ipv4_chksum): + * + * 0: Do not insert checksum by default. This is the default value for + * xxx_chksum bits. + * 1: Calculate and insert checksum by default. + * + * These defaults may be overridden on per packet basis using e.g. + * odp_packet_l4_chksum_insert(). + * + * 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, checksum insertion should be disabled for optimal performance. * * Packet flags (odp_packet_has_*()) are ignored for the purpose of checksum * insertion in packet output. @@ -354,19 +368,31 @@ typedef union odp_pktin_config_opt_t { * insertion. */ typedef union odp_pktout_config_opt_t { - /** Option flags */ + /** Option flags for packet output */ struct { - /** Insert IPv4 header checksum on packet output */ - uint64_t ipv4_chksum : 1; + /** Enable IPv4 header checksum insertion. */ + uint64_t ipv4_chksum_ena : 1; + + /** Enable UDP checksum insertion */ + uint64_t udp_chksum_ena : 1; + + /** Enable TCP checksum insertion */ + uint64_t tcp_chksum_ena : 1; + + /** Enable SCTP checksum insertion */ + uint64_t sctp_chksum_ena : 1; + + /** Insert IPv4 header checksum by default */ + uint64_t ipv4_chksum : 1; - /** Insert UDP checksum on packet output */ - uint64_t udp_chksum : 1; + /** Insert UDP checksum on packet by default */ + uint64_t udp_chksum : 1; - /** Insert TCP checksum on packet output */ - uint64_t tcp_chksum : 1; + /** Insert TCP checksum on packet by default */ + uint64_t tcp_chksum : 1; - /** Insert SCTP checksum on packet output */ - uint64_t sctp_chksum : 1; + /** Insert SCTP checksum on packet by default */ + uint64_t sctp_chksum : 1; } bit;