From patchwork Fri Sep 8 14:00:07 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: 112083 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp364129qgf; Fri, 8 Sep 2017 07:03:36 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCR4UoOfwcMMzOcf2Em8s37PeYgSieSb17TH09hiK1oFSFasOsst02exrVcHDPATrWOztSP X-Received: by 10.237.34.66 with SMTP id o2mr3914038qtc.69.1504879415972; Fri, 08 Sep 2017 07:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504879415; cv=none; d=google.com; s=arc-20160816; b=i2OjyYUyHscKv2kXXK+tpuEtwfh1L4J80HGiiBW0yDtW8MVLqIBt355yBdzybY0Uqp kdC9FFP9RX5s4fThcFTJEFfPUF7eeL34koZGKup2BSUm/08OA6sFGVtRjvI9HeKJ2zU7 F7b8EkH+MjjIf1zpAsPgZVNCalXKVpzBdJEwFaSS95g03CPhWM8pPX5wsJm2pAgO7Bgz pFFdj9MCiQ7A1/OGn2b35DH8MIH1Ugqg3CHMPmoTEge6C8YN/435vR6NAoP4YVBS1WOE 5Te3QEBh4AZ7IpCd+wrIGBuyGrUvmCd09XqgABOOJ/rICmf79EVdqRykFkWkfhDuRj6H C2fg== 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=3sQ3KDm5DKVxKwmLU7jyau0PUUmWNOiAEbsCJJsBgO0=; b=YZZNEsli8Y69ACVTzaujkbe2qcgL6MlMheB16eiPcje6cUojYfAGq3R2Vg5j1CaGKE 3mwhUfkq37aKiydvZrGyYLNXBr4sn1vBfpIvpYIFIbH+Ribqk1AvMB97kCpWJDkqkyyw 2oXxYXO5bE5f/FDLzqpdsyPfIM6q+VIvnzcoiAI/PNRf22qzX3qfjlhnbdjiErldRtbx wH8Pe+YdrOxr3HT/hllEHQtyEJLmtseEoJ1EmR7xyM2MgLzsaH9oZG12baE90Js0H57H JW6By3E+XLxoceJIi036n44uZ5VLGlNgSmy5JOzZn+7BfbldplMfnlcJZLQNZ9TAdOWu 7tcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u46si2231027qtk.309.2017.09.08.07.03.31; Fri, 08 Sep 2017 07:03:35 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 6367365C0D; Fri, 8 Sep 2017 14:03:31 +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,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 C1472644B2; Fri, 8 Sep 2017 14:00:47 +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 9AEEE62DF3; Fri, 8 Sep 2017 14:00:28 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 38DB360730 for ; Fri, 8 Sep 2017 14:00:24 +0000 (UTC) Received: from mxback7o.mail.yandex.net (mxback7o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::21]) by forward101o.mail.yandex.net (Yandex) with ESMTP id B22AF1344F5E for ; Fri, 8 Sep 2017 17:00:22 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback7o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id N6aDBQ9uib-0MV4Oi7j; Fri, 08 Sep 2017 17:00:22 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id IwYlQdvFwh-0MK86C52; Fri, 08 Sep 2017 17:00:22 +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: Fri, 8 Sep 2017 17:00:07 +0300 Message-Id: <1504879212-3689-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504879212-3689-1-git-send-email-odpbot@yandex.ru> References: <1504879212-3689-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 170 Subject: [lng-odp] [PATCH v1 6/11] linux-gen: buffer: optimize header layout 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 Pack most often used buffer header fields (including seg[0]) into the first cache line. Signed-off-by: Petri Savolainen --- /** Email created from pull request 170 (psavol:master-packet-ref-rework) ** https://github.com/Linaro/odp/pull/170 ** Patch: https://github.com/Linaro/odp/pull/170.patch ** Base sha: 360c1d34b52a2356619b9290811862b9de41de00 ** Merge commit sha: e19cce86ab00ccd959d2c3c82c0786ec6da19ba7 **/ .../linux-generic/include/odp_buffer_internal.h | 43 ++++++++++++---------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 309094658..0c873d2d2 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -43,41 +43,46 @@ typedef struct seg_entry_t { /* Common buffer header */ struct odp_buffer_hdr_t { - /* Buffer index in the pool */ - uint32_t index; - /* Initial buffer data pointer and length */ - uint8_t *base_data; - uint8_t *buf_end; + /* Buffer index in the pool */ + uint32_t index; - /* Max data size */ - uint32_t size; + /* Total segment count */ + uint16_t segcount; /* Pool type */ int8_t type; - /* Burst counts */ - uint8_t burst_num; - uint8_t burst_first; - /* Number of seg[] entries used */ uint8_t num_seg; - /* Total segment count */ - uint32_t segcount; - /* Next header which continues the segment list */ void *next_seg; /* Last header of the segment list */ void *last_seg; + /* Initial buffer data pointer and length */ + uint8_t *base_data; + uint8_t *buf_end; + + /* --- 40 bytes --- */ + /* Segments */ seg_entry_t seg[CONFIG_PACKET_MAX_SEGS]; + /* Burst counts */ + uint8_t burst_num; + uint8_t burst_first; + /* Next buf in a list */ struct odp_buffer_hdr_t *next; + /* Burst table */ + struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE]; + + /* --- Mostly read only data --- */ + /* User context pointer or u64 */ union { uint64_t buf_u64; @@ -85,6 +90,9 @@ struct odp_buffer_hdr_t { const void *buf_cctx; /* const alias for ctx */ }; + /* Pool pointer */ + void *pool_ptr; + /* User area pointer */ void *uarea_addr; @@ -94,9 +102,6 @@ struct odp_buffer_hdr_t { /* Event type. Maybe different than pool type (crypto compl event) */ int8_t event_type; - /* Burst table */ - struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE]; - /* ipc mapped process can not walk over pointers, * offset has to be used */ uint64_t ipc_data_offset; @@ -105,8 +110,8 @@ struct odp_buffer_hdr_t { * inlining */ odp_pool_t pool_hdl; - /* Pool pointer */ - void *pool_ptr; + /* Max data size */ + uint32_t size; /* Data or next header */ uint8_t data[0];