From patchwork Thu Apr 23 17:47:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 47470 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CBACE20553 for ; Thu, 23 Apr 2015 17:49:22 +0000 (UTC) Received: by wixv7 with SMTP id v7sf21540554wix.0 for ; Thu, 23 Apr 2015 10:49:21 -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=DtV7niQKLY3g09VTkw7so3w1hkSFwTfwagwkj8Nr0gPzQWBaWB/W8ESJNxBCkfHEyN +Rcm/tHCrphKupKx2G23BAOVfeg7BGp/1m4upvOHummKM7nmV7xSQEQtBViVDOK20kY6 H47E8bH9MQu07i/NLeBm2TxvGKQdRVUOGIW9I0xGFdEp4Ahmn3YNYeROGPrLFhsB2NLI kvpeSgAD5kF6OBi1LyB2kan5qrxtYsPATpMuMjxeMQqcB8Ch7IANu5vIFYCesAH0LIl7 heZylacMEuR+jesyaNZILfGYolDLlp1HqHRx34jqWhqA4kv17Qx+oJXrX6xKyOui9Nio YFLQ== X-Gm-Message-State: ALoCoQnbwK5sOqCPPPAXqeJpAvzsieAcfbPpVZ/M/0SfespGOjK2dIS2A0LDvyZVf+C+ILkIDH0V X-Received: by 10.152.3.70 with SMTP id a6mr1981693laa.0.1429811361095; Thu, 23 Apr 2015 10:49:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.121.98 with SMTP id lj2ls359751lab.94.gmail; Thu, 23 Apr 2015 10:49:20 -0700 (PDT) X-Received: by 10.112.119.139 with SMTP id ku11mr3344547lbb.49.1429811360949; Thu, 23 Apr 2015 10:49:20 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id rb8si6454937lbb.34.2015.04.23.10.49.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2015 10:49:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbqq2 with SMTP id qq2so18927643lbb.3 for ; Thu, 23 Apr 2015 10:49:20 -0700 (PDT) X-Received: by 10.112.29.36 with SMTP id g4mr3557250lbh.56.1429811360601; Thu, 23 Apr 2015 10:49: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.67.65 with SMTP id l1csp718725lbt; Thu, 23 Apr 2015 10:49:20 -0700 (PDT) X-Received: by 10.229.204.10 with SMTP id fk10mr4740643qcb.1.1429811359269; Thu, 23 Apr 2015 10:49:19 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 201si8725986qht.100.2015.04.23.10.48.49; Thu, 23 Apr 2015 10:49: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 02D8B61FFA; Thu, 23 Apr 2015 17:48:49 +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=unavailable autolearn_force=no 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 7471A61DB5; Thu, 23 Apr 2015 17:47: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 585D461FE7; Thu, 23 Apr 2015 17:47:48 +0000 (UTC) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by lists.linaro.org (Postfix) with ESMTPS id B60B261FDB for ; Thu, 23 Apr 2015 17:47:22 +0000 (UTC) Received: by lbbuc2 with SMTP id uc2so18885155lbb.2 for ; Thu, 23 Apr 2015 10:47:21 -0700 (PDT) X-Received: by 10.112.129.132 with SMTP id nw4mr3512667lbb.122.1429811241542; Thu, 23 Apr 2015 10:47:21 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-163-193.pppoe.mtu-net.ru. [91.76.163.193]) by mx.google.com with ESMTPSA id k2sm2010574lag.9.2015.04.23.10.47.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Apr 2015 10:47:20 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 23 Apr 2015 20:47:01 +0300 Message-Id: <1429811225-10239-4-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429811225-10239-1-git-send-email-maxim.uvarov@linaro.org> References: <1429811225-10239-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 3/7] 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.178 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);