From patchwork Wed Feb 15 12:29:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 93997 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2005035qgi; Wed, 15 Feb 2017 04:30:32 -0800 (PST) X-Received: by 10.237.39.5 with SMTP id n5mr30246096qtd.38.1487161832295; Wed, 15 Feb 2017 04:30:32 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id n46si2717642qtf.182.2017.02.15.04.30.31; Wed, 15 Feb 2017 04:30:32 -0800 (PST) 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id BCE4560BE4; Wed, 15 Feb 2017 12:30:31 +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=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 3658960C1E; Wed, 15 Feb 2017 12:29: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 E668960BDC; Wed, 15 Feb 2017 12:29:52 +0000 (UTC) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10127.outbound.protection.outlook.com [40.107.1.127]) by lists.linaro.org (Postfix) with ESMTPS id 689676094D for ; Wed, 15 Feb 2017 12:29:50 +0000 (UTC) Received: from AMXPR07CA0029.eurprd07.prod.outlook.com (10.242.64.29) by DB6PR0701MB1735.eurprd07.prod.outlook.com (10.168.10.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.10; Wed, 15 Feb 2017 12:29:48 +0000 Received: from DB5EUR03FT027.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::207) by AMXPR07CA0029.outlook.office365.com (2a01:111:e400:1000::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.10 via Frontend Transport; Wed, 15 Feb 2017 12:29:48 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning linaro.org discourages use of 131.228.2.38 as permitted sender) Received: from hybrid2.ext.net.nokia.com (131.228.2.38) by DB5EUR03FT027.mail.protection.outlook.com (10.152.20.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.904.16 via Frontend Transport; Wed, 15 Feb 2017 12:29:47 +0000 Received: from fihe3nok1349.nsn-intra.net (10.158.36.137) by fihe3nok1349.nsn-intra.net (10.158.36.137) with Microsoft SMTP Server (TLS) id 15.1.466.34; Wed, 15 Feb 2017 14:29:46 +0200 Received: from mailrelay.int.nokia.com (10.130.128.30) by fihe3nok1349.nsn-intra.net (10.158.36.137) with Microsoft SMTP Server (TLS) id 15.1.466.34 via Frontend Transport; Wed, 15 Feb 2017 14:29:46 +0200 Received: from fihe3nok0735.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0735.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id v1FCTWSM002931 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 15 Feb 2017 14:29:32 +0200 Received: from 10.144.19.15 ([10.144.104.219]) by fihe3nok0735.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id v1FCTWsn002922 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Wed, 15 Feb 2017 14:29:32 +0200 X-HPESVCS-Source-Ip: 10.144.104.219 From: Petri Savolainen To: Date: Wed, 15 Feb 2017 14:29:29 +0200 Message-ID: <1487161772-632-2-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1487161772-632-1-git-send-email-petri.savolainen@linaro.org> References: <1487161772-632-1-git-send-email-petri.savolainen@linaro.org> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.38; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(39850400002)(39410400002)(39840400002)(39450400003)(39860400002)(2980300002)(189002)(199003)(76176999)(36756003)(48376002)(5660300001)(50466002)(50986999)(2950100002)(6666003)(6916009)(106466001)(450100001)(110136004)(92566002)(47776003)(68736007)(389900002)(38730400002)(105596002)(5003940100001)(53936002)(189998001)(22756006)(33646002)(77096006)(2351001)(356003)(50226002)(8676002)(86362001)(626004)(97736004)(8936002)(2906002)(81166006)(305945005)(81156014)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0701MB1735; H:hybrid2.ext.net.nokia.com; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB5EUR03FT027; 1:drCQMCQegJLdNdATtGQWzNFJqQa3gW6b7Rju+ElpxHQhs/obZadJZAhJbfAsbHEb1ZhqaAWlLisjgsqdJgu/oLTlAOLO4RsULOFFA2UH7/9qYj2z2QtA2U+rdatDjfMff51Q0jn1+y9fqnuN8lAnNIEWxtIBa+c4sT++5sRKzdpN3sVig56BKyEQR7MF2gFCRiwO8y/t/LOHEXEvvKU+9VI0t4Zpn4UOUjoab+k+yfw6aEr7dk3m0TYP9B/6Rsf+dSVV87xyh4X21E7NEgW6DqdKaguodpHMCkJFapU/WI4I7Xm/JfTscDyWARx7DboMcaYW4mL3mqUonQ8HSn+37lwAlugdiFXtMIc0Qlrf544G9hfGzVfvgA9hL3rfSc6xwMSzRSdB+x/TtuNy8+ylcBNUEnwC9DFIopEDYk3TYSjHFRXok++TcfiUZUTvEDWbthd8OT74NVbN8aVpbwqVwg== X-MS-Office365-Filtering-Correlation-Id: 9c1ae7de-4b84-4a4d-691b-08d4559e54b8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DB6PR0701MB1735; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB1735; 3:csY7fWefVLK9F2bE2k6BmMUKx+s5jQZTtcL7k8/AvbA9dIFc3xQLQxmL9DNXxK8QSK6ldKtAN5SJ+BkmvwfyFfFYYjEqze97m/RGYGW6WjmNxPbcX52mMGHB0RlHy5xgflsQrkWlX8txz2cubis8Lx3dJNP+DSOd/wmr083jxqGTRHTZQM31X2WnHSVZCeX7wPi4jzuaa1PLHpvRMbAqqHsmXjGiMZkEgNjFX6Vl+zCLNqHZBaPmz1ddAEskC5zcL00r4nSXJX2mGTITOo11kx77NjZ6URiGE5cQfkq4RYT21Ot0IUsl9MnxOPbTKXG+aUGtuXTfw49xig/wu9OHtRRuq95/bVV8K7j07l5itlIlVAooQ2Cwb6sy5+/fooBc; 25:Ehod3rL2wR3r2TIFWJHZv2KD28Bfv+AP2Zdv3suUDXt1f/hpRziKksLMNq1Qew6vahj+HZ9HMU53zot+n+dDf0aSCsjfjcOxwo7TqsoAEEc6IW8A5iT3oT1xOiL+xH8WD9BnTWdVLT5HDRqC8/1+bpLSYFfLx/S+FDJD4zqtXr8SH3pQyhxWYppPbB+Je8lOqVRRyCSVUVKX5ZYiKPMj+2eIfGg5eoSXAm+KxXu0Z43b9kuJx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q4FiLzkfHQTvCDE8gWqbcvvE2bnN2CQt9r9adEc5oQZEyXDdP2MclC96+YQ5LhGeUBPyR4+k5uAuCpBuab/ZcL/IU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13016025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123558025)(20161123564025)(20161123560025)(20161123555025)(20161123562025)(6072148); SRVR:DB6PR0701MB1735; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0701MB1735; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB1735; 4:AIAd/5kl+Nz8To6p6eSIcV+pXMpncLjBGLj3FcESbS7z/pq/2nBIwokIEbAZYFGTZyKK4FUhNoHD7p2XcUEQUQcGVqzMtHe0nqCalznYfdGj6Gy8fKq1kN0lMWAIWLk4GjKc5ijTQSokjOPwSr0izBm4TGbRTAM2uUuqPCwZyYuYdEqqBeRRdx+Us6iQUfPzFUZ2FW/pJFeBnH8CKPlueS+O+hHhO6m6rbE7LfvFVgIamhAsQPoAbzln+P8J/Er5Uacvk3KEDWavgnnkqUDDpjqqUNEmb3xgrKIAyUYOc80Z64zpuQAgm1Ofz6+l2Ky2i3vYQxzVeNgEn2X9LxHqQkGtarakVBinOJVcFJAKDi9Utr6ClA3sq6wKjG7Kc9k8TOG9aVqu/mI3/I6VAtLKrZatzfigAu5qJCeBL4WKrcoyH+6LbuTbLMZVMgqqqkwIua347q9427IQ/UaVj7RGM44zQXbL69yL5JCFcWf84bwb4MueJaqAGTm6qe9hvc8zeSfSF4fA4CnH6k3MBw0hAlI6qbi3/iLZlQr9t2uYKXsnCUXQCl1C5F5/ezhuGtPYAmtyJzH9LKJHzmhgbZYneV7mwN/BwHPniudg8T+t0JtNqQBWyd6A6nKI2HoOc6Fv+7gt+JuTfVGtTyjHnhGnu48lLjj5HnQ1wx1GGWMSDdQ= X-Forefront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xAbAOIfrmerqBmYhCPyXYqLvVPljaNTogthiAFPY3qB9U1tyvtXflLw7tN0CUhR90RgquT6PrSqal0f2GY/1oV5jrr/fpn9l0qpbYoS3KSnpwuzS5EbiIhA6fFpupWouezf86yJJ90RCrJzVbwFWENkb0ZxVpsQKsk1Bax/IRj+1c6jalpJ1o2FmvaBEH9ZgXl3HUwjiPN/IVi6jRYFA1KdpOUmKOmkIaTiNcMZLk0D96RuMit9Td4sGz3MC87eM+j363tGTlk5gadeQYyAf+TJMy7kZ3vQMq+xwv//e/XvKUgLzgl3+L0QsU8cf+bvp9+W2God7OEc7zklt5tmyfMruHL1j5RDIIVwOWwMX0BXEFVPYj2DIoLlXpnt9/4yElrt2Lbn41WG4ZUikmBlvY6J9rB4mD7DEZ27kIaamSGxb4Y8rw== X-OriginatorOrg: nokia.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2017 12:29:47.9397 (UTC) X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.38]; Helo=[hybrid2.ext.net.nokia.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0701MB1735 Subject: [lng-odp] [API-NEXT PATCH v2 1/4] api: packet: references may be implemented as copy 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" Some implementations may implement new references as packet copy. odp_packet_has_ref() will return 0 for copies, since those are unique packets. Signed-off-by: Petri Savolainen --- include/odp/api/spec/packet.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) -- 2.8.1 diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index b6450c1..92c35ae 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -892,9 +892,6 @@ odp_packet_t odp_packet_ref_static(odp_packet_t pkt); * dynamic references must not be mixed. Results are undefined if these * restrictions are not observed. * - * odp_packet_unshared_len() may be used to determine the number of bytes - * starting at offset zero that are unique to a packet handle. - * * The packet handle 'pkt' may itself by a (dynamic) reference to a packet. * * If the caller does not intend to modify either the packet or the new @@ -952,8 +949,9 @@ odp_packet_t odp_packet_ref_pkt(odp_packet_t pkt, uint32_t offset, * When a packet has multiple references, packet data is divided into two * parts: unshared and shared. The unshared part always precedes the shared * part. This call returns number of bytes in the unshared part. When a - * packet has only a single reference, all packet data is unshared and - * unshared length equals the packet length (odp_packet_len()). + * packet has only a single reference (see odp_packet_has_ref()), all packet + * data is unshared and unshared length equals the packet length + * (odp_packet_len()). * * Application may modify only the unshared part, the rest of the packet data * must be treated as read only. @@ -967,8 +965,17 @@ uint32_t odp_packet_unshared_len(odp_packet_t pkt); /** * Test if packet has multiple references * - * A packet that has multiple references shares data and possibly metadata - * with other packets. Shared part must be treated as read only. + * A packet that has multiple references share data with other packets. In case + * of a static reference it also shares metadata. Shared parts must be treated + * as read only. + * + * New references are created with odp_packet_ref_static(), odp_packet_ref() and + * odp_packet_ref_pkt() calls. The intent of multiple references is to avoid + * packet copies, however some implementations may do a packet copy for some of + * the calls. If a copy is done, the new reference is actually a new, unique + * packet and this function returns '0' for it. When a real reference is + * created (instead of a copy), this function returns '1' for both packets + * (the original packet and the new reference). * * @param pkt Packet handle *