From patchwork Fri Oct 27 08:00:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 117298 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp475273qgn; Fri, 27 Oct 2017 01:03:29 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QC7C0khC/0hAFpfQE+X57afKKuH36dlT2xCtSHsx3/1vR/4Y0QbdYesBpPR8ZSVZG+rnle X-Received: by 10.55.159.133 with SMTP id i127mr12328044qke.157.1509091408994; Fri, 27 Oct 2017 01:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509091408; cv=none; d=google.com; s=arc-20160816; b=rWoz4YxRQQlEWKAcZKko+MFKuZxCwiOPd9/e34ykC8yfC3MLgpLSaRsq/8iuZwout2 FMcPYTBQMN1SMWq6zDAyVyyDsXeaENMgbR+a0NzfEjEw5d0MS6tx2uSM5KOiYKvNQ1ru 1c9hYkZHUfGgHfhnSms6VFwPDUkuM5A41lublVKpaoiya2GNVStEcs4eFcgijN3m5vKX 5OtJPTkt2s96xCSwgOEIsqTl8MqNi3lSMqQQOvkVvZlp8LjQltmLFwcERo/NKhAvaRsX iK/GfwAZRXNMKam+dPTtrksa59WIRiFhYYDH4KIsOtTMi93Bn7py18tlWQD8zNmTzOBz M6iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=tTAXykhv1jIzlpUsMsM5RN9ryw+gAFCnkqlPR4LCQYo=; b=q0noOD184HKR1JTriV30vxhAIAXwuchcmlQ+AwRdL6AWfYZ1KoMZI2mkn186sGtCXy 4X8h4gcDqvM98j63GU7CAiQgig6iNQHpO6bSOOszdC2Icikj1+dmRddBwmH9NvLvXM4s lshLxyzSmEDeFlnVsSAk00aLHDut6QUCFGoL0Y47bJH+s163BzkZchda6gJyQIlcTJ86 Ib6E3LOHD+0dFxCTxkY34n2uVsKygNo68qmeKQrlH83OcgzKWl3cmr7l/FVl0MSS3kvd lHQFHUeVi0DadOTEPT5ktRT0ZWQeuMVFT5qaQ3I0O/nyL9qk02bNGFwK3VIuwoaoVH1V wVeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id s5si1548119qkb.412.2017.10.27.01.03.28; Fri, 27 Oct 2017 01:03:28 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id AEF00628FE; Fri, 27 Oct 2017 08:03:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 6A5B2628FD; Fri, 27 Oct 2017 08:01:15 +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 A7C27609AC; Fri, 27 Oct 2017 08:00:54 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id 6F49D60750 for ; Fri, 27 Oct 2017 08:00:48 +0000 (UTC) Received: from mxback20j.mail.yandex.net (mxback20j.mail.yandex.net [IPv6:2a02:6b8:0:1619::114]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 2A79656070E5 for ; Fri, 27 Oct 2017 11:00:47 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback20j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id gvpjEKkVvL-0krG7BKF; Fri, 27 Oct 2017 11:00:47 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 5leQ09wrpf-0kJ4cAqm; Fri, 27 Oct 2017 11:00:46 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 27 Oct 2017 11:00:05 +0300 Message-Id: <1509091212-14398-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509091212-14398-1-git-send-email-odpbot@yandex.ru> References: <1509091212-14398-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 234 Subject: [lng-odp] [PATCH API-NEXT v4 1/8] api: pool: relax packet pool param num X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Added packet pool parameter 'max_num', so that 'num' parameter can be round up by the implementation. Most implementations have a fixed segment size, and need this flexibility. For example, when 'len' is larger than the pool segment size, there may be e.g. 2 x 'num' segments in the poool, and thus it would be able to allocate 2 x 'num' small packets. When application needs to limit maximum number of packets on a pool, it can use the new max_num param for that. Otherwise, it would leave 'max_num' to zero (== no limit). Signed-off-by: Petri Savolainen --- /** Email created from pull request 234 (psavol:next-pool-param) ** https://github.com/Linaro/odp/pull/234 ** Patch: https://github.com/Linaro/odp/pull/234.patch ** Base sha: d61d32590d1772b70b8dcd0d0ec44d29029d7443 ** Merge commit sha: 436021e0a0bff8bda38fa420ebbc4545c97a7fc8 **/ include/odp/api/spec/pool.h | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h index 35f783775..dc07851c4 100644 --- a/include/odp/api/spec/pool.h +++ b/include/odp/api/spec/pool.h @@ -164,10 +164,11 @@ int odp_pool_capability(odp_pool_capability_t *capa); /** * Pool parameters - * Used to communicate pool creation options. - * @note A single thread may not be able to allocate all 'num' elements - * from the pool at any particular time, as other threads or hardware - * blocks are allowed to keep some for caching purposes. + * + * A note for all pool types: a single thread may not be able to allocate all + * 'num' elements from the pool at any particular time, as implementations are + * allowed to store some elements (per thread and HW engine) for caching + * purposes. */ typedef struct odp_pool_param_t { /** Pool type */ @@ -192,17 +193,34 @@ typedef struct odp_pool_param_t { /** Parameters for packet pools */ struct { - /** The number of packets that the pool must provide - that are packet length 'len' bytes or smaller. - The maximum value is defined by pool capability - pkt.max_num. */ + /** Minimum number of 'len' byte packets. + * + * The pool must contain at least this many packets + * that are 'len' bytes or smaller. An implementation + * may round up the value, as long as the 'max_num' + * parameter below is not violated. The maximum value + * for this field is defined by pool capability + * pkt.max_num. + */ uint32_t num; - /** Minimum packet length that the pool must provide - 'num' packets. The number of packets may be less - than 'num' when packets are larger than 'len'. - The maximum value is defined by pool capability - pkt.max_len. Use 0 for default. */ + /** Maximum number of packets. + * + * This is the maximum number of packets of any length + * that can be allocated from the pool. The maximum + * value is defined by pool capability pkt.max_num. + * Use 0 when there's no requirement for the maximum + * number of packets. The default value is 0. + */ + uint32_t max_num; + + /** Minimum length of 'num' packets. + * + * The pool must contain at least 'num' packets up to + * this packet length (1 ... 'len' bytes). The maximum + * value for this field is defined by pool capability + * pkt.max_len. Use 0 for default. + */ uint32_t len; /** Maximum packet length that will be allocated from