From patchwork Thu Dec 10 14:24:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 58211 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp524112lbb; Thu, 10 Dec 2015 06:24:43 -0800 (PST) X-Received: by 10.55.80.194 with SMTP id e185mr15446532qkb.68.1449757483647; Thu, 10 Dec 2015 06:24:43 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u33si15058696qgd.7.2015.12.10.06.24.43; Thu, 10 Dec 2015 06:24:43 -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 17499619AF; Thu, 10 Dec 2015 14:24:43 +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 3ED2C6194F; Thu, 10 Dec 2015 14:24:38 +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 71C6861959; Thu, 10 Dec 2015 14:24:36 +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 8C123618D7 for ; Thu, 10 Dec 2015 14:24:35 +0000 (UTC) Received: by lfaz4 with SMTP id z4so57819818lfa.0 for ; Thu, 10 Dec 2015 06:24:34 -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=1IHsdD549PqhErpDtZr1JVwfC+uP9wZZH3BQfQR6P3I=; b=QigUCNobwPMiRrW2qIidw3qXhgsHHMDsBTuyoC0TZQCuEGqrqA2Bk4hz5BPgFhkS6Z Fq2tzSx/afxZ2CdfLUsqPqbA5GBn4hPvgQd7GL3eK+277fNCNEs2kg7DkSI3Xl8QsQk4 CfYYsKWGcVN8WQGZpDPQFQMgyQevHUe/E2b9rnGnyB97RJ6b2ZnphKAcNbth/FgdvbI1 L1MafJLzysGBILaDOksBLQ9Qm8AWl4ciubfGgpo6Qaa4IxC0tWuBv5+5QXPEsFET4Vpc xt32ObGNRdB6t+GSuCOL3KMj3aB2XTFEc3T29j1EbUzbsJ1xqP2XyRO0GdwLz0NVaJok M0nw== 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=1IHsdD549PqhErpDtZr1JVwfC+uP9wZZH3BQfQR6P3I=; b=VpLvLdVBDwRO4NPn6N3xP2TkLM+4+cSR5KbvgC2FxHspcCokcaiHg5o4nO1k2kZVnz YvE2RQ+G0ySfxlY4yqBe6lvnhIlZxSlsj4ZC323GSYrKm68Xc8JyE9CrDDLMf6XXrdGH CWKgI00fyvI0UtfsOJnBhEc99PSn9I1DPzX1YiriDfVlbhU1BVMpUl7vfTaa06QNjs5p 6wU9KTFj17vqJGUzoUoxrwf8HiwfCkpUJXOE9Yb/HH21lZeK5wMp9bnujHu0yC3peKBZ tT7jcOgowLBnI1RX0cuNJ46vd02DwDgbOVH4Aayi3oUyORyuTJem1Ps2orzO454B6mHA GLGA== X-Gm-Message-State: ALoCoQkL/Atv7fghmky+lXz9XA0/FBx59vOUu9xXFqtS7/A3JIxgszV2iAWr2Tdt7KjKZF8RU0gDb/jjhZl9CuqDOHUugEJJyQ== X-Received: by 10.25.15.22 with SMTP id e22mr5357935lfi.92.1449757474420; Thu, 10 Dec 2015 06:24: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 xn8sm2364938lbb.41.2015.12.10.06.24.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Dec 2015 06:24:33 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 10 Dec 2015 17:24:17 +0300 Message-Id: <1449757466-6287-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449757466-6287-1-git-send-email-maxim.uvarov@linaro.org> References: <1449757466-6287-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv17 01/10] helper: ring: update ring with shm proc argument 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" Signed-off-by: Maxim Uvarov --- helper/include/odp/helper/ring.h | 2 ++ helper/ring.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/helper/include/odp/helper/ring.h b/helper/include/odp/helper/ring.h index 65c32ad..5e640a7 100644 --- a/helper/include/odp/helper/ring.h +++ b/helper/include/odp/helper/ring.h @@ -158,6 +158,8 @@ typedef struct odph_ring { #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 */ diff --git a/helper/ring.c b/helper/ring.c index 3122173..844abf7 100644 --- a/helper/ring.c +++ b/helper/ring.c @@ -158,8 +158,14 @@ odph_ring_create(const char *name, unsigned count, unsigned flags) char ring_name[ODPH_RING_NAMESIZE]; odph_ring_t *r; size_t ring_size; + uint32_t shm_flag; odp_shm_t shm; + if (flags & ODPH_RING_SHM_PROC) + shm_flag = ODP_SHM_PROC; + else + shm_flag = 0; + /* count must be a power of 2 */ if (!RING_VAL_IS_POWER_2(count) || (count > ODPH_RING_SZ_MASK)) { ODPH_ERR("Requested size is invalid, must be power of 2, and do not exceed the size limit %u\n", @@ -172,7 +178,8 @@ odph_ring_create(const char *name, unsigned count, unsigned flags) odp_rwlock_write_lock(&qlock); /* reserve a memory zone for this ring.*/ - shm = odp_shm_reserve(ring_name, ring_size, ODP_CACHE_LINE_SIZE, 0); + shm = odp_shm_reserve(ring_name, ring_size, ODP_CACHE_LINE_SIZE, + shm_flag); r = odp_shm_addr(shm);