From patchwork Fri Nov 20 18:40:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 57080 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp39545lbb; Fri, 20 Nov 2015 10:43:28 -0800 (PST) X-Received: by 10.140.31.73 with SMTP id e67mr15140752qge.46.1448045008686; Fri, 20 Nov 2015 10:43:28 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 136si808851qhc.39.2015.11.20.10.43.28; Fri, 20 Nov 2015 10:43:28 -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 5251A62003; Fri, 20 Nov 2015 18:43:28 +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 B2DF461FF8; Fri, 20 Nov 2015 18:41:22 +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 4105F6196D; Fri, 20 Nov 2015 18:41:13 +0000 (UTC) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) by lists.linaro.org (Postfix) with ESMTPS id 16D726196D for ; Fri, 20 Nov 2015 18:41:12 +0000 (UTC) Received: by lbbsy6 with SMTP id sy6so66772958lbb.2 for ; Fri, 20 Nov 2015 10:41:11 -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=hmmYyNOCNYPM914mzY2/GuMtSXhLlaFbQBTozSSgffI=; b=Jqjrqjsl3rbQ7DSoS7VZaOv67AaK1bu9etTAmHD86l9hfyjQfGiwqxgpaJ1nGHvf4z ohGlbSz2mw3/oyLduYjXR/lxKD3nDc4OD6V4WIL4p8XrllO/4nrmjBX2CAfLmYEX/ys5 HihCClzlQaOp46Y6UuDpVVo1r0yymGX/78Xiz68ff4UOtLp0pDrH6Fghdl5EBDjvmW3S si2PPGPsrz2swBUrExCDC8BBkoP0hg8v4qcNv3rrns+CccDwlZZmhRhrxXsGFqIg5bJ1 HAXebPzmfdTzfMCcdcsogWV1iQumfqg4t7dcFQJUDJ88+jD+ckuiq9axjts3McX233N6 RGNQ== 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=hmmYyNOCNYPM914mzY2/GuMtSXhLlaFbQBTozSSgffI=; b=ESiolJ23tRyQbqDi5dFxhIgta00qBOk2zK5UGfprWDluEi6L6JYHstRNf+NOZxtNm4 r8MxR9Oocayc3zrJqHjkpg3eppVU7GOReOZ/muvYwXzz+AXS0oqOiIoN6hFMbGCv3qAD c7iMETHFWPdrZCCRiM3rOcO3t0WSPkIz3M17ndLxfYLNL9ngSSp5HhoIWOubztjNHCrK 18mW6tVczqRBYRiOblvb0bQscfGKySvR3twUYAS1Xos/LHIdWuLghd3zB613grz4CY4t 8sH/n73IzWJhMPWVQCLgFl4Tgi+eZ/iPBddbvNgACmRivevp5aM/okqyzq0NwWqK6CVA TNTA== X-Gm-Message-State: ALoCoQl/z5rXqi5EbclqSe1mQZCgsdQHztTPnbhFzjHUy7kq/Z3F0hAXs30OxEo0+k2f3NrTof3u X-Received: by 10.112.123.208 with SMTP id mc16mr6505206lbb.107.1448044870934; Fri, 20 Nov 2015 10:41:10 -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 70sm105460lfw.2.2015.11.20.10.41.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Nov 2015 10:41:10 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 20 Nov 2015 21:40:59 +0300 Message-Id: <1448044865-8229-4-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448044865-8229-1-git-send-email-maxim.uvarov@linaro.org> References: <1448044865-8229-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv15 3/9] helper: flag to not link ring to linked list 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 flag ODPH_RING_NO_LIST to ring to not link it to linked list. Signed-off-by: Maxim Uvarov --- helper/include/odp/helper/ring.h | 21 +++++++++++++-------- helper/ring.c | 3 ++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/helper/include/odp/helper/ring.h b/helper/include/odp/helper/ring.h index 5e640a7..541a466 100644 --- a/helper/include/odp/helper/ring.h +++ b/helper/include/odp/helper/ring.h @@ -155,14 +155,19 @@ typedef struct odph_ring { void *ring[0] ODP_ALIGNED_CACHE; } odph_ring_t; - -#define ODPH_RING_F_SP_ENQ 0x0001 /* The default enqueue is "single-producer".*/ -#define ODPH_RING_F_SC_DEQ 0x0002 /* The default dequeue is "single-consumer".*/ -#define ODPH_RING_SHM_PROC 0x0004 /* If set - ring is visible from different - processes. Default is thread visible. */ -#define ODPH_RING_QUOT_EXCEED (1 << 31) /* Quota exceed for burst ops */ -#define ODPH_RING_SZ_MASK (unsigned)(0x0fffffff) /* Ring size mask */ - +/* The default enqueue is "single-producer".*/ +#define ODPH_RING_F_SP_ENQ (1 << 0) +/* The default dequeue is "single-consumer".*/ +#define ODPH_RING_F_SC_DEQ (1 << 1) +/* If set - ring is visible from different processes. + * Default is thread visible.*/ +#define ODPH_RING_SHM_PROC (1 << 2) + /* Do not link ring to linked list. */ +#define ODPH_RING_NO_LIST (1 << 3) +/* Quota exceed for burst ops */ +#define ODPH_RING_QUOT_EXCEED (1 << 31) +/* Ring size mask */ +#define ODPH_RING_SZ_MASK (unsigned)(0x0fffffff) /** * Create a new ring named *name* in memory. diff --git a/helper/ring.c b/helper/ring.c index 844abf7..e113606 100644 --- a/helper/ring.c +++ b/helper/ring.c @@ -199,7 +199,8 @@ odph_ring_create(const char *name, unsigned count, unsigned flags) r->prod.tail = 0; r->cons.tail = 0; - TAILQ_INSERT_TAIL(&odp_ring_list, r, next); + if (!(flags & ODPH_RING_NO_LIST)) + TAILQ_INSERT_TAIL(&odp_ring_list, r, next); } else { ODPH_ERR("Cannot reserve memory\n"); }