From patchwork Mon Aug 4 13:22:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 34832 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ADA2521F5F for ; Mon, 4 Aug 2014 13:23:23 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id tr6sf41458208ieb.10 for ; Mon, 04 Aug 2014 06:23:23 -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=AooHOOD9itt45rHeiMY6D9bi5yjWFWm8uBROE7gp5Q1+s3vSoaKFouh4w7I8xsdTq1 erDhLJRHTc/2dStqA8iHEYFDIChVF6vw8vY1bP3CPZddN5j8NEFo2x1/Gy0boPv7r+Lj 09hYjNUeyv/910A45PnhtYeQFDRXyFgm91MFoynOKTzeP1qu/rZD45VPhEf4RqdvKmwF nKU3jjxfo8klxY0LehepAkusIagHX8+7/C9Oagx9B57mHTuIVU+LRULA3+Zn0EcCQg00 m3bEuVEBEyUOzN0cDu+XcMpjmYlMC3+DiC8T2mb4Q4qvP6P99PhRaH3286laM8ZUzgda FSsw== X-Gm-Message-State: ALoCoQmYm7cSTKqbs4BEjqFECq4pXr9qiJxBiJh7vtvVlcsEtw7wPi2ddGTnLygQ+Txgo+aOKxw0 X-Received: by 10.182.112.202 with SMTP id is10mr9237359obb.47.1407158603232; Mon, 04 Aug 2014 06:23:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.86.80 with SMTP id o74ls2150604qgd.48.gmail; Mon, 04 Aug 2014 06:23:23 -0700 (PDT) X-Received: by 10.221.24.7 with SMTP id rc7mr1877917vcb.54.1407158603154; Mon, 04 Aug 2014 06:23:23 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id ru2si11903380vcb.19.2014.08.04.06.23.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Aug 2014 06:23:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ij19so10984804vcb.11 for ; Mon, 04 Aug 2014 06:23:23 -0700 (PDT) X-Received: by 10.52.129.165 with SMTP id nx5mr18770737vdb.25.1407158603081; Mon, 04 Aug 2014 06:23:23 -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 tc5csp304225vcb; Mon, 4 Aug 2014 06:23:22 -0700 (PDT) X-Received: by 10.140.21.137 with SMTP id 9mr35476446qgl.37.1407158602521; Mon, 04 Aug 2014 06:23:22 -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 t6si28540353qak.29.2014.08.04.06.23.21 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 04 Aug 2014 06:23:22 -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 1XEIET-0002aP-4z; Mon, 04 Aug 2014 13:23:21 +0000 Received: from mail-la0-f43.google.com ([209.85.215.43]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XEIEG-0002Zl-FX for lng-odp@lists.linaro.org; Mon, 04 Aug 2014 13:23:08 +0000 Received: by mail-la0-f43.google.com with SMTP id hr17so5420819lab.16 for ; Mon, 04 Aug 2014 06:23:02 -0700 (PDT) X-Received: by 10.112.129.228 with SMTP id nz4mr22563856lbb.9.1407158582356; Mon, 04 Aug 2014 06:23:02 -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 dp4sm9749656lad.27.2014.08.04.06.23.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Aug 2014 06:23:01 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 4 Aug 2014 17:22:49 +0400 Message-Id: <1407158570-13165-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1407158570-13165-1-git-send-email-maxim.uvarov@linaro.org> References: <1407158570-13165-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 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.180 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 */