From patchwork Wed Feb 10 13:08:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 61660 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp2633892lbl; Wed, 10 Feb 2016 05:11:15 -0800 (PST) X-Received: by 10.55.40.92 with SMTP id o89mr16903874qkh.36.1455109875811; Wed, 10 Feb 2016 05:11:15 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b110si3654583qgf.45.2016.02.10.05.11.15; Wed, 10 Feb 2016 05:11:15 -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 Received: by lists.linaro.org (Postfix, from userid 109) id 5B7FA61CD3; Wed, 10 Feb 2016 13:11:15 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=OKiLLTa1; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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 5D99266733; Wed, 10 Feb 2016 13:08:45 +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 2AA0961808; Wed, 10 Feb 2016 13:08:39 +0000 (UTC) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) by lists.linaro.org (Postfix) with ESMTPS id 9566361808 for ; Wed, 10 Feb 2016 13:08:35 +0000 (UTC) Received: by mail-lf0-f42.google.com with SMTP id l143so11261672lfe.2 for ; Wed, 10 Feb 2016 05:08:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VKjbMDWPp72Sj/k8skbsF2a7IOuDUNY0BMSii1I8bR4=; b=OKiLLTa1oG1XAfTA3aqwtg1Aa0t3mI7epfG9L8kQVpOj9/Fdbkd5Yta4HByc9aZy80 yuxJZp4vQHzzs5Sm5KZfclOKD89nrUIcxeEgNWVe3J+W5Wm0fHWhYdfOl2IV4d63ghbA ngkD+w4tEm0gTLZ6UgYqT/2XrG2zT38BxfF6Q= 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=VKjbMDWPp72Sj/k8skbsF2a7IOuDUNY0BMSii1I8bR4=; b=Mel2Gno9LEyMma6ewd7Ipljhv2FNrGTixDFo/YyoOcMgrGZXK7uAdNmwaFzAwaBOzP gkindJyVS+QS57k/0U32xMo2W6n9+UC/OtmVTc3jmpvkkJUG6/ccB3Mq2W2LCLfekcvb aadiPo4LnD7h9UnV0aWivMvWNEPF4NR19ojctSp9DNn4UtvunOV3/+xgil0nulePz4sr 47HQ8tW7udCd9cHNRbEK9IE+HYgI33PnMqOyCKKPOnmRMw8JWBEnBx9nQjyInKsUmZYc KTXM4GWaEkyEb4qGUhRWWQj7RX7ECy2eQz/ocvzZUmNNOCmELEKsWlfPB3AVF1BO5ebB OYIQ== X-Gm-Message-State: AG10YOQT/XrdwvpEVT+Zrv1P3sRxw1VRBF0ShRlAZTCKGZ/zkVPck0+Q5GIWN3Iz287Roj4K35I= X-Received: by 10.25.32.16 with SMTP id g16mr13429159lfg.82.1455109714474; Wed, 10 Feb 2016 05:08:34 -0800 (PST) Received: from localhost.localdomain (ppp91-76-173-134.pppoe.mtu-net.ru. [91.76.173.134]) by smtp.gmail.com with ESMTPSA id y3sm454147lbk.40.2016.02.10.05.08.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Feb 2016 05:08:33 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 10 Feb 2016 16:08:19 +0300 Message-Id: <1455109705-5871-4-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.7.1.250.gff4ea60 In-Reply-To: <1455109705-5871-1-git-send-email-maxim.uvarov@linaro.org> References: <1455109705-5871-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv20 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 6364e51..51547cd 100644 --- a/helper/ring.c +++ b/helper/ring.c @@ -195,7 +195,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"); }