From patchwork Thu Jan 7 14:50:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 59286 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp596533lbb; Thu, 7 Jan 2016 06:51:04 -0800 (PST) X-Received: by 10.55.207.217 with SMTP id v86mr1287244qkl.16.1452178264055; Thu, 07 Jan 2016 06:51:04 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id y17si5558646qgd.82.2016.01.07.06.51.03; Thu, 07 Jan 2016 06:51:04 -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; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id A0E5061915; Thu, 7 Jan 2016 14:51:03 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=Dwi82+HD; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, 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 674E261A23; Thu, 7 Jan 2016 14:50: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 6625E618F0; Thu, 7 Jan 2016 14:50:25 +0000 (UTC) Received: from mail-oi0-f46.google.com (mail-oi0-f46.google.com [209.85.218.46]) by lists.linaro.org (Postfix) with ESMTPS id 5B19F6194D for ; Thu, 7 Jan 2016 14:50:23 +0000 (UTC) Received: by mail-oi0-f46.google.com with SMTP id l9so287034495oia.2 for ; Thu, 07 Jan 2016 06:50:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sk3EsCR63vHCiU2JTjbcgU19Cp7ugUPdaB6gAlloRDw=; b=Dwi82+HDZkERI3rkTo3BD/t8JgKWB/IsybPxCy4bIO7VnZScW30UfnhYmM3Ogzxr+c nLyVCvaDLivOxP7bSkNeA6jJi0NwxVHIOzQzhYdePhc2H4v9BHQYotPf+WRsOKkm0eUN goVl5Ie7L0pZqAuhrs37fZQ+FCxAwCAg/n2iM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sk3EsCR63vHCiU2JTjbcgU19Cp7ugUPdaB6gAlloRDw=; b=FWdCNhEpWNZsDA9PD7wLBPgIYmU59jva6ZPM0me/eOgcQ6Wkd2KIt0rUQQP0jZzFfG t3GrVfdBUcC7DQlnGK7GpFpYQ+LQfDvqixReALVRxmUrjHWWtXTOLUyVAwaJU/IJfJOU x0eXyAos1yJmmrgoYIKfJuVhqJYKjNQUrTjlzEeQh9MuiDgqXRCgD+ihZwNYbaNJLAsN Ka3jDGNwiFN1Uum3JXvXrsp4gVzYLt7g/n3W+uMWBw31oro0j4vQTET+F4F7et6ZDpoG aWH/RYOkH6sA+PfmjyDscfKNfCjZiUc48ZGTvm0iNFHyJTNemvcC9ruZFmnisD1jCDr4 A+iw== X-Gm-Message-State: ALoCoQl9LoAnNzzeRfvChBOoR0gjQ8zGcN3KTKSlOwCDoPg/IiFlOYv6QQ3/Ee7rgLv4ArHkzprT3Ob0sgb4Oaz2mccQWmz2ew== X-Received: by 10.202.197.21 with SMTP id v21mr61115823oif.35.1452178222942; Thu, 07 Jan 2016 06:50:22 -0800 (PST) Received: from Ubuntu15.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id v3sm40948819oeq.14.2016.01.07.06.50.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jan 2016 06:50:22 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 7 Jan 2016 08:50:13 -0600 Message-Id: <1452178213-23805-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1452178213-23805-1-git-send-email-bill.fischofer@linaro.org> References: <1452178213-23805-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [RFC API-NEXT PATCH] api: packet: add packet references and composites 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Signed-off-by: Bill Fischofer --- include/odp/api/packet.h | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h index 8651a47..4e62453 100644 --- a/include/odp/api/packet.h +++ b/include/odp/api/packet.h @@ -177,6 +177,37 @@ odp_packet_t odp_packet_from_event(odp_event_t ev); */ odp_event_t odp_packet_to_event(odp_packet_t pkt); +/** + * Reference share modes + * + * Used to specify whether a packet reference is shared or nonshared. Header + * changes made by push/pull operations via shared references are seen by all + * other shared references to that packet. Header changes made by push/pull + * operations via nonshared references are unique to that reference and not + * seen by other references to that packet. + */ +typedef enum odp_packet_share_t { + ODP_SHARED_HEADERS, + ODP_NONSHARED_HEADERS, +} odp_packet_share_t; + +/** + * Generate a packet reference + * + * Obtain another handle that refers to the same packet. A reference enables + * an application to retain access to a packet for things like multicasting or + * retransmission, as the packet will be retained until each reference to it + * is released via odp_packet_free(). References may be either shared or + * nonshared. + * + * @param pkt packet handle + * + * @param share share mode + * + * @return packet handle that is a reference to the input packet + */ +odp_packet_t odp_packet_ref(odp_packet_t pkt, odp_packet_share_t share); + /* * * Pointers and lengths @@ -428,6 +459,73 @@ void *odp_packet_offset(odp_packet_t pkt, uint32_t offset, uint32_t *len, odp_packet_seg_t *seg); /* + * Packet Compositing + * ******************************************************** + */ + +/** + * Push a packet prefix + * + * Create a packet composite by prefixing one packet to another. + * + * @param pkt Base packet handle + * + * @param prefix Packet to be prefixed to pkt + * + * @return Handle to the resulting packet composite + * @retval ODP_PACKET_INVALID Operation failed + */ +odp_packet_t odp_packet_push_prefix(odp_packet_t pkt, odp_packet_t prefix); + +/** + * Pull a packet prefix from a composite packet. + * + * Decomposite a packet by removing a packet prefix + * + * @param pkt Base packet handle + * + * @param prefix Packet prefix to be pulled + * + * @return Handle to the resulting packet composite + * @retval ODP_PACKET_INVALID Operation failed + */ +odp_packet_t odp_packet_pull_prefix(odp_packet_t pkt, odp_packet_t prefix); + +/** + * Create a packet composite by suffixing one packet to another. + * + * @param pkt Base packet handle + * + * @param suffix Packet to be suffixed to pkt + * + * @return Handle to the resulting packet composite + * @retval ODP_PACKET_INVALID Operation failed + */ +odp_packet_t odp_packet_push_suffix(odp_packet_t pkt, odp_packet_t suffix); + +/** + * Pull a packet suffix from a composite packet. + * + * @param pkt Base packet handle + * + * @param suffix Packet suffix to be pulled + * + * @return Handle to the resulting packet composite + * @retval ODP_PACKET_INVALID Operation failed + */ +odp_packet_t odp_packet_pull_suffix(odp_packet_t pkt, odp_packet_t suffix); + +/** + * Indicate whether a packet is a composite + * + * @param pkt Packet handle + * + * @retval 0 Packet is not a composite + * @retval 1 Packet is a composite + */ +int odp_packet_is_composite(odp_packet_t pkt); + +/* * * Meta-data * ********************************************************