From patchwork Mon Aug 4 14:48:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 34855 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EC01B20F2E for ; Mon, 4 Aug 2014 14:49:07 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id h18sf14585164igc.1 for ; Mon, 04 Aug 2014 07:49:07 -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=FBQiZB8aSUep4OqRHAUDw4l/eyX+eMFgV24uHPmAeCTguChTzUXwZXWhhvHnekcjcx pAMnM3n2iefkRCpxJ2rJtxSI7ImucBw/TyoQijD4jX1s7C2M9CEns13Ih405Eb58lHXW P3FaiGAWe/HT0SePdLD/fBaUDHULRjMF+oGN+okA8/Q3qy8snuIVD6io+XMal7KUOmZw 5iArYR3DV/gx5NCA+SbBiGYBrRKVynL8cgfdwUv4SEje6HjedZCTFuHiX8Je3pbX/fqB TSmM8Iz8f1cpy3FYQYy60NctLtjCm/yK1KBcTnIqnc3nIWrcAcmmD9/xuK+wUL2hYxtB k6Gg== X-Gm-Message-State: ALoCoQmCpaf5V9NgRrUatLRKc6xne43TKqoJivb5Vm3NgAspU4ByW1mF3BLv4UhDVbwcFpTB1N41 X-Received: by 10.182.43.196 with SMTP id y4mr8420009obl.35.1407163747465; Mon, 04 Aug 2014 07:49:07 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.6 with SMTP id q6ls2123213qgq.49.gmail; Mon, 04 Aug 2014 07:49:07 -0700 (PDT) X-Received: by 10.53.13.200 with SMTP id fa8mr5684493vdd.57.1407163747358; Mon, 04 Aug 2014 07:49:07 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id cl4si8168829vdb.78.2014.08.04.07.48.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Aug 2014 07:48:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id hy4so11458809vcb.13 for ; Mon, 04 Aug 2014 07:48:58 -0700 (PDT) X-Received: by 10.52.144.14 with SMTP id si14mr1284603vdb.95.1407163738628; Mon, 04 Aug 2014 07:48:58 -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 tc5csp310313vcb; Mon, 4 Aug 2014 07:48:58 -0700 (PDT) X-Received: by 10.180.74.42 with SMTP id q10mr28746412wiv.39.1407163737598; Mon, 04 Aug 2014 07:48:57 -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 ev15si21231354wid.77.2014.08.04.07.48.47 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 04 Aug 2014 07:48:48 -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 1XEJYw-00059k-U9; Mon, 04 Aug 2014 14:48:35 +0000 Received: from mail-lb0-f176.google.com ([209.85.217.176]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XEJYh-00058m-77 for lng-odp@lists.linaro.org; Mon, 04 Aug 2014 14:48:19 +0000 Received: by mail-lb0-f176.google.com with SMTP id u10so5455737lbd.35 for ; Mon, 04 Aug 2014 07:48:13 -0700 (PDT) X-Received: by 10.112.63.65 with SMTP id e1mr3177334lbs.81.1407163693328; Mon, 04 Aug 2014 07:48:13 -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 dk4sm22342450lbb.38.2014.08.04.07.48.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Aug 2014 07:48:12 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 4 Aug 2014 18:48:03 +0400 Message-Id: <1407163684-27844-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1407163684-27844-1-git-send-email-maxim.uvarov@linaro.org> References: <1407163684-27844-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 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.182 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 */