From patchwork Mon Nov 23 11:29:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 57144 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1376792lbb; Mon, 23 Nov 2015 03:34:10 -0800 (PST) X-Received: by 10.55.79.69 with SMTP id d66mr11816603qkb.76.1448278450272; Mon, 23 Nov 2015 03:34:10 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id s8si10805079qhb.19.2015.11.23.03.34.10; Mon, 23 Nov 2015 03:34:10 -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.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id E7475618F0; Mon, 23 Nov 2015 11:34:09 +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.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 EB0F961B50; Mon, 23 Nov 2015 11:30:08 +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 1144D61900; Mon, 23 Nov 2015 11:30:02 +0000 (UTC) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com [209.85.215.52]) by lists.linaro.org (Postfix) with ESMTPS id C248661900 for ; Mon, 23 Nov 2015 11:29:14 +0000 (UTC) Received: by lfdl133 with SMTP id l133so24087927lfd.2 for ; Mon, 23 Nov 2015 03:29:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7RfxZxBORKzsa2s34jYyT0AnqQNYVbLEFIfcds061i0=; b=l/fcrW1k7lg6z+TiAsGw2coSxGe+n1zoAEYb53PZ9mWD3dbXZ1uF2tOcrwnI2eNRPJ +f1rkcbx8pIrSozP+wqD0QvpJAUTDsmA5G0Cde6YRH6F6MNFdwXD9UAATb1QXQMUsnRE 0TmTdTddB5RcqYWR03H30KLwnQCcV4tA9u0Bf/JvCwDVWZD2BQmlChJtTdFhfE8QK6Ou oMwRHTEikma0YP+HRwGbpp+j1WwHrpYDr6k7uuARW/ACCab9wqLvcGcZVp3XQn29pK+z YyJ1N/7tgvDov3Rjh2iAHaQOoEj+Wx9z4/X2cIHLuHDSBal1a+qgbK9fMbC/btrF2iQN rXnA== 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=7RfxZxBORKzsa2s34jYyT0AnqQNYVbLEFIfcds061i0=; b=E80ULl7fzl0RzDQCDbG+DQ3BKU4nArQI6/eCQDy73cw9oo9lW7/pBrIvhTgIOS8aJb 5NlYA3Db5PZJsD15EqhZ0u1WFMwziVd9xAtAcB1Omh3TusaujxTWdHbMZzRQYPxcKHQp 25JHF8p/2+DhGG0G7xvqki6kFCndsn/uF3gK+XnBXRYxHnV6APDcnAs2TgLqh5EdOdyP 2sGnwchSARKaywg5UMSs6xEbHHC1b7Ki/cNzjfz6mQ3Y/wuXYDNHe2Q32x4ZTE4Op0zu zNBTxZdn7uhyhfGu5+bZyJdJWbGVoTDIK44Jf9B+U2kxdD1BKMoteN1CxdNYBOVkoApo YKFQ== X-Gm-Message-State: ALoCoQlnh9M0B1utear3xHneJQ8vqQt8f0dea03QMm5MznnB+mh6Lzew77gfnGbHZbpKj4VF3/nq X-Received: by 10.25.85.200 with SMTP id j191mr10743585lfb.131.1448278153712; Mon, 23 Nov 2015 03:29:13 -0800 (PST) Received: from localhost.localdomain (ppp91-76-161-180.pppoe.mtu-net.ru. [91.76.161.180]) by smtp.gmail.com with ESMTPSA id 70sm1817754lfw.2.2015.11.23.03.29.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Nov 2015 03:29:13 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 23 Nov 2015 14:29:02 +0300 Message-Id: <1448278144-31994-9-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448278144-31994-1-git-send-email-maxim.uvarov@linaro.org> References: <1448278144-31994-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv16 08/10] helper: ring: return errno and do not use ODPH_DBG if helper is used by implementation 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" Accodring to doxygen comment if right creation fails __odp_errno should be set. __odp_errno is implementation only variable. So just keep original code for helper and set correct __odp_errno for implementation. Signed-off-by: Maxim Uvarov --- helper/ring.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/helper/ring.c b/helper/ring.c index e37d33e..694e731 100644 --- a/helper/ring.c +++ b/helper/ring.c @@ -75,10 +75,14 @@ #include #include #include -#include "odph_debug.h" #include #include #include +#ifdef PLATFORM +#include +#else +#include "odph_debug.h" +#endif static TAILQ_HEAD(, odph_ring) odp_ring_list; @@ -168,8 +172,12 @@ odph_ring_create(const char *name, unsigned count, unsigned flags) /* count must be a power of 2 */ if (!RING_VAL_IS_POWER_2(count) || (count > ODPH_RING_SZ_MASK)) { +#ifdef PLATFORM + __odp_errno = EINVAL; +#else ODPH_ERR("Requested size is invalid, must be power of 2, and do not exceed the size limit %u\n", ODPH_RING_SZ_MASK); +#endif return NULL; } @@ -202,7 +210,11 @@ odph_ring_create(const char *name, unsigned count, unsigned flags) if (!(flags & ODPH_RING_NO_LIST)) TAILQ_INSERT_TAIL(&odp_ring_list, r, next); } else { +#ifdef PLATFORM + __odp_errno = ENOMEM; +#else ODPH_ERR("Cannot reserve memory\n"); +#endif } odp_rwlock_write_unlock(&qlock); @@ -537,6 +549,7 @@ unsigned odph_ring_free_count(const odph_ring_t *r) return (cons_tail - prod_tail - 1) & r->prod.mask; } +#ifndef PLATFORM /* dump the status of the ring on the console */ void odph_ring_dump(const odph_ring_t *r) { @@ -568,6 +581,7 @@ void odph_ring_list_dump(void) odp_rwlock_read_unlock(&qlock); } +#endif /* search a ring from its name */ odph_ring_t *odph_ring_lookup(const char *name)