From patchwork Fri Dec 19 15:28:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 42491 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9D4E826C68 for ; Fri, 19 Dec 2014 15:29:10 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id q1sf854621lam.2 for ; Fri, 19 Dec 2014 07:29:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state: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=YEWJP/TTn4GZC78pe7nv/oEnkzV++5nodRTYkWE2gU4=; b=GpChbsjHSPw0A2EplskTbro2F/cy5AYf6l3R5hUPchFXXe4IKCZHB3bhEipYA/ob42 REgj8lF2SglkdN1uwnqiqh7hYE7seSwUZMxoJ9PyupFuhPY3rWJeWNO/QgDzBSJKjFgA qkm+bvVrA9UbTzLoQlFvHnX07Gbo73HTGMVrYmzo6D0CvXWRW+SE5jTDPynilFUTuSKQ zMrh2uipLz3OHHT9bvdX3NnND0f6c4dYf/8slXaKV3aajJnzkxgbYxO/oo8qYJR7zi8X 4z7/Z2Rn5zXqqSmA9o6j7eLRkW9exA8OVRsIoGnLPFzh65TidBrkC3Iq1Xh0O10OYjtH GHsw== X-Gm-Message-State: ALoCoQlnZHmxfHawTVY5qDlEo90DaWnYMhDCOEQHidxorsiOQmyxfuAo3wgQU+i+5DzcPhK1jjA7 X-Received: by 10.194.71.48 with SMTP id r16mr19205wju.7.1419002949606; Fri, 19 Dec 2014 07:29:09 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.205 with SMTP id ba13ls1188356lab.66.gmail; Fri, 19 Dec 2014 07:29:09 -0800 (PST) X-Received: by 10.152.2.165 with SMTP id 5mr8431028lav.40.1419002949437; Fri, 19 Dec 2014 07:29:09 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id kt4si10271083lac.71.2014.12.19.07.29.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Dec 2014 07:29:09 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id b6so996585lbj.36 for ; Fri, 19 Dec 2014 07:29:09 -0800 (PST) X-Received: by 10.152.234.35 with SMTP id ub3mr8465047lac.70.1419002949280; Fri, 19 Dec 2014 07:29:09 -0800 (PST) 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.142.69 with SMTP id ru5csp309727lbb; Fri, 19 Dec 2014 07:29:08 -0800 (PST) X-Received: by 10.140.92.215 with SMTP id b81mr14228324qge.5.1419002948008; Fri, 19 Dec 2014 07:29:08 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id h45si12083211qgd.59.2014.12.19.07.29.05 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 19 Dec 2014 07:29:07 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1zUF-0000lg-8B; Fri, 19 Dec 2014 15:29:03 +0000 Received: from mail-qg0-f54.google.com ([209.85.192.54]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1zU5-0000lI-BP for lng-odp@lists.linaro.org; Fri, 19 Dec 2014 15:28:53 +0000 Received: by mail-qg0-f54.google.com with SMTP id l89so785342qgf.13 for ; Fri, 19 Dec 2014 07:28:48 -0800 (PST) X-Received: by 10.224.50.75 with SMTP id y11mr14617728qaf.89.1419002928159; Fri, 19 Dec 2014 07:28:48 -0800 (PST) Received: from localhost.localdomain (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id p4sm9692288qar.48.2014.12.19.07.28.45 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Dec 2014 07:28:47 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Fri, 19 Dec 2014 17:28:18 +0200 Message-Id: <1419002899-17314-2-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.1 In-Reply-To: <1419002899-17314-1-git-send-email-petri.savolainen@linaro.org> References: <1419002899-17314-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 2/3] api: buffer: Rename odp_buffer_size to _len X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: petri.savolainen@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.217.177 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 Align buffer and packet APIs to use only _len (instead of mixing _len and _size). Signed-off-by: Petri Savolainen --- platform/linux-generic/include/api/odp_buffer.h | 6 +++--- platform/linux-generic/include/odp_buffer_internal.h | 2 +- platform/linux-generic/include/odp_buffer_pool_internal.h | 8 ++++---- platform/linux-generic/odp_buffer.c | 6 +++--- platform/linux-generic/odp_buffer_pool.c | 10 +++++----- platform/linux-generic/odp_crypto.c | 2 +- platform/linux-generic/odp_packet.c | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/platform/linux-generic/include/api/odp_buffer.h b/platform/linux-generic/include/api/odp_buffer.h index 3c23035..47553f7 100644 --- a/platform/linux-generic/include/api/odp_buffer.h +++ b/platform/linux-generic/include/api/odp_buffer.h @@ -38,13 +38,13 @@ extern "C" { void *odp_buffer_addr(odp_buffer_t buf); /** - * Buffer maximum data size + * Buffer length * * @param buf Buffer handle * - * @return Buffer maximum data size + * @return Buffer length in bytes */ -size_t odp_buffer_size(odp_buffer_t buf); +uint32_t odp_buffer_len(odp_buffer_t buf); /** * Buffer type diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 60f06c9..6cc7d5d 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -118,7 +118,7 @@ typedef struct odp_buffer_hdr_t { }; } flags; int type; /* buffer type */ - size_t size; /* max data size */ + uint32_t len; /* buffer length */ odp_atomic_u32_t ref_count; /* reference count */ odp_buffer_pool_t pool_hdl; /* buffer pool handle */ union { diff --git a/platform/linux-generic/include/odp_buffer_pool_internal.h b/platform/linux-generic/include/odp_buffer_pool_internal.h index 2e48ac3..c5f9753 100644 --- a/platform/linux-generic/include/odp_buffer_pool_internal.h +++ b/platform/linux-generic/include/odp_buffer_pool_internal.h @@ -246,7 +246,7 @@ static inline void ret_buf(struct pool_entry_s *pool, odp_buffer_hdr_t *buf) 0, buf->segsize); ret_blk(pool, buf->addr[--buf->segcount]); } - buf->size = 0; + buf->len = 0; } oldhead = _odp_atomic_ptr_load(&pool->buf_freelist, _ODP_MEMMODEL_ACQ); @@ -278,8 +278,8 @@ static inline void *get_local_buf(local_cache_t *buf_cache, if (odp_likely(buf != NULL)) { buf_cache->buf_freelist = buf->next; - if (odp_unlikely(buf->size < totsize)) { - intmax_t needed = totsize - buf->size; + if (odp_unlikely(buf->len < totsize)) { + intmax_t needed = totsize - buf->len; do { void *blk = get_blk(pool); @@ -292,7 +292,7 @@ static inline void *get_local_buf(local_cache_t *buf_cache, needed -= pool->seg_size; } while (needed > 0); - buf->size = buf->segcount * pool->seg_size; + buf->len = buf->segcount * pool->seg_size; } buf_cache->bufallocs++; diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c index dd37ab3..deb46ce 100644 --- a/platform/linux-generic/odp_buffer.c +++ b/platform/linux-generic/odp_buffer.c @@ -22,11 +22,11 @@ void *odp_buffer_addr(odp_buffer_t buf) } -size_t odp_buffer_size(odp_buffer_t buf) +uint32_t odp_buffer_len(odp_buffer_t buf) { odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf); - return hdr->size; + return hdr->len; } @@ -63,7 +63,7 @@ int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t buf) len += snprintf(&str[len], n-len, " addr %p\n", hdr->addr); len += snprintf(&str[len], n-len, - " size %zu\n", hdr->size); + " size %u\n", hdr->len); len += snprintf(&str[len], n-len, " ref_count %i\n", odp_atomic_load_u32(&hdr->ref_count)); diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c index 48be24f..021571a 100644 --- a/platform/linux-generic/odp_buffer_pool.c +++ b/platform/linux-generic/odp_buffer_pool.c @@ -305,7 +305,7 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name, tmp->allocator = ODP_FREEBUF; tmp->flags.all = 0; tmp->flags.zeroized = zeroized; - tmp->size = 0; + tmp->len = 0; odp_atomic_store_u32(&tmp->ref_count, 0); tmp->type = params->buf_type; tmp->pool_hdl = pool->s.pool_hdl; @@ -324,7 +324,7 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name, if (blk_size > 0) { tmp->segcount = 1; tmp->addr[0] = &tmp->addr[1]; - tmp->size = blk_size; + tmp->len = blk_size; } } @@ -473,8 +473,8 @@ odp_buffer_t buffer_alloc(odp_buffer_pool_t pool_hdl, size_t size) return ODP_BUFFER_INVALID; /* Get blocks for this buffer, if pool uses application data */ - if (buf->buf.size < totsize) { - intmax_t needed = totsize - buf->buf.size; + if (buf->buf.len < totsize) { + intmax_t needed = totsize - buf->buf.len; do { uint8_t *blk = get_blk(&pool->s); if (blk == NULL) { @@ -484,7 +484,7 @@ odp_buffer_t buffer_alloc(odp_buffer_pool_t pool_hdl, size_t size) buf->buf.addr[buf->buf.segcount++] = blk; needed -= pool->s.seg_size; } while (needed > 0); - buf->buf.size = buf->buf.segcount * pool->s.seg_size; + buf->buf.len = buf->buf.segcount * pool->s.seg_size; } } diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 13c5556..8d79aee 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -47,7 +47,7 @@ odp_crypto_generic_op_result_t *get_op_result_from_buffer(odp_buffer_t buf) odp_crypto_generic_op_result_t *result; temp = odp_buffer_addr(buf); - temp += odp_buffer_size(buf); + temp += odp_buffer_len(buf); temp -= sizeof(*result); result = (odp_crypto_generic_op_result_t *)(void *)temp; return result; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 0ab9866..5bf7b60 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -58,7 +58,7 @@ int odp_packet_reset(odp_packet_t pkt, uint32_t len) pool_entry_t *pool = odp_buf_to_pool(&pkt_hdr->buf_hdr); uint32_t totsize = pool->s.headroom + len + pool->s.tailroom; - if (totsize > pkt_hdr->buf_hdr.size) + if (totsize > pkt_hdr->buf_hdr.len) return -1; packet_init(pool, pkt_hdr, len); @@ -90,7 +90,7 @@ void *odp_packet_head(odp_packet_t pkt) uint32_t odp_packet_buf_len(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->buf_hdr.size; + return odp_packet_hdr(pkt)->buf_hdr.len; } void *odp_packet_data(odp_packet_t pkt)