From patchwork Mon Feb 13 12:53:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 93882 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1080675qgi; Mon, 13 Feb 2017 04:55:15 -0800 (PST) X-Received: by 10.200.39.77 with SMTP id h13mr22067114qth.62.1486990515719; Mon, 13 Feb 2017 04:55:15 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id m90si7165736qtd.98.2017.02.13.04.55.15; Mon, 13 Feb 2017 04:55:15 -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 5931360809; Mon, 13 Feb 2017 12:55:15 +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_H4, RCVD_IN_MSPIKE_WL, 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 4E10E60668; Mon, 13 Feb 2017 12:54: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 2B571607F1; Mon, 13 Feb 2017 12:54:30 +0000 (UTC) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0136.outbound.protection.outlook.com [104.47.2.136]) by lists.linaro.org (Postfix) with ESMTPS id 666B860659 for ; Mon, 13 Feb 2017 12:54:07 +0000 (UTC) Received: from AM2PR07CA0004.eurprd07.prod.outlook.com (10.163.24.142) by DB6PR0701MB1736.eurprd07.prod.outlook.com (10.168.10.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.10; Mon, 13 Feb 2017 12:54:05 +0000 Received: from DB5EUR03FT040.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::205) by AM2PR07CA0004.outlook.office365.com (2a01:111:e400:8448::14) 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; Mon, 13 Feb 2017 12:54:06 +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 DB5EUR03FT040.mail.protection.outlook.com (10.152.20.243) 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; Mon, 13 Feb 2017 12:54:05 +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; Mon, 13 Feb 2017 14:54:04 +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; Mon, 13 Feb 2017 14:54:04 +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 v1DCrU77020093 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 13 Feb 2017 14:53:30 +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 v1DCrU2D020084 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Mon, 13 Feb 2017 14:53:30 +0200 X-HPESVCS-Source-Ip: 10.144.104.219 From: Petri Savolainen To: Date: Mon, 13 Feb 2017 14:53:27 +0200 Message-ID: <1486990410-14928-2-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1486990410-14928-1-git-send-email-petri.savolainen@linaro.org> References: <1486990410-14928-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)(39840400002)(39450400003)(39860400002)(39410400002)(39850400002)(2980300002)(199003)(189002)(50466002)(356003)(2950100002)(97736004)(6916009)(2906002)(48376002)(77096006)(50986999)(5660300001)(76176999)(5003940100001)(105596002)(106466001)(6666003)(189998001)(86362001)(2351001)(626004)(450100001)(47776003)(8936002)(92566002)(38730400002)(68736007)(305945005)(110136004)(50226002)(22756006)(81156014)(81166006)(53936002)(8676002)(33646002)(36756003)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0701MB1736; H:hybrid2.ext.net.nokia.com; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB5EUR03FT040; 1:toKPG4JOVs6eNUeKwn4eYC+uPk80FtbdTSTTo75lABqDqcTxXJfU/XcTVvQdXL204jQY0d4vXVQSxHllw91wMVXmGMMjXLwSrrLW5FwGuRsFtyw28ApXtlW4BlOQ8SAVFcb6zGdl2kzCFJanmNXGYssiy0cy9sFY69x4myqupM+OZa3zE+ZiiEF4HQpSZ4rx+f7QyZqgqVfXlgYWppzwZ9nmEtOL2MQkwc3HoCMZGBSz9zRKtdHOuNE0XAAAjaXrNvB8q8G441IoCLuweJj6b9jwhvx8leGSuc4ldm/WgX6EP5HN/0yiRDQ96YwxAGtjWrUnjN15EunUe4lmIwaqTUOw8nrUkiSFMakI5K3ZOXLMpLGBreVou7nufYtDsySDCaPVj8yZKup8eIXqTYsNJwowG+Vre4X1d4s4vSp80TmdaCZDdB0dOxDa/yMG2OoHp0pYNX0izS4m2KiSGkVs7A== X-MS-Office365-Filtering-Correlation-Id: 57f541cd-36a1-4f2e-256d-08d4540f64a6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DB6PR0701MB1736; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB1736; 3:VOtUVRdXAKE8b4L2nGrDIeVrUO9nN7Sh3CzRhZQLxS3EkMBbcgafiWMednmZgEApqdPHHBPFJ6sBK5vZALwttnNqtcE+JSV/kVj+aojmJy2N4H37aWJHxpuvlOgDzaGi+JU/dN3bNEcZfmFV5/lsskvfPUwfKkbNXs3WzXI6LbMY+B34+0xDlcePIq/oPkNUJTvaaM2Ah3JxR1kbsnvY3iy6OteTmJS1oi4N7X04G3pudX6zACvTF8ito6p8B2pSlbLOfY5eT3KM7J0sLdt9/bDUaYVsBIqcGsc1mEo/0X+U5zKoZbtkF11puknYXZD7hckSv1zraxiy6BsBEynnZV4TPESTGxmiI/TRKOFRFR7z2BDz3snuw183pzulRjnV; 25:fbpgp/0UyczvE7z3AKStrYadyaxCfCwxUMoP31WS2ht5oOQ2YdsmPqJmt/apmE15WOXvpT+6WjI+qGz8SVVeui9g9UCgUFupGNuA98+p1VPOq8evTP2bXYWULbbl2GxqmEw2wivYRnUCMPFGeO6dp8IJcEaAtfHZH4cY9luPjsBW/0u6skc6tcNtAYC91omy4UpGpL5q0Z+f7XU5l5Z5/tonwK8pPcj3bSuXY1w8VrVHLvOHtu+d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Hh7TydCQ7OSKETO5N9PLsbZm9deWTemdMm5RiORH+KtJug1aedgJy0r4gdKjaJcHocXGCo3cFNntWiLYVPbBTuaeXavGa/Y2xo8r28= 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)(20161123562025)(20161123555025)(20161123560025)(6072148); SRVR:DB6PR0701MB1736; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0701MB1736; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB1736; 4:8wpLBNWRT6eMPNRV3HhODDywGTE2gV7/8XNZ/G5gkfvlSZs3qEeDthc56/nNDZlh0bplB1tMFUxi6Gm4OtGSWQDXAjh96Qm86QQii9OGi7mxQN7Gll4KXNlmjCYA76+7JY+500/Fz1/PzQ93X8JUp1A1er/2Rp8gcEFVPtCfpo1w+d43A4S2scpu1QwOXGgKPLEn6XNmg40Jc+nlEcw0ReJwHtWm5IJpZWYkJ9MgIiGuqLF8llVYLlw31U9pcrHnpCUAW80s8F15qNrPfe88jPK8jEhVK/X088NOmLR/+rE9XleunBn3Axcuwtg+eazM44XK8BzBEVIX8P3RxVTLX+xR4UpFreX8yEo78ok4vpWZlkal1C6gHhIPBNZ5BUgB449nVS1sW9Uc+yUqbduOnw2fFikZyJ4AQCXdJpcpw4RUQq31hQ76sUvMaM77D2lo1uSScVJFdswyYi8LHoHhGQ4xxsM9OE6/6r6wiKH0X3O1w6r8aoqoDS2aJBr3mwKXWVFidqJEg05Rka8zW8JrukhuV85RhuxIVe4GrWrPg+y1Vyi4N8cDM8ooYsAMtuPwFkih5xLGnflGYFzVCQZl4vmmVpx8HEPT6/iQaeYmwaEu4CEv+NRu4RCNcvTxdy/VaP6pyEA0kd98brgp9XGFkWJ1s/n+R9VquzfZl/GZGg4= X-Forefront-PRVS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lHJ/RssZNIpz1ZOBvdbEm3rXL7WdSwX/OQMiltdGbHR8aP4EcmwzHxMlXUt/sTAJgyZYKv098LZNlVrdbRloL3e58cEdd4jebVdtupiz6OAWDhvQy7JPN/v X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB1736; 6:5GjufMRtk4vSPQwPIFl3ubbXwUzH9qGj6xWP0XGIpLM7Ci0t3vnXGVNctig2In57bhUHEDec+HNoSglUTw3mfySCbhL30eukmfUmDa4Qg2yEubH9x0712nDDXWZdSRRZlgEVXoAnr0ho7lfxz8KL0zwfYg1kggoo6yG5rTPrMH9nEtGPNUDKk6mPMdigsHUuMdi1aLC4ZdG1GvK02pu8Qye753CInYPsDuZJ40+HE7ffCvbPKU4SKAHGel4eco6ha27SmCo9b3T6E1LqJscjUSJ+Tu+P/XIweZPPKPrk0yVbAzC2GVeKWat8ZQUznBM3tF8MUUYa4LoriTnOiZhlrMmDRs/DnSrF2bSwQ8w/pLJC/QINLR71fxYRrZD5eZgxAdAFJyQSxkDQgS/j6ldRqKvcTipUFrOPJ/kQD3jJ0hg=; 5:Yq8yqVK0yHjbiA2Osv8LqzgJytjOzg0I6/5qRfXr14OAA5rz+lVjvK09J686dzrbsHVQeLLuYyy+sDTnrIp94mAontFPHS4W00Wdk0/y+y53xv/NypBzNGbJ2RUH4gdCIMYpmQ0sl37m9LPOD0yQRMJ672/PGxAKsfkvvZql+I4=; 24:vz+y8mwWb0lHrFVwX7hM8GRymsZs6P+2MHHvCZdxyO7nMgYN3IH/A/iiEmsX9bmkSimaBhAhtcO48C8I7Uib6AXUB69jHJt8VILp+d8k6BQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB1736; 7:l5OpsLqdPcnU0MuCCcCEKAoNdsmpgWoqMu1PH8Kyu4hdi3MiM4pG11cvdapFGvEH0BzMMS3Y/uqDcBTmToKgnQCj/RVI0dz9Mt10Mg1I720S3OZKGwwUljpvvved3eeEeDfepK4od+CumPa4jbj1CEgqSEJsVIK1KbtlWNuGI1Zxekcyz4xBSoL3VhwufA8dq9hWDmcKzXUiIAtMfmSrM9/Xk/MsM/mSkCXVS1TGuWmtw9kDIcJZZN4uINpt371qO3xg54IAUCzydPaT/elfz2cUmdjmFlCfBPwKQrRWKI6j2lEjGSCOfk5Ur1C33mNlkPb7GX54hfSzfJ3hy7kC3WqgZB5iT+LfMZWxGM+1j32iiEvOQXbMUWKZ1e0F1+gXxcN68E5mgwCLD1DKwllWmMcbpWKWmT4WMisUGaxTdYxBDliHwI0CEBElveDw3JM2CJvLd3kNDXNnmKILwZjSDImhYMQEhhnIy4a1Yn3+XNoqAosGtRXRkhGph6PZqsiXXfGRPjvoGGCFP82SPkshrA== X-OriginatorOrg: nokia.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2017 12:54:05.4841 (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: DB6PR0701MB1736 Subject: [lng-odp] [API-NEXT PATCH 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 | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) -- 2.8.1 diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index b6450c1..05ffd68 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,16 @@ 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. However, some of those calls may implement the + * new reference as a packet copy. 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 *