From patchwork Thu Nov 19 09:43:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 56969 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp3071838lbb; Thu, 19 Nov 2015 01:45:09 -0800 (PST) X-Received: by 10.140.89.201 with SMTP id v67mr6132783qgd.38.1447926309209; Thu, 19 Nov 2015 01:45:09 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u21si6059347qgu.96.2015.11.19.01.45.08; Thu, 19 Nov 2015 01:45:09 -0800 (PST) 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 9B37561FD0; Thu, 19 Nov 2015 09:45:08 +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_H3, RCVD_IN_MSPIKE_WL, 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 33B8961FD3; Thu, 19 Nov 2015 09:43:50 +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 9211161FB2; Thu, 19 Nov 2015 09:43:42 +0000 (UTC) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) by lists.linaro.org (Postfix) with ESMTPS id 3585961E13 for ; Thu, 19 Nov 2015 09:43:41 +0000 (UTC) Received: by lfdo63 with SMTP id o63so44190646lfd.2 for ; Thu, 19 Nov 2015 01:43:40 -0800 (PST) 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=vH21bFfNqZcMxk7GOVEVywInEufOGHMAnFzHAWig/N4=; b=Zhm4p13XSmOuffZeKtsDDJaS8wi7+M+x6h29PcxgG/obHhwKw1AVvQ8tenzpuBr7EY GtktbVxPtVxrqSShOwWkItyYhf/G9r3Igzx2GsxMSFODTXRihytsbu0Q2VOHs54ZwE2J E/1QSPFzjbcbHy/jzkoz53PVdZCeCkcQp9eVohBLyy+8NfqiN0p+3w6cZq8raliTb8F1 uqxO1HQz3nH5loNNv2x2ZCu4UKbqqyYOBtxVjAldWMKh4B3vnqTNmLmsFheDfKYTWq3A tZL/TQmgn37uCGyV1VskSR7CfGXOIdHIlIZYBAW7CFlqUztvHHF2hIb8fqJWEV3GQA0V DHuw== 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=vH21bFfNqZcMxk7GOVEVywInEufOGHMAnFzHAWig/N4=; b=Z5TNhQS4eCSdx/u8d7jdXxKMIclgHLJQq396kfjjDT5WJ6v+7JNHp0FC1//SaGLZyC qxhIXKlpsfv1x88Vp29/cNopUaYnuD32He/yzWhhdJkDKoZKGWvFb9RKxAfoLbcJI9U7 tP4XX13rmFDM4NLENBt5mJqr5B4yl7tTBEu4BWjRnMGc2xiWEnAZlw9PDUaICuYQPTNv KaiSDqXSR5FUbXZk1SbbdS+MCAk2L2vuYgp13oB1XILO1C7p+uAHxPKv3awbAXdLNcP2 4FXOqfoHsbkjRzW+PseW7c/0AuI75yO8QDYJbF/p2IvsSYHolfPtiCqT6sA3loO9KVCR 1NJw== X-Gm-Message-State: ALoCoQmTYJ5f5RpctIWlBrlm/px/9feFAv5pHZYJO/s0JstV7TyNLre6pG/LFIxBGPR4Xkm2Uysq X-Received: by 10.25.84.18 with SMTP id i18mr2424583lfb.43.1447926220108; Thu, 19 Nov 2015 01:43:40 -0800 (PST) Received: from localhost.localdomain (ppp91-76-161-180.pppoe.mtu-net.ru. [91.76.161.180]) by smtp.gmail.com with ESMTPSA id 194sm1081186lfd.4.2015.11.19.01.43.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Nov 2015 01:43:39 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 19 Nov 2015 12:43:25 +0300 Message-Id: <1447926212-15365-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447926212-15365-1-git-send-email-maxim.uvarov@linaro.org> References: <1447926212-15365-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv14 2/9] 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 5982f85..ef18a47 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -141,8 +141,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;