From patchwork Mon Oct 23 12:00:03 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: 116729 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4575280qgn; Mon, 23 Oct 2017 05:14:43 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RISJrVDeJyJ5/3RCtXtXNepnG+qyf6aLXJt22aop3pIaxSkqHa63c1LGA5Dsn5PBY7Vdnb X-Received: by 10.237.37.8 with SMTP id v8mr20135983qtc.275.1508760882934; Mon, 23 Oct 2017 05:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508760882; cv=none; d=google.com; s=arc-20160816; b=TsosZKxfFzX8fgeOIChzzrEAjHE9TFN/zm/Qs94sqmenw2xO5FnfPBGtECq54AtJSG +kV1Ml4uq6u0gYLnOtmRlePeKy+GxB9iwDTQoYVTpF3VCcrhMXzFsIup7Zr7KFAvj3cx uUR2wiePW1dSiwX9uMFJ0OL+1C3bvqK5wDmbCcOve3XYPWo4TUsP5CzFCJomgqnqUPTZ XGr5B4zBzEODlochMQNqbbSyF9pP0JAI7yUHakMKAXjKHjr+JdBlB/ORQx53SA/YYZl6 rbRDZkB2qvRl1Kc2qQEKkJWN/ZS+HxBUxrnmrArQxalpcwGw4zP2iLRMtqQIvPViiKiF tJ7Q== 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=bUlAcuwjHp/EuzhIcLezN9/PvKaaz9jMJPqbDp9rRYk=; b=1Eqjnuz+mu5oG+t2C+eyXzoBuwHS2P4/ZhHZsNyE49cemx+xZwA5IXHdV7DazhGOZJ H8Ym7gekS9Q/U53mUELwyz0eoHjCwhVb/pwROcqNLlS4661omC7LvsHyFLjAZlN6Ck9b qTV43hf8h02Y2eaFucocv//Jh6/+dVJKzayfBkMA79pAw0CHbtdI6KwBIGzgcHfTnLrp Lcw4XoqFLc6fSqaRB7/GpFbu+8bFjQ8lTQdEnr23aQCU8VsCPqMawOwteLnAHfVExmpj ILg9YMYToOhB8qWvTuqSp0V2i32eEARD8CpOCIFrKUUiJLqzuNfbgeL5xqSckx4r6h7h NGfQ== 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 127si3558844qko.404.2017.10.23.05.14.42; Mon, 23 Oct 2017 05:14:42 -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 9B1E26229D; Mon, 23 Oct 2017 12:14:42 +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=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 2BD4D622A0; Mon, 23 Oct 2017 12:13:39 +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 04AA162291; Mon, 23 Oct 2017 12:13:33 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id 5D68C62925 for ; Mon, 23 Oct 2017 12:00:27 +0000 (UTC) Received: from mxback9j.mail.yandex.net (mxback9j.mail.yandex.net [IPv6:2a02:6b8:0:1619::112]) by forward104o.mail.yandex.net (Yandex) with ESMTP id E601E704DD1 for ; Mon, 23 Oct 2017 15:00:25 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback9j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id edBcyhJFFF-0PFePvLd; Mon, 23 Oct 2017 15:00:25 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7orkcctvL2-0Pt8es2L; Mon, 23 Oct 2017 15:00:25 +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: Mon, 23 Oct 2017 15:00:03 +0300 Message-Id: <1508760010-14064-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508760010-14064-1-git-send-email-odpbot@yandex.ru> References: <1508760010-14064-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 234 Subject: [lng-odp] [PATCH API-NEXT v3 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: ec6510b33e8b96d6d6670efb9dc3c9101baed6c6 ** Merge commit sha: e5f6958b8e62d20650a2ea4a0c17bed262ad2ae1 **/ 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 221798ee8..f1c8b1158 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