From patchwork Thu Apr 23 17:47:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 47471 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 5742720553 for ; Thu, 23 Apr 2015 17:49:51 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf6312830wgt.1 for ; Thu, 23 Apr 2015 10:49:50 -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=s0T1S2mVk/+c6SjZ7um+LL6hMZMD2L7I6tpH2pnMer0=; b=IeuvKRV7YdmE0Cyg2Gsh23MYnOgUvxzjp5CyPQ3s/N+XCkw7PnygYA9VeLVJ0zzxpq oWNtqXpLU4HtY7bash+EFTcGhX/2zaxS+ndfUM04B67F+2RZTStpFmlOktl+hvcVkQGE Cgl/XJGRNJPbQmZNxrpwZ7sHJTn16+peFPfbF7nX5S4Tep61ZQxEFvSORiCptPPy13So M2ZnG0WtYpxF78DkEX0cIrJDy03NuX8BLIs4vpp6GWGsPd7mai2AMj6F+7X1XvACwIfE orWLUqej7GXOWfXyVhqmwUC05A/z9en51LtboulsI1qAr26rJhLp/rHH+fvM1MUp4ge4 q0gw== X-Gm-Message-State: ALoCoQkZeIBzSq4UxVL0jivrklJ1oEfkM1Bvqc6wvBTfhwnkqDl0GU6YsoPaQw8zOw2vem7Jl/Rv X-Received: by 10.112.14.101 with SMTP id o5mr1935659lbc.3.1429811390400; Thu, 23 Apr 2015 10:49:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.133 with SMTP id c5ls324347lac.68.gmail; Thu, 23 Apr 2015 10:49:50 -0700 (PDT) X-Received: by 10.152.3.130 with SMTP id c2mr3434930lac.81.1429811390121; Thu, 23 Apr 2015 10:49:50 -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 as7si6440160lbc.107.2015.04.23.10.49.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2015 10:49:49 -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 labbd9 with SMTP id bd9so18268702lab.2 for ; Thu, 23 Apr 2015 10:49:49 -0700 (PDT) X-Received: by 10.112.184.70 with SMTP id es6mr3385898lbc.117.1429811389675; Thu, 23 Apr 2015 10:49:49 -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.67.65 with SMTP id l1csp718941lbt; Thu, 23 Apr 2015 10:49:49 -0700 (PDT) X-Received: by 10.140.93.199 with SMTP id d65mr4525324qge.27.1429811388292; Thu, 23 Apr 2015 10:49:48 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j4si8757709qga.33.2015.04.23.10.49.18; Thu, 23 Apr 2015 10:49:48 -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 1F22961DA8; Thu, 23 Apr 2015 17:49:18 +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=unavailable autolearn_force=no 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 AC99F61EAE; Thu, 23 Apr 2015 17:47:54 +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 C72DC61FDB; Thu, 23 Apr 2015 17:47:48 +0000 (UTC) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com [209.85.215.42]) by lists.linaro.org (Postfix) with ESMTPS id 224AB61DB5 for ; Thu, 23 Apr 2015 17:47:25 +0000 (UTC) Received: by layy10 with SMTP id y10so18274761lay.0 for ; Thu, 23 Apr 2015 10:47:24 -0700 (PDT) X-Received: by 10.152.26.34 with SMTP id i2mr3376180lag.117.1429811244041; Thu, 23 Apr 2015 10:47:24 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-163-193.pppoe.mtu-net.ru. [91.76.163.193]) by mx.google.com with ESMTPSA id k2sm2010574lag.9.2015.04.23.10.47.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Apr 2015 10:47:22 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 23 Apr 2015 20:47:02 +0300 Message-Id: <1429811225-10239-5-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429811225-10239-1-git-send-email-maxim.uvarov@linaro.org> References: <1429811225-10239-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 4/7] linux-generic: reflect shm flags and add mode debug prints 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 In case if shm was not specified pool_creat() has to allocate memory for itself using shared memory flags. Signed-off-by: Maxim Uvarov --- include/odp/api/pool.h | 1 + platform/linux-generic/odp_pool.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h index 241b98a..2401f47 100644 --- a/include/odp/api/pool.h +++ b/include/odp/api/pool.h @@ -83,6 +83,7 @@ typedef struct odp_pool_param_t { }; int type; /**< Pool type */ + uint32_t shm_flags; /**< Flags to odp_shm_reserve() */ } odp_pool_param_t; /** Packet pool*/ diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index a3d80b5..21c402c 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -231,8 +231,11 @@ odp_pool_t odp_pool_create(const char *name, ODP_ALIGN_ROUNDUP(params->pkt.len, seg_len); /* Reject create if pkt.len needs too many segments */ - if (blk_size / seg_len > ODP_BUFFER_MAX_SEG) + if (blk_size / seg_len > ODP_BUFFER_MAX_SEG) { + ODP_ERR("ODP_BUFFER_MAX_SEG exceed %d(%d)\n", + blk_size / seg_len, ODP_BUFFER_MAX_SEG); return ODP_POOL_INVALID; + } buf_stride = sizeof(odp_packet_hdr_stride); break; @@ -249,8 +252,10 @@ odp_pool_t odp_pool_create(const char *name, /* Validate requested number of buffers against addressable limits */ if (buf_num > - (ODP_BUFFER_MAX_BUFFERS / (buf_stride / ODP_CACHE_LINE_SIZE))) + (ODP_BUFFER_MAX_BUFFERS / (buf_stride / ODP_CACHE_LINE_SIZE))) { + ODP_ERR("buf_num > ODP_BUFFER_MAX_BUFFERS\n"); return ODP_POOL_INVALID; + } /* Find an unused buffer pool slot and iniitalize it as requested */ for (i = 0; i < ODP_CONFIG_POOLS; i++) { @@ -302,7 +307,8 @@ odp_pool_t odp_pool_create(const char *name, if (shm == ODP_SHM_NULL) { shm = odp_shm_reserve(pool->s.name, pool->s.pool_size, - ODP_PAGE_SIZE, 0); + ODP_PAGE_SIZE, + params->shm_flags); if (shm == ODP_SHM_INVALID) { POOL_UNLOCK(&pool->s.lock); return ODP_POOL_INVALID; @@ -313,6 +319,9 @@ odp_pool_t odp_pool_create(const char *name, if (odp_shm_info(shm, &info) != 0 || info.size < pool->s.pool_size) { POOL_UNLOCK(&pool->s.lock); + ODP_DBG("shm info %d, info size %ld, pool size %ld\n", + odp_shm_info(shm, &info), info.size, + pool->s.pool_size); return ODP_POOL_INVALID; } pool->s.pool_base_addr = odp_shm_addr(shm); @@ -324,6 +333,7 @@ odp_pool_t odp_pool_create(const char *name, ((size_t)page_addr - (size_t)pool->s.pool_base_addr)) { POOL_UNLOCK(&pool->s.lock); + ODP_DBG("wrong shm\n"); return ODP_POOL_INVALID; } pool->s.pool_base_addr = page_addr;