From patchwork Thu Aug 7 12:48:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 35038 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D25CB21137 for ; Thu, 7 Aug 2014 12:48:38 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id q200sf11861408ykb.9 for ; Thu, 07 Aug 2014 05:48:38 -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: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:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=/h0gzdvN1DXaOOky1qmBlaIrskA7nr5s8gbwUumFSj8=; b=RODq4W8Alqn8oeCsfn+YkNdb68bUAvkgM9b6oOLA53INanzOu7B4/lb03uQDtITw/t HWeYHiOAAy1NFO50YtZwMj++w4M3oVsnFrKaGKw/FNAtwWmYntHmSPELeWV7zmt/tMkP mgNTKXJ6LgqTh4cWSqZgWY7/VowcRu4eRJlimteSWNUoCQK/FMou+JJQeajzbD5PBr3X vfGhpBpNY1fbfiH/tbJzV8NNGxMlKCdTkbku4XP0QVV/0wp4PUlnPgXQMVxDySSyMDuR GCpxDqkU8bCLbPqEqDKdsY3qmNrRSxpSKQDYx+jLzwEUG28arzZCrrOCjchir7BkkV4i s3NQ== X-Gm-Message-State: ALoCoQlqvw7pVR/2As8S41XSSBLWHD1OaBTeJHQxAASByjZSNa36CVQZaAFZPn2ZOMSpJvWghFfj X-Received: by 10.224.127.6 with SMTP id e6mr9079864qas.3.1407415718624; Thu, 07 Aug 2014 05:48:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.69 with SMTP id 63ls125127qgo.59.gmail; Thu, 07 Aug 2014 05:48:38 -0700 (PDT) X-Received: by 10.220.200.71 with SMTP id ev7mr16037237vcb.24.1407415718508; Thu, 07 Aug 2014 05:48:38 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id sd9si1717854vdb.25.2014.08.07.05.48.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Aug 2014 05:48:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id ik5so6065497vcb.6 for ; Thu, 07 Aug 2014 05:48:38 -0700 (PDT) X-Received: by 10.220.131.207 with SMTP id y15mr12495vcs.71.1407415718399; Thu, 07 Aug 2014 05:48:38 -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.221.37.5 with SMTP id tc5csp26983vcb; Thu, 7 Aug 2014 05:48:37 -0700 (PDT) X-Received: by 10.140.101.86 with SMTP id t80mr12597765qge.91.1407415717775; Thu, 07 Aug 2014 05:48:37 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id v7si6014503qay.99.2014.08.07.05.48.37 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 07 Aug 2014 05:48:37 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XFN7U-0002Fc-0M; Thu, 07 Aug 2014 12:48:36 +0000 Received: from mail-la0-f50.google.com ([209.85.215.50]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XFN7H-0002Et-1f for lng-odp@lists.linaro.org; Thu, 07 Aug 2014 12:48:23 +0000 Received: by mail-la0-f50.google.com with SMTP id gf5so3448555lab.37 for ; Thu, 07 Aug 2014 05:48:17 -0700 (PDT) X-Received: by 10.152.179.168 with SMTP id dh8mr16855170lac.0.1407415697133; Thu, 07 Aug 2014 05:48:17 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-29-79.pppoe.mtu-net.ru. [91.76.29.79]) by mx.google.com with ESMTPSA id q8sm2032933laj.33.2014.08.07.05.48.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Aug 2014 05:48:16 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 7 Aug 2014 16:48:02 +0400 Message-Id: <1407415686-352-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1407415686-352-1-git-send-email-maxim.uvarov@linaro.org> References: <1407415686-352-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [IPC PATCH DISCUSSION 2/6] odp_ring: add flag to put ring to shared memory X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org 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.220.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 Add flag to put odp_ring to shared memory visible by different processes. Signed-off-by: Maxim Uvarov --- include/helper/odp_ring.h | 2 ++ platform/linux-generic/odp_ring.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/helper/odp_ring.h b/include/helper/odp_ring.h index 0911531..60960a2 100644 --- a/include/helper/odp_ring.h +++ b/include/helper/odp_ring.h @@ -158,6 +158,8 @@ typedef struct odp_ring { #define ODP_RING_F_SP_ENQ 0x0001 /* The default enqueue is "single-producer". */ #define ODP_RING_F_SC_DEQ 0x0002 /* The default dequeue is "single-consumer". */ +#define ODP_RING_SHM_PROC 0x0004 /* If set - ring is visible from different + processes. Default is thread visible. */ #define ODP_RING_QUOT_EXCEED (1 << 31) /* Quota exceed for burst ops */ #define ODP_RING_SZ_MASK (unsigned)(0x0fffffff) /* Ring size mask */ diff --git a/platform/linux-generic/odp_ring.c b/platform/linux-generic/odp_ring.c index ee8175e..1ecc638 100644 --- a/platform/linux-generic/odp_ring.c +++ b/platform/linux-generic/odp_ring.c @@ -158,6 +158,12 @@ odp_ring_create(const char *name, unsigned count, unsigned flags) char ring_name[ODP_RING_NAMESIZE]; odp_ring_t *r; size_t ring_size; + odp_shm_e shm_flag; + + if (flags & ODP_RING_SHM_PROC) + shm_flag = ODP_SHM_PROC; + else + shm_flag = ODP_SHM_THREAD; /* count must be a power of 2 */ if (!ODP_VAL_IS_POWER_2(count) || (count > ODP_RING_SZ_MASK)) { @@ -172,7 +178,7 @@ odp_ring_create(const char *name, unsigned count, unsigned flags) odp_rwlock_write_lock(&qlock); /* reserve a memory zone for this ring.*/ r = odp_shm_reserve(ring_name, ring_size, ODP_CACHE_LINE_SIZE, - ODP_SHM_THREAD); + shm_flag); if (r != NULL) { /* init the ring structure */