From patchwork Mon Dec 4 09:00:20 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: 120495 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4176221qgn; Mon, 4 Dec 2017 01:02:59 -0800 (PST) X-Google-Smtp-Source: AGs4zMbVApaSSeFlT4h86JNpOB2YZhOb9nl85hTk5+cfV9vdlPB95oYYkFeLEurAnDFxvyCx8nDw X-Received: by 10.200.0.131 with SMTP id c3mr20842152qtg.49.1512378179627; Mon, 04 Dec 2017 01:02:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512378179; cv=none; d=google.com; s=arc-20160816; b=fmDJbDRBNbj3Bu9EgZdZ40CQfwEbx+DuwjOQ/FD37Nq03igUjZ2RlmJNh7+gXrITyV P58I6Pt09bLcSH5DYostDxHiu5lCf4G/EWK1uaw8FnwGe/Z4pzoPUV3XzXcNic6pjcPx rLCW9X9OGueBGaKALO2qCA8LGL54f/6d8KjOX2L5L23JNFlr1kaH/VbK+N1zbDEifivL 0cjySf1Cjvy//dq4IvE+slXP6UH0FAsTMl69zIgW8crJ5XQrfuW4/dBnd2rPxI0a6jaI svSwSvLiIzk1gNfPerVX5F+8WeYkk0JTcCLlrd9Zacaycu3J3cCM65FWWsh8uNwFQALq 2rUg== 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=R5PXkfArvQ0Qq0cdz839w9csW5zgUYL5iHb/Z+t9Sww=; b=As7sci+v6F31Pyz59luHuOkltMdEoTWzRVEpGh3d0Jx4y8GAj6GBmaqYI5nxeWmyGh ZX/I6lft2xwfkyoRhFkIlVyb6YOrOrXoVzYpGXzbuZ+7v2Q9y6g/rtqJy2tpjAaPQyy4 2xlTB0JBsDrTh8V4B6usx0vGQ8I/1d9ejGVWqm/ltCUASN5M96cRNo578BexW2AVyGLv Q6Cbxhp6JahCx48dLXzwQM7KWe/d8JpO53T32g1hhx9YdVqR6/vnebaZKhSb4TkhZfDI Jvgj7fEPTVQAMtpWlBXtTE18Qg1XNhQmf/URgeQITqhiIP3DgPcXnM1SJvBASVnl2KJk BdgA== 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 m82si2339794qkm.371.2017.12.04.01.02.59; Mon, 04 Dec 2017 01:02:59 -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 52E4A608BB; Mon, 4 Dec 2017 09:02:59 +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=-0.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED, URIBL_DBL_ABUSE_SPAM 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 84E6C60890; Mon, 4 Dec 2017 09:00:52 +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 E59F16086D; Mon, 4 Dec 2017 09:00:35 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id 5C7A260810 for ; Mon, 4 Dec 2017 09:00:28 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward104j.mail.yandex.net (Yandex) with ESMTP id E9F2541C29 for ; Mon, 4 Dec 2017 12:00:26 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 81uw9lm2Pf-0Qi01evQ; Mon, 04 Dec 2017 12:00:26 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 2pKugCeR78-0PHalVAM; Mon, 04 Dec 2017 12:00:25 +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, 4 Dec 2017 12:00:20 +0300 Message-Id: <1512378024-15857-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512378024-15857-1-git-send-email-odpbot@yandex.ru> References: <1512378024-15857-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 313 Subject: [lng-odp] [PATCH API-NEXT v2 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: bdb7cbf620ada8682c89b5ae5a97cb84f16c0ed0 ** Merge commit sha: e4a122986c2750ffb044994107b385bd8002cbf4 **/ 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 60d13043d..d25afa3e4 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;