From patchwork Fri Oct 9 12:59:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 54702 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id C0C4522FFC for ; Fri, 9 Oct 2015 13:02:10 +0000 (UTC) Received: by lbwr8 with SMTP id r8sf39522946lbw.0 for ; Fri, 09 Oct 2015 06:02:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=X85o9Q9gLSehbjGxyB6pXSLZWmBI2Ef0g4mGf6UZfO4=; b=a1A08cZPBV+x7lbtLGhnIIwSK2Mg60JcBIghU0OpvLriQF8sEnL5SiVM8ZNnQJeCC8 7Rz5c3k3GqH7HOyt3s/Q2cHjrbsU10zO47SC240/sH4aK9+rTKQYUwr2nvkVnzXM9vmN 3UJIG8J5Gjhhouvrd3Y8WcnF4h01y28bVf+C30zI3OQesJMnIDpJ13ZdSZfT5Ahm5IRS UzyOpWiHleQwFjNxTbwMN3Ivdnq4Sz6pNZjAVA3AHEv1AeZZqdnRVJjaTvbbT+/VUSrP 420ylLsgtyDqF/cl17FB7J6wkz6kp40TI1bP4dUP7LdxBEaMSIdpgWvYnFjpH1ZKbQ3L a+qQ== X-Gm-Message-State: ALoCoQkBhF0N5TXZ+c5nWQmYO/SZ1ybivzPBYCGz7R7HHvYir9EhI/KbH2CUukV9Ewhqf7o69hAL X-Received: by 10.194.156.193 with SMTP id wg1mr2597632wjb.3.1444395729688; Fri, 09 Oct 2015 06:02:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.22.31 with SMTP id m31ls304337lfi.21.gmail; Fri, 09 Oct 2015 06:02:09 -0700 (PDT) X-Received: by 10.25.141.198 with SMTP id p189mr4342620lfd.9.1444395729538; Fri, 09 Oct 2015 06:02:09 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id je10si1137620lbc.77.2015.10.09.06.02.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Oct 2015 06:02:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbwr8 with SMTP id r8so79386929lbw.2 for ; Fri, 09 Oct 2015 06:02:09 -0700 (PDT) X-Received: by 10.112.202.35 with SMTP id kf3mr6518867lbc.19.1444395729349; Fri, 09 Oct 2015 06:02:09 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1194723lbq; Fri, 9 Oct 2015 06:02:08 -0700 (PDT) X-Received: by 10.50.73.8 with SMTP id h8mr10606979igv.94.1444395728412; Fri, 09 Oct 2015 06:02:08 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b80si2457544ioe.177.2015.10.09.06.02.07; Fri, 09 Oct 2015 06:02:08 -0700 (PDT) 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; Received: by lists.linaro.org (Postfix, from userid 109) id B061C61A37; Fri, 9 Oct 2015 13:02:07 +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, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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 5740E61A4E; Fri, 9 Oct 2015 12:59:27 +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 B1ECA6182D; Fri, 9 Oct 2015 12:59:15 +0000 (UTC) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com [209.85.217.171]) by lists.linaro.org (Postfix) with ESMTPS id 0305B61818 for ; Fri, 9 Oct 2015 12:59:10 +0000 (UTC) Received: by lbcao8 with SMTP id ao8so80504093lbc.3 for ; Fri, 09 Oct 2015 05:59:09 -0700 (PDT) X-Received: by 10.112.53.131 with SMTP id b3mr6648411lbp.55.1444395548971; Fri, 09 Oct 2015 05:59:08 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-161-180.pppoe.mtu-net.ru. [91.76.161.180]) by smtp.gmail.com with ESMTPSA id h196sm271039lfg.21.2015.10.09.05.59.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Oct 2015 05:59:08 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 9 Oct 2015 15:59:04 +0300 Message-Id: <1444395547-13968-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444395547-13968-1-git-send-email-maxim.uvarov@linaro.org> References: <1444395547-13968-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv4 1/4] api: packet reference count support X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Add api for packet reference count support. Which is useful in case: - multicast support - TCP retransmission - traffic generator Introduced new call: newpkt = odp_packet_create_ref(pkt) which creates reference to original packet, but handles for reference packet and original are different. Signed-off-by: Maxim Uvarov --- include/odp/api/config.h | 5 +++++ include/odp/api/packet.h | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/include/odp/api/config.h b/include/odp/api/config.h index 295b10d..985290a 100644 --- a/include/odp/api/config.h +++ b/include/odp/api/config.h @@ -126,6 +126,11 @@ extern "C" { */ #define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN*6) +/** + * Maximum packet references. + */ +#define ODP_CONFIG_PACKET_REFS 2 + /** Maximum number of shared memory blocks. * * This the the number of separate SHM areas that can be reserved concurrently diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h index 5d46b7b..f9745fb 100644 --- a/include/odp/api/packet.h +++ b/include/odp/api/packet.h @@ -125,6 +125,15 @@ odp_packet_t odp_packet_from_event(odp_event_t ev); */ odp_event_t odp_packet_to_event(odp_packet_t pkt); +/** + * Create reference for packet handle + * + * @param pkt Packet handle + * + * @return New packet handle + */ +odp_packet_t odp_packet_create_ref(odp_packet_t pkt); + /* * * Pointers and lengths