From patchwork Mon Oct 19 16:07:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 55238 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f70.google.com (mail-lf0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 00BC722F11 for ; Mon, 19 Oct 2015 16:09:07 +0000 (UTC) Received: by lffv3 with SMTP id v3sf43172382lff.1 for ; Mon, 19 Oct 2015 09:09:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=AkPRpLA3B8mAvW0Io4tJ4JtmBitGnkabkY6IkmSQzzQ=; b=TWLM0RpboRvrUoynNHQlX6leWhmJoxzNLUYlmgy84ZW1c0M5zCGW5KQuZ1VuqExzpA Wxi/BtlJte120RCzMtXKtK4PSu/i3W8BVrVWTH6nJqDk8DtOXW3mGosQo0EcVwUd1I4y /XSf54X5blyQWH04F2p1C8Obe/ad24e0U2uHQT5CtPlCkXZwthxx7Hg4TMpbJlp5yb8q kXLS1PzYOVBrJABJukWFQxvZTpHGVUnesR/ntbWn5rqwd1wP9YE1JRLUKtdGUBlpi7B8 QgHPAnawlVxu3X2CXyYiHLKIDLsMZTztZVhI8P3wQNlD/OfArGlLidAvOp10HoIhqWY3 vpNQ== X-Gm-Message-State: ALoCoQloayyYIEDDKGZXOpiI+qmPdeTf4XGMU8fyV1S1LbeQntr0oeZ+llsPeeyg/dfo6F3JUjbh X-Received: by 10.112.145.227 with SMTP id sx3mr1988618lbb.12.1445270945877; Mon, 19 Oct 2015 09:09:05 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.147.66 with SMTP id v63ls633948lfd.22.gmail; Mon, 19 Oct 2015 09:09:05 -0700 (PDT) X-Received: by 10.25.78.80 with SMTP id c77mr1938379lfb.18.1445270945590; Mon, 19 Oct 2015 09:09:05 -0700 (PDT) Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com. [2a00:1450:4010:c07::232]) by mx.google.com with ESMTPS id qd5si23380912lbb.83.2015.10.19.09.09.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 09:09:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c07::232 as permitted sender) client-ip=2a00:1450:4010:c07::232; Received: by lffv3 with SMTP id v3so114747883lff.0 for ; Mon, 19 Oct 2015 09:09:05 -0700 (PDT) X-Received: by 10.25.40.130 with SMTP id o124mr9704506lfo.41.1445270945379; Mon, 19 Oct 2015 09:09:05 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1560460lbq; Mon, 19 Oct 2015 09:09:04 -0700 (PDT) X-Received: by 10.140.151.73 with SMTP id 70mr40148784qhx.36.1445270942854; Mon, 19 Oct 2015 09:09:02 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b51si30765819qgf.68.2015.10.19.09.09.02; Mon, 19 Oct 2015 09:09:02 -0700 (PDT) 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; Received: by lists.linaro.org (Postfix, from userid 109) id 652F561C6A; Mon, 19 Oct 2015 16:09:02 +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 659A861C6D; Mon, 19 Oct 2015 16:08:16 +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 C74A26197B; Mon, 19 Oct 2015 16:08:11 +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 AEA4E61942 for ; Mon, 19 Oct 2015 16:08:10 +0000 (UTC) Received: by lfaz124 with SMTP id z124so114384861lfa.1 for ; Mon, 19 Oct 2015 09:08:09 -0700 (PDT) X-Received: by 10.25.153.147 with SMTP id b141mr10148253lfe.59.1445270889632; Mon, 19 Oct 2015 09:08:09 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-161-180.pppoe.mtu-net.ru. [91.76.161.180]) by smtp.gmail.com with ESMTPSA id k186sm1732158lfg.8.2015.10.19.09.08.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Oct 2015 09:08:09 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 19 Oct 2015 19:07:56 +0300 Message-Id: <1445270883-8069-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445270883-8069-1-git-send-email-maxim.uvarov@linaro.org> References: <1445270883-8069-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv10 1/8] 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: 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" X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c07::232 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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);