From patchwork Tue Feb 3 12:59:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 44225 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 60C842034D for ; Tue, 3 Feb 2015 13:00:34 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gm9sf20711642lab.0 for ; Tue, 03 Feb 2015 05:00:33 -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=x9iHZj7i3X8Uxo0ra4fppYNszog9EjH25a4Cis7Zvtk=; b=c10KKBnFBeNQif3AuzCkDTKUS0OdzTm4wtzXdxlcLdXDxrcDZC8v/Wg1lFX14miQJ4 4k6EAPq1LJqw/n1YSvi5kDQ0UaG3yFS5rCkKwoD4SlM6qIh6tkd2tEdSofE7K2xsvzki OjF0RDHNxpfiJuP7Kr9cnYDFgwvqAAUuHR3o8CLZ6et83WTxSG6B5enqmJg7B9YGW4Id F97xl6vQXOeffcIheDuY4MxLaqo9XGWrVT46h3HHtG9C8bjOn9+tIftwi2AuittaAqgl aM4m8D5IMEKPFGlxCNv4F+pTUvUYMiTtUPan7qUC3Qs8rXAmBRy/tUNITmH5usN8/wNB tjtA== X-Gm-Message-State: ALoCoQnC2uz79LaZr4W8GscsjfDkeB8Ml2g+S8ysW8NmaYpt8DecUgiUuXn7UQgndChGVyjcrena X-Received: by 10.194.161.194 with SMTP id xu2mr3093905wjb.1.1422968433132; Tue, 03 Feb 2015 05:00:33 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.229 with SMTP id d5ls206876lab.75.gmail; Tue, 03 Feb 2015 05:00:32 -0800 (PST) X-Received: by 10.152.29.6 with SMTP id f6mr12820277lah.82.1422968432952; Tue, 03 Feb 2015 05:00:32 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id ns6si9538556lbb.76.2015.02.03.05.00.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 05:00:32 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id hz20so51230665lab.6 for ; Tue, 03 Feb 2015 05:00:32 -0800 (PST) X-Received: by 10.152.7.229 with SMTP id m5mr24395807laa.80.1422968432835; Tue, 03 Feb 2015 05:00:32 -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 h5csp1921040lbj; Tue, 3 Feb 2015 05:00:32 -0800 (PST) X-Received: by 10.140.81.74 with SMTP id e68mr46016419qgd.41.1422968430546; Tue, 03 Feb 2015 05:00:30 -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 m64si28681373qge.85.2015.02.03.05.00.29 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 05:00:30 -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 1YId5e-000497-Rb; Tue, 03 Feb 2015 13:00:26 +0000 Received: from mail-qc0-f178.google.com ([209.85.216.178]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YId5U-00047o-Qn for lng-odp@lists.linaro.org; Tue, 03 Feb 2015 13:00:16 +0000 Received: by mail-qc0-f178.google.com with SMTP id b13so35148436qcw.9 for ; Tue, 03 Feb 2015 05:00:11 -0800 (PST) X-Received: by 10.140.86.75 with SMTP id o69mr46388747qgd.98.1422968411621; Tue, 03 Feb 2015 05:00:11 -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 n4sm21194037qas.20.2015.02.03.05.00.09 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 05:00:10 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Tue, 3 Feb 2015 14:59:28 +0200 Message-Id: <1422968368-14340-3-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1422968368-14340-1-git-send-email-petri.savolainen@linaro.org> References: <1422968368-14340-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v2 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.215.47 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 3529fca..339b7b5 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 b3137a7..b38ade6 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 6f2f79e..ffbfb6e 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 218d07a..930bde7 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