From patchwork Wed Oct 28 13:42:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 55690 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp128721lbr; Wed, 28 Oct 2015 06:44:21 -0700 (PDT) X-Received: by 10.140.36.244 with SMTP id p107mr18523128qgp.37.1446039860676; Wed, 28 Oct 2015 06:44:20 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b12si42162860qkj.40.2015.10.28.06.44.20; Wed, 28 Oct 2015 06:44:20 -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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id 4379A61FD5; Wed, 28 Oct 2015 13:44:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 3AD8361FB5; Wed, 28 Oct 2015 13:43:19 +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 67CB561FC0; Wed, 28 Oct 2015 13:43:11 +0000 (UTC) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com [209.85.217.176]) by lists.linaro.org (Postfix) with ESMTPS id D2A2861FAE for ; Wed, 28 Oct 2015 13:43:00 +0000 (UTC) Received: by lbjm5 with SMTP id m5so5910118lbj.3 for ; Wed, 28 Oct 2015 06:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QhjCUcqlCCdUkL6zcWQscdWcnY0wu68WsXQAZFWv5vM=; b=ifCOs09EpVu8ArAoB8wircePCGTbN339U4nkN++cTpdZ1iOrm+/endCfVbzBCB30ZH a4+TewiBTB/LjHWVbwf5H9hKJRZinEbOdR8pECwbV4k2YeJzMUD0PioXM4hLmq5rAmfW pk/Cg/WhhSsW+HQS8I/32pQ8/4ig+ZmJXrkrHUsB1oE2AJ+0Tx030fNArUGc4pJsPW4q mZzYI2buaBD8KOnXpymu/AeyfJ5xRMZFZApNSKE0ZOej8oKZ8857aE7z5qbPucX3NLL9 G4t1RmpGVXj8hO3wFfkXaDN98Wk+KHCPc+NHzK0U9npgC9KfrA8EglAJ7R04w0aQ9DiG DYwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QhjCUcqlCCdUkL6zcWQscdWcnY0wu68WsXQAZFWv5vM=; b=kFl1cCmEnatidNV4PblhDatKkTNMQqpG8lhEeV7SdYTZk209/6LB5ez9mDvBSxtVaA 5HkSHA7ZZe2PUbuaSBGVvDX027EM/kk3CnN/H8GDmwvc6YPtUFljONT6cBQ0P7QGfuHI qjHzOumrCa/SvSE9gsmoEWmKYvl6IrjknAgQbGRuOqKJCuy1bdGMS5kXwEuoQgFRbKX8 LZxBwTdEoMuDetH7Vp8ovbPIH+eMn+lkN9aWVf3JNz3dNR9skzerV/Tul9rf0d4404CA 7H1P1JWRZ56nyKLBvlDA86TeLvaw588hfz8fDwlrh40j5fJXJoQC2KqfuPdQqQq70qJd 6c8w== X-Gm-Message-State: ALoCoQmQYnw1ccSRRfGsAFe8ZienuAVf6SIDdO/h4vfWbJ2gSzvIHzuYJFaTmSkTWGmP5sAa13PI X-Received: by 10.112.161.42 with SMTP id xp10mr23626837lbb.49.1446039779823; Wed, 28 Oct 2015 06:42:59 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-161-180.pppoe.mtu-net.ru. [91.76.161.180]) by smtp.gmail.com with ESMTPSA id b142sm4471309lfb.46.2015.10.28.06.42.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Oct 2015 06:42:59 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 28 Oct 2015 16:42:47 +0300 Message-Id: <1446039773-28325-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446039773-28325-1-git-send-email-maxim.uvarov@linaro.org> References: <1446039773-28325-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv12 2/8] linux-generic: create internal pool create function with shm flags X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" On init odp creates odp_sched_pool. We can not modify API to add new parameter to odp_pool_param_t and this pool should not be shared between different processes. To do that implemented internal linux-generic function with parameters to created shm. Note: create shm before and then provide it to the pool does not work because shm argument likely will be dropped from odp_pool_create() (patch already posted.). Signed-off-by: Maxim Uvarov --- platform/linux-generic/include/odp_pool_internal.h | 4 ++++ platform/linux-generic/odp_pool.c | 11 +++++++++-- platform/linux-generic/odp_schedule.c | 3 +-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h index 94bf1fa..b268cde 100644 --- a/platform/linux-generic/include/odp_pool_internal.h +++ b/platform/linux-generic/include/odp_pool_internal.h @@ -354,6 +354,10 @@ static inline uint32_t odp_buffer_pool_tailroom(odp_pool_t pool) return odp_pool_to_entry(pool)->s.tailroom; } +odp_pool_t _pool_create(const char *name, + odp_pool_param_t *params, + uint32_t shmflags); + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 76a4aa5..775cef2 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -150,7 +150,9 @@ int odp_pool_term_local(void) * Pool creation */ -odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params) +odp_pool_t _pool_create(const char *name, + odp_pool_param_t *params, + uint32_t shmflags) { odp_pool_t pool_hdl = ODP_POOL_INVALID; pool_entry_t *pool; @@ -296,7 +298,7 @@ odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params) shm = odp_shm_reserve(pool->s.name, pool->s.pool_size, - ODP_PAGE_SIZE, 0); + ODP_PAGE_SIZE, shmflags); if (shm == ODP_SHM_INVALID) { POOL_UNLOCK(&pool->s.lock); return ODP_POOL_INVALID; @@ -409,6 +411,11 @@ odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params) return pool_hdl; } +odp_pool_t odp_pool_create(const char *name, + odp_pool_param_t *params) +{ + return _pool_create(name, params, ODP_SHM_PROC); +} odp_pool_t odp_pool_lookup(const char *name) { diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 6df8073..157242e 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -140,8 +140,7 @@ int odp_schedule_init_global(void) params.buf.num = NUM_SCHED_CMD; params.type = ODP_POOL_BUFFER; - pool = odp_pool_create("odp_sched_pool", ¶ms); - + pool = _pool_create("odp_sched_pool", ¶ms, 0); if (pool == ODP_POOL_INVALID) { ODP_ERR("Schedule init: Pool create failed.\n"); return -1;