From patchwork Mon Oct 16 12:59:58 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: 115909 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3658680qgn; Mon, 16 Oct 2017 06:03:32 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SEJNC1dIoyYofzxyskyc1y4GY4S6imTu7LcEcVgv5cRpUdwl76mEZ3lBcj1DmpaZo68Ywe X-Received: by 10.107.161.144 with SMTP id k138mr11994953ioe.218.1508159012549; Mon, 16 Oct 2017 06:03:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508159012; cv=none; d=google.com; s=arc-20160816; b=NmBOy0nDbGTvMuU2RCyga4zTRXh1+QJprWcUYDSLs5IlZGa09FbhRfJ5mxl+nXbcvk WMabRCCIivjk1qkHHrtyrRAPR0TTmYKLaKJhO3GnCj+o+C+WVe+PbpWrhvbJlG+4OxGz jLxSW7jP0KmQghBTvlFNxKZcAmYBtzHFCFgZru0hIOIlPPKhxh10xiRJIVABNM18PMQe /g01Fxo1PjNaz9meuTkcRlDsqlIzzQZJjjQaxdDGOgDCVVHnKUVQCqI47B8dKBqVnVZI rNgf7Q6WHI3RKqEbKRD1SH0ndp6ZbsGVAMvqKCpsxcLeHhdJ4QOJhhq1cuIvE8GPcDIX 753A== 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=iEVj1FcJpEesvh73bddjE6PKFWefG8x4KzccuPu69uk=; b=vB2dHIWT/YVklNs3K6fz1Xc+cGrP3WZaqD9WWJSrZsZW1WAGmPWW8w8ou9xwJWWvXV UQuy0u2uw/WRxrBs3v+4zRAzKRBX45x0zQGD1E0g/Iba3Zcq0a54ZN9H8xdTIs1sy8CZ +K1PwGr1y8SMjudmnqD1w65LqD0WUPHRjFpR0HYRu8qWKvzU15xV2U3fzcDW4ulxagow wLU4sm6TWPCQCr4OAxVArh56NZF8gqtRCAegmI/5rU5HpAXU9Lnkt3nsNCuHUMj+Tjhz 1CQ0xIQiPDKNHGbKLo3CzZsF2uzcMNpOpmPF7sEWbKtwH2NMbTvcTLOZlCSU0rZxithc IGrA== 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 b82si5393441iof.265.2017.10.16.06.03.32; Mon, 16 Oct 2017 06:03:32 -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 1480060B40; Mon, 16 Oct 2017 13:03:32 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, 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 4DE9F60A58; Mon, 16 Oct 2017 13:00:42 +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 9FD2160927; Mon, 16 Oct 2017 13:00:24 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id CCD71607DC for ; Mon, 16 Oct 2017 13:00:12 +0000 (UTC) Received: from mxback2o.mail.yandex.net (mxback2o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1c]) by forward104j.mail.yandex.net (Yandex) with ESMTP id C646442412 for ; Mon, 16 Oct 2017 16:00:11 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback2o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id JJa9RybE9q-0BGmuURV; Mon, 16 Oct 2017 16:00:11 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id AktaPQxe42-0BQeKHss; Mon, 16 Oct 2017 16:00:11 +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, 16 Oct 2017 15:59:58 +0300 Message-Id: <1508158805-5932-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508158805-5932-1-git-send-email-odpbot@yandex.ru> References: <1508158805-5932-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 234 Subject: [lng-odp] [PATCH API-NEXT v1 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: 54f5fc670a7c125b6b0098e34e68fe3b45875069 **/ 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