From patchwork Sat Aug 2 09:58:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 34745 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 66AAC20540 for ; Sat, 2 Aug 2014 09:59:28 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kx10sf35627426pab.4 for ; Sat, 02 Aug 2014 02:59:27 -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=nUjuxu7N5BcuRPDESQ7DR1QayzYXTwUbT8avZBcbwpg=; b=Fbd7uAHoxSZeAu6FKyb4L+Icwv0xjPjty0XC1dJqg9+wCj5V6sAEr18rX+bswpSJto TT5bxok2p5s4eTpdq1rALzWuwIepJbt2iXyiSdyPlFSp9Wn0PfMHy6FCueNM5ZUjeapV NfJ4PSIk8xKbKw3+BUUGGot3+1FQAOrkPO1uF3F87cOW6qYhK5a+K5WE2liFbuMDhaJc PxS8NW3cQXYmHEDIPPjBcDFEZIL8XiPrrgwfaJmAzV0PzePxU1KFBLuC1bEN5UNLphHO vm2j0aZGLkHpoAICmBBX/iEGGd3DALx7py1Ss/4rkRP4d5MYtiTgaE9Is7pwU9oWgle+ Zgbw== X-Gm-Message-State: ALoCoQnvKXf/DIjQQq7TvJ5LIQYvPOWvppsccTFoZu9PNvQ1IomgPzvofhygJXTMq/sEl1Xo5EIn X-Received: by 10.66.217.200 with SMTP id pa8mr4557034pac.33.1406973567450; Sat, 02 Aug 2014 02:59:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.236 with SMTP id g99ls87268qge.17.gmail; Sat, 02 Aug 2014 02:59:27 -0700 (PDT) X-Received: by 10.220.2.136 with SMTP id 8mr12436006vcj.17.1406973567289; Sat, 02 Aug 2014 02:59:27 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id ti11si9391510vdb.10.2014.08.02.02.59.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 02 Aug 2014 02:59:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hy4so8150392vcb.36 for ; Sat, 02 Aug 2014 02:59:27 -0700 (PDT) X-Received: by 10.221.21.201 with SMTP id qt9mr12508938vcb.39.1406973567140; Sat, 02 Aug 2014 02:59:27 -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 tc5csp169405vcb; Sat, 2 Aug 2014 02:59:26 -0700 (PDT) X-Received: by 10.224.79.13 with SMTP id n13mr17712336qak.79.1406973566490; Sat, 02 Aug 2014 02:59:26 -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 l4si19658779qav.55.2014.08.02.02.59.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 02 Aug 2014 02:59:26 -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 1XDW61-0004Rm-Fl; Sat, 02 Aug 2014 09:59:25 +0000 Received: from mail-la0-f46.google.com ([209.85.215.46]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XDW5s-0004RS-Ip for lng-odp@lists.linaro.org; Sat, 02 Aug 2014 09:59:16 +0000 Received: by mail-la0-f46.google.com with SMTP id b8so4006984lan.33 for ; Sat, 02 Aug 2014 02:59:10 -0700 (PDT) X-Received: by 10.112.30.39 with SMTP id p7mr10822637lbh.35.1406973550430; Sat, 02 Aug 2014 02:59:10 -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 lc3sm6229741lac.19.2014.08.02.02.59.08 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 02 Aug 2014 02:59:09 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Sat, 2 Aug 2014 13:58:58 +0400 Message-Id: <1406973539-2268-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1406973539-2268-1-git-send-email-maxim.uvarov@linaro.org> References: <1406973539-2268-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 2/3] 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.177 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..fdff502 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_THREAD; + else + shm_flag = ODP_SHM_PROC; /* 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 */