From patchwork Thu Apr 14 21:06:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 65848 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp825076qge; Thu, 14 Apr 2016 14:06:52 -0700 (PDT) X-Received: by 10.140.106.199 with SMTP id e65mr3825532qgf.73.1460668012239; Thu, 14 Apr 2016 14:06:52 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w5si12947854qkb.109.2016.04.14.14.06.51; Thu, 14 Apr 2016 14:06:52 -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; 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 dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id A7C0C68625; Thu, 14 Apr 2016 21:06:51 +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_H3, RCVD_IN_MSPIKE_WL, 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 8CC15684E6; Thu, 14 Apr 2016 21:06:47 +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 E4009684E6; Thu, 14 Apr 2016 21:06:44 +0000 (UTC) Received: from mail-oi0-f45.google.com (mail-oi0-f45.google.com [209.85.218.45]) by lists.linaro.org (Postfix) with ESMTPS id 378D46846D for ; Thu, 14 Apr 2016 21:06:44 +0000 (UTC) Received: by mail-oi0-f45.google.com with SMTP id w85so106194973oiw.0 for ; Thu, 14 Apr 2016 14:06:44 -0700 (PDT) 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; bh=KUPYZaZAlCsBV8SkkfkoQn1vq/L+S+t1poDwCJbMX4k=; b=liDz0xazu1yzY+4GX5D/5UnkJmVYHEE7grRnWTq8dHRiE+vGD5O1Wlqrq350HMrlkk IgKBBe9h5x8dgqet3xfdBlhKH9eusn9FcN6C3pUFEoeyag5+wXQgOwii9RXjN+Msb39G yZQ8qLzM9qPc2LpXFcDLYaS1KYFKIkc2CEtiCu+mQhHaGWekJ8bQrcat2spYMCAftQjr 3crnhzUKRYYt0vILVh5CEQbO7U8v5foTJaFqNnwnv93aN2iddSSO4PYwvuKR5kRbPyku BLNRTjIfl01Mx3Tbck9BiynP6HITcu4EWYhOqPxXfYjgo+innetXFWbWIQgob/+LbXSG UcpQ== X-Gm-Message-State: AOPr4FW4leV44NAeuKZG9JrC5929RHBIIIpESCUsp9YW4lM8RpWV0RGoEX8DsObke1JUyiIHDjE= X-Received: by 10.157.41.70 with SMTP id d64mr9393120otb.116.1460668003632; Thu, 14 Apr 2016 14:06:43 -0700 (PDT) Received: from Ubuntu15.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id xm14sm13871138oeb.17.2016.04.14.14.06.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Apr 2016 14:06:43 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 14 Apr 2016 16:06:36 -0500 Message-Id: <1460668001-25533-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.5.0 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv2 1/6] api: pktio: add pktio index conversion APIs 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" Add the two APIs odp_pktio_to_index() and odp_pktio_from_index() to enable applications to convert PktIO handles to and from indices for managing user contexts and related associated data. Signed-off-by: Bill Fischofer --- include/odp/api/spec/packet_io.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index 466cab6..bb14c43 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -908,6 +908,26 @@ int odp_pktio_skip_set(odp_pktio_t pktio, uint32_t offset); int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t headroom); /** + * Get pktio index from handle + * + * @param pktio Pktio handle + * + * @return Pktio index (0..odp_config_pktio_entries()-1) + * @retval <0 Error (e.g., handle not valid) + */ +int odp_pktio_to_index(odp_pktio_t pktio); + +/** + * Get pktio handle from index + * + * @param ndx Pktio index + * + * @return Pktio handle + * @retval ODP_PKTIO_INVALID on error + */ +odp_pktio_t odp_pktio_from_index(int ndx); + +/** * Get printable value for an odp_pktio_t * * @param pktio odp_pktio_t handle to be printed