From patchwork Tue Oct 17 14:00:02 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: 116114 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp4931601qgn; Tue, 17 Oct 2017 07:00:49 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TaAWnEUwdF2sm2lx1siy9jeI6xW7tyNNCFyOFJzH8WSQC13+fq7c0GIz1GFU8e3+D/vIwL X-Received: by 10.36.73.164 with SMTP id e36mr5315919itd.129.1508248849575; Tue, 17 Oct 2017 07:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508248849; cv=none; d=google.com; s=arc-20160816; b=Koq7EXlSElSqOjgLUiTq9cZPDuAm7srRDLbWgBN7wVIWjYkp709DlOx5Xae20aQf+1 JLYUgbGZg2Tuzv5LycISzJOlAaav2Z7kpW8170/Wv+KUcWBPGA3btvoAs0x4vN+D4Qf/ XT43raleRg29cD05gUMLQygI/zoVUwfqXCUj1B2qKyUe99NRoOVlHX8YsSkf9nT/UNkT O/enV6HReRBsccycFdoW2Zc2rrRWmkDuzV/FOf1DEwZDY/ELyZrQyFVhLKiQy+YIMst9 shzWGdJTkGUJmfx/rm2fvs9rKI6CWCzL/wXmbBwQNGtBjNyrU4/vUglbvbXQVnjq19Hv qCvg== 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=uTtxrwKt6aP/RDL6kx4fH0ou4v01DZ/sAibiidQFV00G9WJiG0bTNvL83IkpcPwaF3 UTRGndebfplBnBpF0WBz9fvw2qKRxWaeYb5SvVkkHTV8tE+g2WsW6wLBC2onmMu4R1uw FTlkSkt993H9CsaVyHQpJaAWtHQHwIesE4OcYdBDAYt5BPvr3CXkUiNW7A7xYrAin5sf 1dZKlPp4sWzl4MzURHEoyhIEE8EEm4G175DKkr21rrL5BALKDvLv303pdWlv5qgwB8iN Uz9RBEhYOdKk0DAtpjIUPy63F2RfgNbTieth8f8NA1vtvBN4TmJwNL2MbxAaWGKMBctC 3LhQ== 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 o137si6779985itc.145.2017.10.17.07.00.49; Tue, 17 Oct 2017 07:00:49 -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 CDDF8628A9; Tue, 17 Oct 2017 14:00:48 +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 45F13628B5; Tue, 17 Oct 2017 14:00:31 +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 6C7D6622B4; Tue, 17 Oct 2017 14:00:22 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 655E3622B4 for ; Tue, 17 Oct 2017 14:00:16 +0000 (UTC) Received: from mxback20j.mail.yandex.net (mxback20j.mail.yandex.net [IPv6:2a02:6b8:0:1619::114]) by forward102p.mail.yandex.net (Yandex) with ESMTP id B65F0430352E for ; Tue, 17 Oct 2017 17:00:14 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback20j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id qMSeAa5b2Z-0EYigvb8; Tue, 17 Oct 2017 17:00:14 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id tTs7mS0qFy-0D4m2uCZ; Tue, 17 Oct 2017 17:00:13 +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 17:00:02 +0300 Message-Id: <1508248809-4850-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508248809-4850-1-git-send-email-odpbot@yandex.ru> References: <1508248809-4850-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