From patchwork Thu May 21 15:32:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 48858 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 872C521411 for ; Thu, 21 May 2015 15:34:22 +0000 (UTC) Received: by wivs14 with SMTP id s14sf4979582wiv.1 for ; Thu, 21 May 2015 08:34:20 -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=STspIA6CtpMIxv1dchQ5zjx6odZBfG045WS0BQimz/s=; b=bvnLJmqMx4UCpoJgf45Kv1l7jJUxjzi56cdLHrQOKCXQdqgebA5Fy+MyRdcTPD6XAm 0f9TrNxA5YHzmLUaGRSL/lcvuWtS95IJG2HWYKYMjyiQ0uQa6xRErqxaSDXjq6rHDh+L TGC5BtpXKTeED9syFcy9bHV/gIpKHjB4M9GTRsP+2g/gEFXFIY+XSK/zzAVmkgg4pHM5 zniGyf71VGNx9+6lTcxWgM8v5iTKir9Pq7XeFzjyM5M1uvN8rug7tYSZjur7iLmcsSNP KOwfOTRET1CQGnUE2SfgbcpYgZL588G3Ym3gfI7UYR0tkZr+xv1sUc7MBlecnBwnn21m UJGQ== X-Gm-Message-State: ALoCoQmkaFYTkFtNJR/HvZWO0/OvUTt/qNgoyhz+pjZEgjp8Sy5rYG8PbQ5Cd/bSEvwmFDevwOJF X-Received: by 10.152.8.17 with SMTP id n17mr3188024laa.0.1432222460793; Thu, 21 May 2015 08:34:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.65 with SMTP id o1ls385813laj.108.gmail; Thu, 21 May 2015 08:34:20 -0700 (PDT) X-Received: by 10.112.40.9 with SMTP id t9mr2811265lbk.55.1432222460573; Thu, 21 May 2015 08:34:20 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ap7si13493979lac.21.2015.05.21.08.34.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 May 2015 08:34:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by laat2 with SMTP id t2so105413164laa.1 for ; Thu, 21 May 2015 08:34:20 -0700 (PDT) X-Received: by 10.152.27.105 with SMTP id s9mr2799721lag.86.1432222460426; Thu, 21 May 2015 08:34:20 -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 hn6csp677555lbb; Thu, 21 May 2015 08:34:19 -0700 (PDT) X-Received: by 10.55.20.141 with SMTP id 13mr7588533qku.30.1432222459023; Thu, 21 May 2015 08:34:19 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f62si5398106qkh.31.2015.05.21.08.34.17; Thu, 21 May 2015 08:34:19 -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 D1F0761E4D; Thu, 21 May 2015 15:34:17 +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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 BEFEA61DDA; Thu, 21 May 2015 15:32:52 +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 C40C961D20; Thu, 21 May 2015 15:32:27 +0000 (UTC) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by lists.linaro.org (Postfix) with ESMTPS id D6C8061D13 for ; Thu, 21 May 2015 15:32:25 +0000 (UTC) Received: by lbcmx3 with SMTP id mx3so20893342lbc.1 for ; Thu, 21 May 2015 08:32:24 -0700 (PDT) X-Received: by 10.152.27.162 with SMTP id u2mr2720786lag.22.1432222344333; Thu, 21 May 2015 08:32:24 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-163-142.pppoe.mtu-net.ru. [91.76.163.142]) by mx.google.com with ESMTPSA id kb5sm5385410lbc.16.2015.05.21.08.32.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 May 2015 08:32:23 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 21 May 2015 18:32:09 +0300 Message-Id: <1432222332-21289-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432222332-21289-1-git-send-email-maxim.uvarov@linaro.org> References: <1432222332-21289-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv6 2/5] 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.215.49 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 721c1fc..4224518 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 (!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", @@ -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);