From patchwork Mon Nov 9 07:55:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wallen, Carl \(Nokia - FI/Espoo\)" X-Patchwork-Id: 56186 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp40510lbb; Sun, 8 Nov 2015 23:57:12 -0800 (PST) X-Received: by 10.55.217.27 with SMTP id u27mr28264265qki.55.1447055832094; Sun, 08 Nov 2015 23:57:12 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z203si10225121qka.44.2015.11.08.23.57.11; Sun, 08 Nov 2015 23:57:12 -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 Received: by lists.linaro.org (Postfix, from userid 109) id BA339619EE; Mon, 9 Nov 2015 07:57:11 +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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 7BB1461A01; Mon, 9 Nov 2015 07:56:12 +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 CDEB1619F6; Mon, 9 Nov 2015 07:56:06 +0000 (UTC) Received: from demumfd002.nsn-inter.net (demumfd002.nsn-inter.net [93.183.12.31]) by lists.linaro.org (Postfix) with ESMTPS id 6D1BB619EE for ; Mon, 9 Nov 2015 07:56:05 +0000 (UTC) Received: from demuprx016.emea.nsn-intra.net ([10.150.129.55]) by demumfd002.nsn-inter.net (8.15.2/8.15.2) with ESMTPS id tA97u3DF019466 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 9 Nov 2015 07:56:04 GMT Received: from 10.144.19.15 ([10.144.164.243]) by demuprx016.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id tA97u0rK024441 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Mon, 9 Nov 2015 08:56:03 +0100 From: Carl Wallen To: lng-odp@lists.linaro.org Date: Mon, 9 Nov 2015 09:55:56 +0200 Message-Id: <1447055757-8654-3-git-send-email-carl.wallen@nokia.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447055757-8654-1-git-send-email-carl.wallen@nokia.com> References: <1447055757-8654-1-git-send-email-carl.wallen@nokia.com> X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 1481 X-purgate-ID: 151667::1447055764-00006110-C14588FE/0/0 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 2/3] linux-generic: queue: add odp_queue_info() function 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" Retrieve queue name and params. Signed-off-by: Carl Wallen --- platform/linux-generic/odp_queue.c | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) -- 2.1.4 diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 1c15e17..90e8972 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -1045,3 +1045,43 @@ void odp_schedule_order_unlock(unsigned lock_index) /* Release the ordered lock */ odp_atomic_fetch_inc_u64(&origin_qe->s.sync_out[lock_index]); } + +int odp_queue_info(odp_queue_t handle, odp_queue_info_t *info) +{ + uint32_t queue_id; + queue_entry_t *queue; + int status; + + if (odp_unlikely(info == NULL)) { + ODP_ERR("Unable to store info, NULL ptr given\n"); + return -1; + } + + queue_id = queue_to_id(handle); + + if (odp_unlikely(queue_id >= ODP_CONFIG_QUEUES)) { + ODP_ERR("Invalid queue handle:%" PRIu64 "\n", + odp_queue_to_u64(handle)); + return -1; + } + + queue = get_qentry(queue_id); + + LOCK(&queue->s.lock); + status = queue->s.status; + + if (odp_unlikely(status == QUEUE_STATUS_FREE || + status == QUEUE_STATUS_DESTROYED)) { + UNLOCK(&queue->s.lock); + ODP_ERR("Invalid queue status:%d\n", status); + return -1; + } + + info->name = queue->s.name; + info->type = queue->s.type; + info->param = queue->s.param; + + UNLOCK(&queue->s.lock); + + return 0; +}