From patchwork Thu Sep 4 15:35:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 36723 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4720520CBB for ; Thu, 4 Sep 2014 15:35:57 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id v10sf2329953pde.2 for ; Thu, 04 Sep 2014 08:35:56 -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=hejyCEqu2Ffg/pufGCsZ4C4O+S/rBcLGVsgndu3tp5o=; b=B/oqJL+sQAEtltJGrAkvUWMqNHBmtY2s4FgF4UI9pdiBsXOdPw22l8fTu+wXXVYi+u Eno8+P6+LqMDUV/1T0TCoG47vYmAy1SZ/dJes/tQUdR7y6MpSsi27RFQRinrgCjkgMgT 9zLnmqH9LJANQ1WxRu9h7GSLYk+/mnY7Kry7JOlemK9tRLI+ZfRMB+/igs00+yuqPXRH kBGaW8bdB3QxQKWKXvcRwpqyRPFF9mcfFA+qQreFnNEPtOu6yaeQii7HVwNUwBhjqDjD hv3bjJBtHpN1fDbCoVzzp+Sy4sfCQVoh8r9XbOpptSmi3zUQxLLqeI8vJU60mvVuDqW8 Rr+Q== X-Gm-Message-State: ALoCoQkE2fc5k8OKXV/VBA30mTBTLyWqJg7p5azbhTluN+wd+Q2X/zz/9VXMnFWwCJFZqC1sZiLM X-Received: by 10.66.163.41 with SMTP id yf9mr2781732pab.36.1409844956257; Thu, 04 Sep 2014 08:35:56 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.104.130 with SMTP id a2ls313183qgf.90.gmail; Thu, 04 Sep 2014 08:35:56 -0700 (PDT) X-Received: by 10.52.228.67 with SMTP id sg3mr4106464vdc.6.1409844956053; Thu, 04 Sep 2014 08:35:56 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id vp6si3200448vdc.5.2014.09.04.08.35.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 08:35:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hy4so10622294vcb.24 for ; Thu, 04 Sep 2014 08:35:56 -0700 (PDT) X-Received: by 10.220.97.5 with SMTP id j5mr4909672vcn.16.1409844955957; Thu, 04 Sep 2014 08:35:55 -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.45.67 with SMTP id uj3csp856967vcb; Thu, 4 Sep 2014 08:35:55 -0700 (PDT) X-Received: by 10.224.4.133 with SMTP id 5mr8407501qar.25.1409844955147; Thu, 04 Sep 2014 08:35:55 -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 v6si15052523qco.27.2014.09.04.08.35.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 04 Sep 2014 08:35:55 -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 1XPZ4j-0001Yq-D6; Thu, 04 Sep 2014 15:35:53 +0000 Received: from mail-lb0-f180.google.com ([209.85.217.180]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XPZ4c-0001Y6-4w for lng-odp@lists.linaro.org; Thu, 04 Sep 2014 15:35:46 +0000 Received: by mail-lb0-f180.google.com with SMTP id w7so11871605lbi.11 for ; Thu, 04 Sep 2014 08:35:39 -0700 (PDT) X-Received: by 10.152.44.230 with SMTP id h6mr5351493lam.51.1409844939764; Thu, 04 Sep 2014 08:35:39 -0700 (PDT) Received: from localhost.localdomain ([37.190.71.193]) by mx.google.com with ESMTPSA id v6sm581876lbb.33.2014.09.04.08.35.38 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 08:35:38 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 4 Sep 2014 19:35:28 +0400 Message-Id: <1409844928-30604-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1409844928-30604-1-git-send-email-maxim.uvarov@linaro.org> References: <1409844928-30604-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv5 2/2] linux-generic: extend odp_shm_reserve flags in platform code 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.179 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 --- .../linux-generic/include/api/odp_shared_memory.h | 2 -- .../include/odp_shared_memory_internal.h | 35 ++++++++++++++++++++++ platform/linux-generic/odp_buffer_pool.c | 1 + platform/linux-generic/odp_queue.c | 3 +- platform/linux-generic/odp_shared_memory.c | 9 +++++- 5 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 platform/linux-generic/include/odp_shared_memory_internal.h diff --git a/platform/linux-generic/include/api/odp_shared_memory.h b/platform/linux-generic/include/api/odp_shared_memory.h index 1d8e8bb..f12aeea 100644 --- a/platform/linux-generic/include/api/odp_shared_memory.h +++ b/platform/linux-generic/include/api/odp_shared_memory.h @@ -28,8 +28,6 @@ typedef enum { ODP_SHM_THREAD = 1, /**< Memory accessible by threads. */ ODP_SHM_PROC = 2, /**< Memory accessible by processes. Will be created if not exist. */ - ODP_SHM_PROC_NOCREAT = 3, /**< Memory accessible by processes. - Has to be created before usage.*/ } odp_shm_e; /** diff --git a/platform/linux-generic/include/odp_shared_memory_internal.h b/platform/linux-generic/include/odp_shared_memory_internal.h new file mode 100644 index 0000000..856cf07 --- /dev/null +++ b/platform/linux-generic/include/odp_shared_memory_internal.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP shared memory internal + */ + +#ifndef ODP_SHARED_MEMORY_INTERNAL_H_ +#define ODP_SHARED_MEMORY_INTERNAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/*Extend odp_shm_e: + * ODP_SHM_PROC_NOCREAT - Memory accessible by processes has to be created + * before real usage. + */ +#define ODP_SHM_PROC_NOCREAT (ODP_SHM_PROC + 1) +void *plat_odp_shm_reserve(const char *name, uint64_t size, uint64_t align, + odp_shm_e flag); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c index 390e3a6..9103cfa 100644 --- a/platform/linux-generic/odp_buffer_pool.c +++ b/platform/linux-generic/odp_buffer_pool.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 38796af..fc38b57 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -100,7 +101,7 @@ static void queue_init(queue_entry_t *queue, const char *name, if (odp_shm_lookup_ipc(name) == 1) { size_t ring_size = QUEUE_IPC_ENTRIES * sizeof(void *) + sizeof(odph_ring_t); - queue->s.r = odp_shm_reserve(name, ring_size, + queue->s.r = plat_odp_shm_reserve(name, ring_size, ODP_CACHE_LINE_SIZE, ODP_SHM_PROC_NOCREAT); if (queue->s.r == NULL) diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c index b0b0935..3d90f4c 100644 --- a/platform/linux-generic/odp_shared_memory.c +++ b/platform/linux-generic/odp_shared_memory.c @@ -11,6 +11,8 @@ #include #include +#include + #include #include #include @@ -98,7 +100,7 @@ static int find_block(const char *name) } -void *odp_shm_reserve(const char *name, uint64_t size, uint64_t align, +void *plat_odp_shm_reserve(const char *name, uint64_t size, uint64_t align, odp_shm_e flag) { int i, ret, shm_open_flags; @@ -203,6 +205,11 @@ void *odp_shm_reserve(const char *name, uint64_t size, uint64_t align, return addr; } +void *odp_shm_reserve(const char *name, uint64_t size, uint64_t align, + odp_shm_e flag) +{ + return plat_odp_shm_reserve(name, size, align, flag); +} void *odp_shm_lookup(const char *name) {