From patchwork Mon Jun 1 10:41:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 49290 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7011E21580 for ; Mon, 1 Jun 2015 10:43:01 +0000 (UTC) Received: by wgla2 with SMTP id a2sf32443299wgl.1 for ; Mon, 01 Jun 2015 03:43:00 -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=STspIA6CtpMIxv1dchQ5zjx6odZBfG045WS0BQimz/s=; b=OEcMvp6ACUzip9JMfaezwniqxsXwCNF/fhCUXLP+cNw4nj85KvYmnJhsqmigq+lE8e zqHLrc2zrTJsbkGD//6lQbf3WAEgO88mVrPA35LZfDsRjFeFq/S7P33TBB6uRPdDlS4S /X4jxxNlUQ8v2TVDfdfwnq5yIDHlHeOZTqWsgyhnCilvzlMmlc9OkaXwA6Wx5ug3YUH8 jRLKH7j4oIs3jgXO96NJwI/v0sRi7J+a1n4tVM9UeY2M+Dy13fB1Xq3NQIM7KtKVA+i5 v/5o18/1+5B9HLlUUSFdJbsLJ9BLOQ87kUbgoT4zphPKg/F3kioSF9E4b4q/4Pb2Luvf 2QSQ== X-Gm-Message-State: ALoCoQmLv+Fasb0gAOcHQwvfY9pnAgq0LUeHYCtAy5Op2e+QyCyAtNn5D8sqIYyBefLpB0CjYy/j X-Received: by 10.180.83.72 with SMTP id o8mr11059259wiy.3.1433155380767; Mon, 01 Jun 2015 03:43:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.37 with SMTP id w5ls574999laa.77.gmail; Mon, 01 Jun 2015 03:43:00 -0700 (PDT) X-Received: by 10.152.207.105 with SMTP id lv9mr20577545lac.10.1433155380504; Mon, 01 Jun 2015 03:43:00 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id h1si11989452lah.56.2015.06.01.03.43.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jun 2015 03:43:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by laei3 with SMTP id i3so10322798lae.3 for ; Mon, 01 Jun 2015 03:43:00 -0700 (PDT) X-Received: by 10.152.4.72 with SMTP id i8mr20897187lai.32.1433155380251; Mon, 01 Jun 2015 03:43:00 -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.108.230 with SMTP id hn6csp2216668lbb; Mon, 1 Jun 2015 03:42:59 -0700 (PDT) X-Received: by 10.229.98.200 with SMTP id r8mr23783434qcn.15.1433155378957; Mon, 01 Jun 2015 03:42:58 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 81si12647177qhv.86.2015.06.01.03.42.57; Mon, 01 Jun 2015 03:42:58 -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 9892C61D34; Mon, 1 Jun 2015 10:42:57 +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=disabled 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 6A58761D39; Mon, 1 Jun 2015 10:42:04 +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 5F61761D1B; Mon, 1 Jun 2015 10:41:58 +0000 (UTC) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by lists.linaro.org (Postfix) with ESMTPS id C3AE861CE5 for ; Mon, 1 Jun 2015 10:41:56 +0000 (UTC) Received: by wifw1 with SMTP id w1so99310053wif.0 for ; Mon, 01 Jun 2015 03:41:55 -0700 (PDT) X-Received: by 10.180.76.8 with SMTP id g8mr19271768wiw.79.1433155315838; Mon, 01 Jun 2015 03:41:55 -0700 (PDT) Received: from localhost.localdomain ([87.120.178.39]) by mx.google.com with ESMTPSA id fb3sm16014528wib.21.2015.06.01.03.41.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Jun 2015 03:41:55 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 1 Jun 2015 13:41:41 +0300 Message-Id: <1433155304-24149-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1433155304-24149-1-git-send-email-maxim.uvarov@linaro.org> References: <1433155304-24149-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv7 2/5] 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.215.53 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 721c1fc..4224518 100644 --- a/helper/ring.c +++ b/helper/ring.c @@ -158,8 +158,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", @@ -172,7 +178,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);