From patchwork Fri Dec 18 11:29:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 58638 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp964123lbb; Fri, 18 Dec 2015 03:34:52 -0800 (PST) X-Received: by 10.140.98.239 with SMTP id o102mr4207817qge.31.1450438492831; Fri, 18 Dec 2015 03:34:52 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id g18si8103565qgd.58.2015.12.18.03.34.52; Fri, 18 Dec 2015 03:34:52 -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 Received: by lists.linaro.org (Postfix, from userid 109) id 5FFCF6161B; Fri, 18 Dec 2015 11:34:52 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=CtJYfIRJ; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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 C74F96169C; Fri, 18 Dec 2015 11:29:42 +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 5CD506168A; Fri, 18 Dec 2015 11:29:28 +0000 (UTC) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com [209.85.217.180]) by lists.linaro.org (Postfix) with ESMTPS id 25FE16160F for ; Fri, 18 Dec 2015 11:29:24 +0000 (UTC) Received: by mail-lb0-f180.google.com with SMTP id kw15so62009306lbb.0 for ; Fri, 18 Dec 2015 03:29:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RP1I+AxvIYPZYP74BFrgA0GCBZfmaGi6/6rJJHxBvQs=; b=CtJYfIRJvsDCk3YtAMQPvANJfI02H9gkEMn0rf0jFe/9+A0mzaRzNm4vryl3Cnbu+U FZxQEI9TFRNEjcmJaAifgXfC+IWcjwDxZkKtT0E4E5ux5040rtJwAtrgRdG+XSdjof7W 565coVJ6Pn6tr6Kb3qhdDFBJNekNUsnXtG07Y= 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=RP1I+AxvIYPZYP74BFrgA0GCBZfmaGi6/6rJJHxBvQs=; b=UMWqGc5LfrQ4ZhKeDEdyZf+msw3NtBn6zyBvkt81d1Z+3UgZMKrnynuUYsEcL64wM/ mt0oo81pB/idkkebTlBLWoDJwU+4YwH6fpZ0BM2IHdML5MWceG0+1nvTxhzehi+ng8w8 0aNTmEhtYGUhuC3CnMFAMeEF+sJx5K1vPHnIn9q1QqrSfaKPM/GWh6D1mUoh5vAbj1ec XjaUUUMDg4M4/SDlQVif09N1IG6OochlxZPQ+a+30U9AkWEyeN7w1qZHivZOpTcA9YZW QXxcV7qconOTwz9eF/qmDfWUW8GABtd/4vFpvNsLTRzL/F2tOc/pM2vGwkoycHMTK4Sd 7bQg== X-Gm-Message-State: ALoCoQm0QzbI8KfP+LaGAOg+Yyt4u6alpC/+YPgu3/u89n8vh6HgPON4bV/kstPLcLKCDV3TT/AzUKm/PXbqNJP0INfMQLXCmA== X-Received: by 10.112.205.10 with SMTP id lc10mr1076471lbc.31.1450438162989; Fri, 18 Dec 2015 03:29:22 -0800 (PST) Received: from localhost.localdomain (ppp91-76-173-134.pppoe.mtu-net.ru. [91.76.173.134]) by smtp.gmail.com with ESMTPSA id pl2sm2694549lbc.8.2015.12.18.03.29.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Dec 2015 03:29:22 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 18 Dec 2015 14:29:07 +0300 Message-Id: <1450438154-2062-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450438154-2062-1-git-send-email-maxim.uvarov@linaro.org> References: <1450438154-2062-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv18 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 9859ff6..e0992db 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 9b7cd57..ffad58d 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;