From patchwork Mon Oct 16 13: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: 115911 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3661160qgn; Mon, 16 Oct 2017 06:05:23 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TxdueERxY5XtemAMnx+YCBNdTVnVMY5hIAsEEvb4hw+HFtLkO5zR7tTkxE6q4JZL0kLooa X-Received: by 10.36.185.67 with SMTP id k3mr938734iti.112.1508159123603; Mon, 16 Oct 2017 06:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508159123; cv=none; d=google.com; s=arc-20160816; b=CNFSX6Ota4tt4U3HJmgIdi+rlC/ZaaK4qhAuaIIrN+AGoSqf4ybRg6DkMCZjmrkWRM CP/BHR7pr0gDEzR/e3AxCg6R2hNkcbAN+VSFXSGC8zgWOelvTfB6F9mwnKQXjLyW4+ww uz8AcRA4joiP4HimQH8XmMC11GINz3c0YPWjesa2ccWaH0PcHamlHDvpPjEaJnhnA3ad 7h6553Nae0VrWXvnekcegDl6pwZHQd2kEfBbGA/I9UNdeHF59DRxUWIGjy7DgywfngJw XTE4bAJIvQJPMTBLRaWF/9oTnxDiP/uLie2MP1+cgtI4bp1ZY+SDeuKx7PCsLpFYQmq3 i4BA== 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=jZ1pXa3v1Uq+WjSEO5QAfMLiYbzs+fk6uFgLjabeyMQ=; b=C/zVOvVCFZ+yzfZLXBgpWJDIX+LUFC6CfFX+kV1A1Z45fa3vVhjkMRqaoza6rAQJ+n +uUcZWw9CJVBO1YR8fbZL3Pxrijs6An6wN9WulANfPKcDVcMBzKBJ+fCDIZVnOke89fP fTKtFYpEbpRFRG/HaJbPfI3zO1hNWzQYVLv2upFTzjT0zJ9I7d8CYj8tILVHNxucRRq6 JHNJMHv1l6lvINMeL1tyWi3rCLrA8wWXy/NyOfgvW7DL8mKs5Wsdb3i7tq7800P8jHMJ wQObH1ADfSZ5wNdjLpWZknCPY5+fe3WKLgIinVJ2WU5sdxr9XAr0mfeIOB5Kd0adhFSt iWJQ== 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 u7si5389991itd.45.2017.10.16.06.05.22; Mon, 16 Oct 2017 06:05:23 -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 A428F60CA0; Mon, 16 Oct 2017 13:05:22 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, 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 F098360AC8; Mon, 16 Oct 2017 13:00:50 +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 8ECD76082D; Mon, 16 Oct 2017 13:00:25 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id BE49D60632 for ; Mon, 16 Oct 2017 13:00:17 +0000 (UTC) Received: from mxback20j.mail.yandex.net (mxback20j.mail.yandex.net [IPv6:2a02:6b8:0:1619::114]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 4C2636A81412 for ; Mon, 16 Oct 2017 16:00:16 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback20j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id nwqhgEX43j-0FOiFqUw; Mon, 16 Oct 2017 16:00:15 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id AktaPQxe42-0EQSLkZs; Mon, 16 Oct 2017 16:00:14 +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 16:00:02 +0300 Message-Id: <1508158805-5932-6-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 5/8] api: pool: remove union from params 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 Remove anonymous union from pool parameter structure. Union makes it impossible to initialize parameters per pool type (use other values than all zeros). This change is not visible to applications (union was anonymous). 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 | 215 ++++++++++++++++++++++---------------------- 1 file changed, 109 insertions(+), 106 deletions(-) diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h index 7c9bee8ee..7b1e2d467 100644 --- a/include/odp/api/spec/pool.h +++ b/include/odp/api/spec/pool.h @@ -195,112 +195,115 @@ typedef struct odp_pool_param_t { /** Pool type */ int type; - /** Variant parameters for different pool types */ - union { - /** Parameters for buffer pools */ - struct { - /** Number of buffers in the pool */ - uint32_t num; - - /** Buffer size in bytes. The maximum number of bytes - application will store in each buffer. */ - uint32_t size; - - /** Minimum buffer alignment in bytes. Valid values are - powers of two. Use 0 for default alignment. - Default will always be a multiple of 8. */ - uint32_t align; - } buf; - - /** Parameters for packet pools */ - struct { - /** 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; - - /** 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 - the pool. The maximum value is defined by pool - capability pkt.max_len. Use 0 for default (the - pool maximum). */ - uint32_t max_len; - - /** Minimum number of packet data bytes that are stored - in the first segment of a packet. The maximum value - is defined by pool capability pkt.max_seg_len. - Use 0 for default. */ - uint32_t seg_len; - - /** User area size in bytes. The maximum value is - defined by pool capability pkt.max_uarea_size. - Specify as 0 if no user area is needed. */ - uint32_t uarea_size; - - /** Minimum Headroom size in bytes. Each newly allocated - packet from the pool must have at least this much - headroom. The maximum value is defined by pool - capability pkt.max_headroom. - Use zero if headroom is not needed. */ - uint32_t headroom; - - /** Number of subparameters - * - * The number of subparameter table entries used. - * The maximum value is defined by pool - * capability pkt.max_num_sub. The default value is 0. - */ - uint8_t num_sub; - - /** Subparameter table - * - * Subparameters continue pool configuration with - * additional packet length requirements. The first - * table entry follows the num/len specification above. - * So that, sub[0].len > 'len', and sub[0].num refers - * to packet lengths between 'len' + 1 and sub[0].len. - * Similarly, sub[1] follows sub[0] specification, and - * so on. - * - * Each requirement is supported separately and may be - * rounded up, as long as the 'max_num' parameter is - * not violated. It's implementation specific if some - * requirements are supported simultaneously (e.g. - * due to subpool design). - */ - odp_pool_pkt_subparam_t sub[ODP_POOL_MAX_SUBPARAMS]; - } pkt; - - /** Parameters for timeout pools */ - struct { - /** Number of timeouts in the pool */ - uint32_t num; - } tmo; - }; + /** Parameters for buffer pools */ + struct { + /** Number of buffers in the pool */ + uint32_t num; + + /** Buffer size in bytes. The maximum number of bytes + * application will store in each buffer. + */ + uint32_t size; + + /** Minimum buffer alignment in bytes. Valid values are + * powers of two. Use 0 for default alignment. + * Default will always be a multiple of 8. + */ + uint32_t align; + } buf; + + /** Parameters for packet pools */ + struct { + /** 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; + + /** 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 + * the pool. The maximum value is defined by pool + * capability pkt.max_len. Use 0 for default (the + * pool maximum). + */ + uint32_t max_len; + + /** Minimum number of packet data bytes that are stored + * in the first segment of a packet. The maximum value + * is defined by pool capability pkt.max_seg_len. + * Use 0 for default. + */ + uint32_t seg_len; + + /** User area size in bytes. The maximum value is + * defined by pool capability pkt.max_uarea_size. + * Specify as 0 if no user area is needed. + */ + uint32_t uarea_size; + + /** Minimum Headroom size in bytes. Each newly allocated + * packet from the pool must have at least this much + * headroom. The maximum value is defined by pool + * capability pkt.max_headroom. + * Use zero if headroom is not needed. + */ + uint32_t headroom; + + /** Number of subparameters + * + * The number of subparameter table entries used. + * The maximum value is defined by pool + * capability pkt.max_num_sub. The default value is 0. + */ + uint8_t num_sub; + + /** Subparameter table + * + * Subparameters continue pool configuration with + * additional packet length requirements. The first + * table entry follows the num/len specification above. + * So that, sub[0].len > 'len', and sub[0].num refers + * to packet lengths between 'len' + 1 and sub[0].len. + * Similarly, sub[1] follows sub[0] specification, and + * so on. + * + * Each requirement is supported separately and may be + * rounded up, as long as the 'max_num' parameter is + * not violated. It's implementation specific if some + * requirements are supported simultaneously (e.g. + * due to subpool design). + */ + odp_pool_pkt_subparam_t sub[ODP_POOL_MAX_SUBPARAMS]; + } pkt; + + /** Parameters for timeout pools */ + struct { + /** Number of timeouts in the pool */ + uint32_t num; + } tmo; } odp_pool_param_t; /** Packet pool*/