From patchwork Thu Sep 14 09:00:05 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: 112516 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp517824qgf; Thu, 14 Sep 2017 02:10:09 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAK9IZ3RebFmavXQzNoAznEcZwXIHFEGk9MoIAsFIMQ8hyZAAX25BxnDGRYRQ5ZSZ7y4n34 X-Received: by 10.237.52.68 with SMTP id w62mr10696285qtd.217.1505380208784; Thu, 14 Sep 2017 02:10:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505380208; cv=none; d=google.com; s=arc-20160816; b=n119AUB/GeM74+oulVv0yhlcD1nstmsHnL/XZiqeP7+HOvdv69cmFYUK3F/H73YlJt KdBgMqW+dpTmZqO9sL1M1jjHW4JcSrnGyBE8WRDu/HEoWiM0cQEn7Eyn2Cm99+QzUt9G KHvlAgmvQ4qImiCRbVaP+oynVdd8GkyWjoaf3oYWCLFWXxscgFyckZpOm2/Ypmgdd/6J awBrEvgToOj9Yt2E0Hvo2so7nDuBi94W/jRHPGXb+i2oYl7llThkmIb7phcDRfWWt0Ye 6ikJiDmSC1bm7A33+wA5tW2tCRl/CR1IPCaSFv8fa6FC7Qn5lkM8RAkBrdmrTiPP2ZO3 VAkA== 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=lScy3+ZfiPdVgWgrJi5Te8TLMU0dB7gwRxAJVzlkO+I=; b=Yk4NzRtAn7Cf4Zl2ZhTC0qWfh+FIPcT4m4sx/V8COt1ibrxZeUGww3memTnORrNLYp vgGmrWhXOPFwnYQi/kV2XSqOaJMOFhc5q9A0KNsyJ5GAGHalreRYhVaOqmEGFsxyJJQC rJn9jng7Ga/b6vYFkxdx6V4fSIIwcittOASMxKu/SsRP8iNkjYLZTTIf5EbWANai6vBt jb1nMLAMbVFL4Dt6pb484LQlPP/f37De+D0ueOb5+OJnCPYBzuQvYFNZu9OWYBW4StXC uqcoowWWFvv0ENQYCsy6Kt45LYKZ+gDHycDfvvkQ4odPJQRcCutUYPn3xGnpy/qjjfHy iJxA== 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 r39si17229449qkr.555.2017.09.14.02.10.08; Thu, 14 Sep 2017 02:10:08 -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 65F2062CE2; Thu, 14 Sep 2017 09:10:08 +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 86C9C60C1F; Thu, 14 Sep 2017 09:01:58 +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 4B0CD60C1F; Thu, 14 Sep 2017 09:01:49 +0000 (UTC) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [37.140.190.182]) by lists.linaro.org (Postfix) with ESMTPS id 97C0D6093A for ; Thu, 14 Sep 2017 09:00:51 +0000 (UTC) Received: from mxback3g.mail.yandex.net (mxback3g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:164]) by forward102o.mail.yandex.net (Yandex) with ESMTP id 0811A5A033E8 for ; Thu, 14 Sep 2017 12:00:50 +0300 (MSK) Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [2a02:6b8:0:801::ac]) by mxback3g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id yaJ86RrsrD-0njuJCXk; Thu, 14 Sep 2017 12:00:49 +0300 Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Aoyyu0Wxlx-0nXunRrK; Thu, 14 Sep 2017 12:00:49 +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: Thu, 14 Sep 2017 12:00:05 +0300 Message-Id: <1505379610-1146-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505379610-1146-1-git-send-email-odpbot@yandex.ru> References: <1505379610-1146-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 170 Subject: [lng-odp] [PATCH v3 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: fb3f36cec108ce9c55241d9f0e66d4832a552b8a ** Merge commit sha: 3baec92b29f68295264bb3a780277f7f1b6cbb83 **/ .../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 30909465..0c873d2d 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];