From patchwork Fri Apr 10 15:52:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 47060 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 829B521416 for ; Fri, 10 Apr 2015 15:55:55 +0000 (UTC) Received: by lbdc7 with SMTP id c7sf3363015lbd.2 for ; Fri, 10 Apr 2015 08:55:54 -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=Gs4HEZ77JvvsYsv+97Cp0gdinMyBz4N6toKus+MMwUE=; b=aXTZXM+5jozwZfGAZnXVHArTivZM00FRtdQNKSjaOrASOfqGgKJ2WlesTBkDKJRbvU t+nTSmWPniiWZWOcdwMMj5g5HHCOk8o38yR4Nc9/mYyGq+7p4OnzOBieouAL5635++Z8 wzQR1szr/611SxGVyEw4VNs2KSgVpHhVFcNcFLwurHXla2kdME1t7B4VgfbDBZJI7Rf1 CVczPnBTMPQdfsqasCiZKX25rBN21Ib2Z/ciPh+DRVLGFqiCtWWM4MFnxGcLaZUtow+K 44+fv+QQZdY8tmxOQjCBt4FhHRhC0hrt0EiawWqfdQarmAtThDhh2mOXpHF2QjY1Q1Wx rHdw== X-Gm-Message-State: ALoCoQk9km1dURDG5wW8eLpwHnJq5NL4NhkbKn+xuyBwFHZ66O/wIzEk3tuPQsa8UzA9PNUjC+QE X-Received: by 10.112.14.38 with SMTP id m6mr441097lbc.12.1428681354480; Fri, 10 Apr 2015 08:55:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.3 with SMTP id 3ls433962lai.36.gmail; Fri, 10 Apr 2015 08:55:54 -0700 (PDT) X-Received: by 10.112.144.69 with SMTP id sk5mr2041842lbb.6.1428681354329; Fri, 10 Apr 2015 08:55:54 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id qc2si1789002lbb.77.2015.04.10.08.55.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Apr 2015 08:55:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lagv1 with SMTP id v1so16357530lag.3 for ; Fri, 10 Apr 2015 08:55:54 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr2057965lab.35.1428681354224; Fri, 10 Apr 2015 08:55:54 -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 l1csp1190269lbt; Fri, 10 Apr 2015 08:55:53 -0700 (PDT) X-Received: by 10.140.97.98 with SMTP id l89mr2496687qge.92.1428681353090; Fri, 10 Apr 2015 08:55:53 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id l109si2148190qge.125.2015.04.10.08.55.52; Fri, 10 Apr 2015 08:55:53 -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 4F91F650F5; Fri, 10 Apr 2015 15:55:52 +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=-0.7 required=5.0 tests=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 7141E65107; Fri, 10 Apr 2015 15:53:48 +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 771E8650F4; Fri, 10 Apr 2015 15:53:30 +0000 (UTC) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by lists.linaro.org (Postfix) with ESMTPS id 29CC1650FD for ; Fri, 10 Apr 2015 15:52:32 +0000 (UTC) Received: by obbeb7 with SMTP id eb7so20868734obb.3 for ; Fri, 10 Apr 2015 08:52:31 -0700 (PDT) X-Received: by 10.182.186.100 with SMTP id fj4mr2782096obc.12.1428681150894; Fri, 10 Apr 2015 08:52:30 -0700 (PDT) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id ke9sm1895845obb.9.2015.04.10.08.52.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Apr 2015 08:52:30 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Fri, 10 Apr 2015 10:52:16 -0500 Message-Id: <1428681138-24954-5-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1428681138-24954-1-git-send-email-bill.fischofer@linaro.org> References: <1428681138-24954-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv4 4/6] linux-generic: pool: add user metadata support 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: bill.fischofer@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.50 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: Bill Fischofer --- platform/linux-generic/include/odp_pool_internal.h | 2 +- platform/linux-generic/odp_pool.c | 34 +++++++--------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h index feeb284..694a93b 100644 --- a/platform/linux-generic/include/odp_pool_internal.h +++ b/platform/linux-generic/include/odp_pool_internal.h @@ -86,7 +86,7 @@ struct pool_entry_s { char name[ODP_POOL_NAME_LEN]; odp_pool_param_t params; - _odp_buffer_pool_init_t init_params; + uint32_t udata_size; odp_pool_t pool_hdl; uint32_t pool_id; odp_shm_t pool_shm; diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index bf49623..1f0e6fe 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -153,13 +153,8 @@ odp_pool_t odp_pool_create(const char *name, } /* Default initialization paramters */ - static _odp_buffer_pool_init_t default_init_params = { - .udata_size = 0, - .buf_init = NULL, - .buf_init_arg = NULL, - }; - - _odp_buffer_pool_init_t *init_params = &default_init_params; + uint32_t p_udata_size = 0; + uint32_t udata_stride = 0; /* Restriction for v1.0: All non-packet buffers are unsegmented */ int unseg = 1; @@ -167,11 +162,6 @@ odp_pool_t odp_pool_create(const char *name, /* Restriction for v1.0: No zeroization support */ const int zeroized = 0; - /* Restriction for v1.0: No udata support */ - uint32_t udata_stride = (init_params->udata_size > sizeof(void *)) ? - ODP_CACHE_LINE_SIZE_ROUNDUP(init_params->udata_size) : - 0; - uint32_t blk_size, buf_stride, buf_num, seg_len = 0; uint32_t buf_align = params->type == ODP_POOL_BUFFER ? params->buf.align : 0; @@ -222,6 +212,10 @@ odp_pool_t odp_pool_create(const char *name, if (blk_size / seg_len > ODP_BUFFER_MAX_SEG) return ODP_POOL_INVALID; + p_udata_size = params->pkt.udata_size; + udata_stride = ODP_ALIGN_ROUNDUP(p_udata_size, + sizeof(uint64_t)); + buf_stride = sizeof(odp_packet_hdr_stride); break; @@ -265,7 +259,6 @@ odp_pool_t odp_pool_create(const char *name, } pool->s.params = *params; - pool->s.init_params = *init_params; pool->s.buf_align = buf_align; /* Optimize for short buffers: Data stored in buffer hdr */ @@ -336,6 +329,7 @@ odp_pool_t odp_pool_create(const char *name, /* Pool mdata addr is used for indexing buffer metadata */ pool->s.pool_mdata_addr = mdata_base_addr; + pool->s.udata_size = p_udata_size; pool->s.buf_stride = buf_stride; pool->s.buf_freelist = NULL; @@ -347,7 +341,7 @@ odp_pool_t odp_pool_create(const char *name, uint8_t *buf = udata_base_addr - buf_stride; uint8_t *udat = udata_stride == 0 ? NULL : - block_base_addr - udata_stride; + udata_base_addr + udata_size - udata_stride; /* Init buffer common header and add to pool buffer freelist */ do { @@ -363,7 +357,7 @@ odp_pool_t odp_pool_create(const char *name, tmp->type = params->type; tmp->pool_hdl = pool->s.pool_hdl; tmp->udata_addr = (void *)udat; - tmp->udata_size = init_params->udata_size; + tmp->udata_size = p_udata_size; tmp->segcount = 0; tmp->segsize = pool->s.seg_size; tmp->handle.handle = odp_buffer_encode_handle(tmp); @@ -540,15 +534,9 @@ odp_buffer_t buffer_alloc(odp_pool_t pool_hdl, size_t size) /* By default, buffers inherit their pool's zeroization setting */ buf->buf.flags.zeroized = pool->s.flags.zeroized; - if (buf->buf.type == ODP_EVENT_PACKET) { + if (buf->buf.type == ODP_EVENT_PACKET) packet_init(pool, &buf->pkt, size); - if (pool->s.init_params.buf_init != NULL) - (*pool->s.init_params.buf_init) - (buf->buf.handle.handle, - pool->s.init_params.buf_init_arg); - } - return odp_hdr_to_buf(&buf->buf); } @@ -622,7 +610,7 @@ void odp_pool_print(odp_pool_t pool_hdl) ODP_DBG(" pool size %zu (%zu pages)\n", pool->s.pool_size, pool->s.pool_size / ODP_PAGE_SIZE); ODP_DBG(" pool mdata base %p\n", pool->s.pool_mdata_addr); - ODP_DBG(" udata size %zu\n", pool->s.init_params.udata_size); + ODP_DBG(" udata size %zu\n", pool->s.udata_size); ODP_DBG(" headroom %u\n", pool->s.headroom); ODP_DBG(" tailroom %u\n", pool->s.tailroom); if (pool->s.params.type == ODP_POOL_BUFFER) {