From patchwork Fri Feb 13 03:32:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 44643 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 73DB521527 for ; Fri, 13 Feb 2015 03:33:37 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id d17sf9485884eek.2 for ; Thu, 12 Feb 2015 19:33:36 -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=tSGLP9aBcQb/w0PV8nKgMKLdD9BdHKyeykZaLqtTy+w=; b=aRf4OCQVc3uiLp5FBboO6TOn77VLaUN8WgY7KTP8Fm9kd6TPyOhVWNIziyF95BxIdb qCwFlNbg/YfsZcF0GURdbjbbfm+bBv35/pIcU+iau42HQSf6qhEdzI+X22IRHH3zq6xw r6w4AoVmj/LHdBZy92U2PCDK/OiVNH5ti4azGTBUHHSGCWBRJrA4xtlaKP4hUjyEcPXX j0FnI2ZYQfJhDe0U01ujwZGJ6MCOiJFsRjDRPNhKfOi/16OCMcL2oSyJmxGsk0PV+yQf rRzdGpftV0BF1hBuGH+5SxYCkrpQl1cih7KHAgYTk31W0fxfLzPgrwxHNdDes10Rdf/a 6NHg== X-Gm-Message-State: ALoCoQmmdCpCSnYTcoPFnHENny1/A8JNwNyfGsynXadKaWdKHXzBj3w64ykvF26HhJ2iA4nqURrD X-Received: by 10.194.201.10 with SMTP id jw10mr1020700wjc.3.1423798416716; Thu, 12 Feb 2015 19:33:36 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.42 with SMTP id g10ls272353laa.51.gmail; Thu, 12 Feb 2015 19:33:36 -0800 (PST) X-Received: by 10.112.199.162 with SMTP id jl2mr6014893lbc.48.1423798416261; Thu, 12 Feb 2015 19:33:36 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id n3si624226lah.45.2015.02.12.19.33.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Feb 2015 19:33:36 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id p9so13236635lbv.0 for ; Thu, 12 Feb 2015 19:33:36 -0800 (PST) X-Received: by 10.152.179.172 with SMTP id dh12mr3480433lac.76.1423798416102; Thu, 12 Feb 2015 19:33:36 -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.35.133 with SMTP id h5csp819587lbj; Thu, 12 Feb 2015 19:33:35 -0800 (PST) X-Received: by 10.140.233.212 with SMTP id e203mr1348948qhc.83.1423798414726; Thu, 12 Feb 2015 19:33:34 -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 s3si1452929qak.46.2015.02.12.19.33.33 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 12 Feb 2015 19:33:34 -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 1YM70V-0001r6-Qw; Fri, 13 Feb 2015 03:33:31 +0000 Received: from mail-qc0-f172.google.com ([209.85.216.172]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YM70M-0001qN-CA for lng-odp@lists.linaro.org; Fri, 13 Feb 2015 03:33:22 +0000 Received: by mail-qc0-f172.google.com with SMTP id x3so12065609qcv.3 for ; Thu, 12 Feb 2015 19:33:17 -0800 (PST) X-Received: by 10.229.182.9 with SMTP id ca9mr18766629qcb.31.1423798397186; Thu, 12 Feb 2015 19:33:17 -0800 (PST) Received: from mcpro03.emea.nsn-net.net (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id s63sm5991798qgd.26.2015.02.12.19.33.15 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Feb 2015 19:33:16 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Fri, 13 Feb 2015 05:32:48 +0200 Message-Id: <1423798368-16597-3-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.3.0 In-Reply-To: <1423798368-16597-1-git-send-email-petri.savolainen@linaro.org> References: <1423798368-16597-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v3 3/3] api: config: Renamed ODP_CONFIG_PACKET_BUF_LEN_MIN 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.169 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 Renamed ODP_CONFIG_PACKET_BUF_LEN_MIN to ODP_CONFIG_PACKET_SEG_LEN_MIN. The packet pool parameter pkt.seg_len is rounded up into this value. Added ODP_CONFIG_PACKET_SEG_LEN_MAX to define the maximum segment length supported by the implementation. This is the maximum valid value for pkt.seg_len. If ODP_CONFIG_PACKET_SEG_LEN_MIN equals _SEG_LEN_MAX, the implementation supports only one segment length value. Signed-off-by: Petri Savolainen --- include/odp/api/config.h | 20 +++++++++++++++----- platform/linux-generic/include/odp_buffer_internal.h | 12 ++++++------ platform/linux-generic/odp_buffer_pool.c | 4 ++-- test/validation/buffer/odp_packet_test.c | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/include/odp/api/config.h b/include/odp/api/config.h index bd69b98..3ac9e2c 100644 --- a/include/odp/api/config.h +++ b/include/odp/api/config.h @@ -92,9 +92,9 @@ extern "C" { /** * Minimum packet segment length * - * This defines the minimum packet segment length in bytes. The user defined - * buffer size (in odp_buffer_pool_param_t) in buffer pool creation will be - * rounded up into this value. + * This defines the minimum packet segment buffer length in bytes. The user + * defined segment length (seg_len in odp_pool_param_t) will be rounded up into + * this value. * * @internal In linux-generic implementation: * - The value MUST be a multiple of 8. @@ -103,7 +103,17 @@ extern "C" { * with the default headroom shown above and is a multiple of both 64 and 128, * which are the most common cache line sizes. */ -#define ODP_CONFIG_PACKET_BUF_LEN_MIN (1664) +#define ODP_CONFIG_PACKET_SEG_LEN_MIN (1664) + +/** + * Maximum packet segment length + * + * This defines the maximum packet segment buffer length in bytes. The user + * defined segment length (seg_len in odp_pool_param_t) must not be larger than + * this. + * + */ +#define ODP_CONFIG_PACKET_SEG_LEN_MAX ODP_CONFIG_PACKET_SEG_LEN_MIN /** * Maximum packet buffer length @@ -117,7 +127,7 @@ extern "C" { * - The value MUST be an integral number of segments * - The value SHOULD be large enough to accommodate jumbo packets (9K) */ -#define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_BUF_LEN_MIN*6) +#define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN*6) /** * @} diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index f199e2e..c532e35 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -50,18 +50,18 @@ extern "C" { ((x) <= 65536 ? 16 : \ (0/0))))))))))))))))) -_ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_BUF_LEN_MIN >= 256, - "ODP Segment size must be a minimum of 256 bytes"); +_ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_SEG_LEN_MIN >= 256, + "ODP Segment size must be a minimum of 256 bytes"); -_ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MIN % ODP_CACHE_LINE_SIZE) == 0, - "ODP Segment size must be a multiple of cache line size"); +_ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_SEG_LEN_MIN % ODP_CACHE_LINE_SIZE) == 0, + "ODP Segment size must be a multiple of cache line size"); _ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MAX % - ODP_CONFIG_PACKET_BUF_LEN_MIN) == 0, + ODP_CONFIG_PACKET_SEG_LEN_MIN) == 0, "Packet max size must be a multiple of segment size"); #define ODP_BUFFER_MAX_SEG \ - (ODP_CONFIG_PACKET_BUF_LEN_MAX / ODP_CONFIG_PACKET_BUF_LEN_MIN) + (ODP_CONFIG_PACKET_BUF_LEN_MAX / ODP_CONFIG_PACKET_SEG_LEN_MIN) /* We can optimize storage of small raw buffers within metadata area */ #define ODP_MAX_INLINE_BUF ((sizeof(void *)) * (ODP_BUFFER_MAX_SEG - 1)) diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c index 18ad358..f8e35b4 100644 --- a/platform/linux-generic/odp_buffer_pool.c +++ b/platform/linux-generic/odp_buffer_pool.c @@ -182,7 +182,7 @@ odp_pool_t odp_pool_create(const char *name, else blk_size = ODP_ALIGN_ROUNDUP( headroom + params->pkt.seg_len + tailroom, - ODP_CONFIG_PACKET_BUF_LEN_MIN); + ODP_CONFIG_PACKET_SEG_LEN_MIN); buf_stride = params->type == ODP_POOL_PACKET ? sizeof(odp_packet_hdr_stride) : @@ -284,7 +284,7 @@ odp_pool_t odp_pool_create(const char *name, pool->s.flags.unsegmented = unseg; pool->s.flags.zeroized = zeroized; pool->s.seg_size = unseg ? - blk_size : ODP_CONFIG_PACKET_BUF_LEN_MIN; + blk_size : ODP_CONFIG_PACKET_SEG_LEN_MIN; uint8_t *block_base_addr = pool->s.pool_base_addr; diff --git a/test/validation/buffer/odp_packet_test.c b/test/validation/buffer/odp_packet_test.c index f5830cc..2b87be9 100644 --- a/test/validation/buffer/odp_packet_test.c +++ b/test/validation/buffer/odp_packet_test.c @@ -7,7 +7,7 @@ #include "odp_buffer_tests.h" #include -#define PACKET_BUF_LEN ODP_CONFIG_PACKET_BUF_LEN_MIN +#define PACKET_BUF_LEN ODP_CONFIG_PACKET_SEG_LEN_MIN /* Reserve some tailroom for tests */ #define PACKET_TAILROOM_RESERVE 4