From patchwork Tue Oct 17 13:00:21 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: 116096 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp4880313qgn; Tue, 17 Oct 2017 06:14:55 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QY0lIg8a9sFdHuMKtezoO7ahqm2fmQPtuca5FgNNBKoBCITDZ/om53WHUC/AT+z2LJdbs4 X-Received: by 10.36.120.142 with SMTP id p136mr5417749itc.87.1508246095198; Tue, 17 Oct 2017 06:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508246095; cv=none; d=google.com; s=arc-20160816; b=DiuJrrTuaOHwtoyLd6wSIarJbEVKvCmOwfiRk3eqz86q2FbR3rDpVZpGMHe+XpO4SK 0PYrpTBzYbn0gwlGq3HcCtQARZez84v59AD3oRiVPfkuiDGnNTXqpfgHDaJ1y+XXwTMg 9nFwAo/m6fBB6mVTi+38a0aRHXbtYdTfP51J5Q+d/YXDOzVwadcci+qVFrZ1qfm4bba1 /2JZF5NfoeKttVaOJj7Vt7hg/QpCPdU1YXGyBeLrwWMsK9IxHRCAridnsd6k4Zhdi0b5 EwFtnc3Q5ndG40HWTrNYt3Hko2tshuWdeCWuxundEx9QtrU85dp1cVzQ/qua1LX8mORo 1ZhQ== 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=lHiaOXeiRHdMSBM7bslnWLpk0Wj2AvCbSq6YkRJfkyE=; b=nKW4tonSFftWSP2h0jTZR1L9MQxyrlVzm+gNu4hjiXQC4QMLUXjXn5R52NOMCzWfVc +9CtXeGUxDLMez0Mse8UddZMxUMaUGij1xudAQFlTzrCP4csHFUr+TM2+7zS9dVGK+f3 2fKBTvGIUpKyGAh/uovmQlE3waNm+QlTdjpraCRzuYKwzJ/cqAC27A3+ZCy6ou8xHUDg Hy+t/g9DkwJNOjjMdpDnUH2auyg3bnhw0dz87IcO+Pb1J9nPJDTZ4/6UAf5OiyVZvYCj 9JmccrcXTUT+nfc53S65bySLddtxOwuLiimn8Llp7tXtMG/p/wbD+Ic0FZz1RU8USPpS obFA== 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 v22si6022521ioi.128.2017.10.17.06.14.54; Tue, 17 Oct 2017 06:14:55 -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 AE2C262931; Tue, 17 Oct 2017 13:14:54 +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 EAF0162937; Tue, 17 Oct 2017 13:03:07 +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 8457A62931; Tue, 17 Oct 2017 13:02:56 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id 73B3B60B2A for ; Tue, 17 Oct 2017 13:00:34 +0000 (UTC) Received: from mxback15g.mail.yandex.net (mxback15g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:94]) by forward104o.mail.yandex.net (Yandex) with ESMTP id 5BBFC7025C9 for ; Tue, 17 Oct 2017 16:00:33 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback15g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id eoEps9iBpL-0XnSjSxX; Tue, 17 Oct 2017 16:00:33 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lxH8Glq2Gn-0W4OeTC9; Tue, 17 Oct 2017 16:00:32 +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: Tue, 17 Oct 2017 16:00:21 +0300 Message-Id: <1508245228-16824-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508245228-16824-1-git-send-email-odpbot@yandex.ru> References: <1508245228-16824-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 234 Subject: [lng-odp] [PATCH API-NEXT v2 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: afeda4d14bb6f449cb269680cdbd56b26726eedf ** Merge commit sha: cc4142b7bb4d97ad57cb925e9fc4165f1ab3f663 **/ 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