From patchwork Fri May 8 09:57:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 48164 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ACF262121F for ; Fri, 8 May 2015 09:59:05 +0000 (UTC) Received: by lbos2 with SMTP id s2sf19677908lbo.2 for ; Fri, 08 May 2015 02:59:04 -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=Qe4t2EH42vKjPmiQPxFQOgk75Un1Bk+wNC0MIP9JbEs=; b=QRhDLe4S89gNLoOL2Q57TAxh/FelXBnu/mApjhAr1eD8ias818T+maO3QifzSXFTSm 7dNTOvgvKH5Tv/2hwkJew8WXCPi65DJ0C8JO7lLmF3Tkfoui8HdGeSUWSeL65g/sFdVM HltRrwLYlv5fhAL2QOS3aGwO2uXaz57HEKLUYuIDypbo1b8kcDW6qVBSRyiA672c32v0 EqhBttWIX5dX3uq9I/1L87LRuQLN18RX+/UggKFrcoDZMFbDFjMxuv6de0b7Q3aHVZGZ 0jXiTx+pdvBYiThK9FxROFBDOUn+qsNCm0ymsNy2tCpv+MTEbiZtFFGGlVUcVeYLWnwg ljYA== X-Gm-Message-State: ALoCoQmLAheX0RzD6zWq3VMbiBc52vkt8zzBC3HR3kua3r8oESBOf7TFERSciWdWU2TeIQRtwaRc X-Received: by 10.112.55.104 with SMTP id r8mr1650615lbp.18.1431079144691; Fri, 08 May 2015 02:59:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.211 with SMTP id jq19ls333809lab.69.gmail; Fri, 08 May 2015 02:59:04 -0700 (PDT) X-Received: by 10.152.170.170 with SMTP id an10mr2278632lac.84.1431079144469; Fri, 08 May 2015 02:59:04 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id eu8si2970995lbc.171.2015.05.08.02.59.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 May 2015 02:59:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbbuc2 with SMTP id uc2so49545356lbb.2 for ; Fri, 08 May 2015 02:59:04 -0700 (PDT) X-Received: by 10.152.29.161 with SMTP id l1mr2235806lah.76.1431079143997; Fri, 08 May 2015 02:59:03 -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.108.230 with SMTP id hn6csp349269lbb; Fri, 8 May 2015 02:59:03 -0700 (PDT) X-Received: by 10.55.21.139 with SMTP id 11mr6192735qkv.19.1431079143065; Fri, 08 May 2015 02:59:03 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 80si4829621qga.22.2015.05.08.02.59.00; Fri, 08 May 2015 02:59:03 -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 D2C2561E7F; Fri, 8 May 2015 09:59:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_WEB, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 8E25D61DA3; Fri, 8 May 2015 09:58:12 +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 C15EE61D91; Fri, 8 May 2015 09:58:00 +0000 (UTC) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by lists.linaro.org (Postfix) with ESMTPS id 8171E61D91 for ; Fri, 8 May 2015 09:57:59 +0000 (UTC) Received: by lbbzk7 with SMTP id zk7so49642123lbb.0 for ; Fri, 08 May 2015 02:57:58 -0700 (PDT) X-Received: by 10.112.139.36 with SMTP id qv4mr2280611lbb.24.1431079077895; Fri, 08 May 2015 02:57:57 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-165-85.pppoe.mtu-net.ru. [91.76.165.85]) by mx.google.com with ESMTPSA id m1sm1045395lbg.36.2015.05.08.02.57.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 May 2015 02:57:56 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 8 May 2015 12:57:47 +0300 Message-Id: <1431079069-9702-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431079069-9702-1-git-send-email-maxim.uvarov@linaro.org> References: <1431079069-9702-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 2/4] api ipc: 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-Removed-Original-Auth: Dkim didn't pass. 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 209.85.217.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org 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 a24a020..0927a6c 100644 --- a/helper/ring.c +++ b/helper/ring.c @@ -159,8 +159,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 (!ODP_VAL_IS_POWER_2(count) || (count > ODPH_RING_SZ_MASK)) { ODP_ERR("Requested size is invalid, must be power of 2, and do not exceed the size limit %u\n", @@ -173,7 +179,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);