From patchwork Mon Oct 23 12:00:10 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: 116734 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4578835qgn; Mon, 23 Oct 2017 05:18:23 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TwQxsb2gPVPstdBprvUoVbzHO27UsEtwdXc2L/TFFYgKAsLdlm2/zr0EKIHKlDdIFBIHVq X-Received: by 10.200.15.83 with SMTP id l19mr18977823qtk.168.1508761103666; Mon, 23 Oct 2017 05:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508761103; cv=none; d=google.com; s=arc-20160816; b=cOIeyilR3GFbQ8YRlfWkyOsSf92AR4+79oftCHKcWmEZLoag7UW8OJHknpc/OZ5nXh lWulzmDi+f+WGpmOJx0fpdiX/opYoGSFwsrr9Yykv99KLLNOxrAKjsKoFNgvVEBOiGjE 71qLBAHZFzax36B/N6kgDu8kwT+/UeJ4aLW5kS/1NFoexSREyJVxuw3rhkFcjbtpqmXX qqmDXkRfWWssYprjwQQbh+PY8BZe5Vivoa4E3P1NPhAxEMuifgBxIpFWrNcIvaDWy+Od ZpwNncHqPWfkX1by0Xp3KfhCLCW9/P4f+11X86R7gr+Kh+j6P0txrYFyHQ1Pof9u4Pab 3taQ== 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=w99L0nnjilnf8fgSLO3YCrJbAYQSjGyMwHx+exgouvA=; b=a81AGGDmCLlTgsG8KmCfWL9HMDX9PnXo+RHyNWqaWUGuuGR4cEpGw5XsSMcXP8jmLX lyxZjNbKlYuse7HAWEMDaFESyLsfOWwiFZ5NaNTyBXxD3SNrQ1fJ8yWGIfs0v26CFZ/w PbXxwZvPwUAjRNeWKsXCjXn/iJIOys9ngcUwUfe2LM0s4v7+fE+IKGGtrtbKdKQVlcvV Y+pew9elei2sE0VgWHT/qRxAfifCseKYib0G5oEh16C73chcuUrSJUcoJVsfZP2yQVwq 9igf+8Fltg68GORwA5BmY+ZHY2qWICd+AseMAQOC0j60cmNp21ztkHss9aN6Qz6W6XDO qOaA== 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 d129si16055qkf.177.2017.10.23.05.18.23; Mon, 23 Oct 2017 05:18: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 5FB5D610DF; Mon, 23 Oct 2017 12:18:23 +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 DDE31628B1; Mon, 23 Oct 2017 12:13:56 +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 0643B622D9; Mon, 23 Oct 2017 12:13:45 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id CABC362991 for ; Mon, 23 Oct 2017 12:00:34 +0000 (UTC) Received: from mxback4g.mail.yandex.net (mxback4g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:165]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 3D04B6A8383F for ; Mon, 23 Oct 2017 15:00:33 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback4g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Oc2UaYqC4O-0X5i5cJ7; Mon, 23 Oct 2017 15:00:33 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7orkcctvL2-0WtWove5; Mon, 23 Oct 2017 15: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: Mon, 23 Oct 2017 15:00:10 +0300 Message-Id: <1508760010-14064-9-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 8/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: ec6510b33e8b96d6d6670efb9dc3c9101baed6c6 ** Merge commit sha: e5f6958b8e62d20650a2ea4a0c17bed262ad2ae1 **/ include/odp/api/spec/pool.h | 211 ++++++++++++++++++++++---------------------- 1 file changed, 104 insertions(+), 107 deletions(-) diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h index 63e063bef..b615831cf 100644 --- a/include/odp/api/spec/pool.h +++ b/include/odp/api/spec/pool.h @@ -195,113 +195,110 @@ 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_subparam. The default value - * is 0. - */ - uint8_t num_subparam; - - /** 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_subparam. + * The default value is 0. + */ + uint8_t num_subparam; + + /** 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*/