From patchwork Tue Jan 16 11:00:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124652 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp972025lje; Tue, 16 Jan 2018 03:01:22 -0800 (PST) X-Google-Smtp-Source: ACJfBovUVTQoB4w1TO62TxcTA8E27lHh5T4iJwMfpumC8WI3Iwd7s0RZq/fyGOcC5QDgW0h/2tPX X-Received: by 10.55.161.21 with SMTP id k21mr19607220qke.260.1516100482147; Tue, 16 Jan 2018 03:01:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516100482; cv=none; d=google.com; s=arc-20160816; b=jS/O9IhjlBJ1N9g5VNOgWbAeL9phIbwrsHHkI109RmOIezNRj8AIa5tXrt6EshiG4D wnHAowi+tGCsCcBp5iyjDTm4dAC3pHMzIpyu7xvf+ZygIk+5wIgSN8O9bwpbJFlKkgVI L1tbINtbq7YEIAKTTYPlV31JX1+iXegP1XlGwGHT5CmdlhjX9dMqmrUIR93LYojysdev FJBVSqUioWMYGPL/T7eJ+AW9fr64/qhddu0+QWEUiAwGahtXHSA00pq/UXSBtxL6PjJj txcr5uHQBdueZypAdgVDBVUuLmkwntGUNcdpEibXsH7QNL4q+xAoE3rmZfCvK6zeEqNO UkHQ== 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=zaHXtOkXT/UI9lsjUAz3Pu+tCdBjkbOHu1j4uRYloeY=; b=KjTV82bR2qf6J4ItKjyKdehT7muYVhKxLKmaP8BOyyPJK/nNbRXsbl8jZT5od0KtEk 7bEN2pbnVMntcjtV/U4QFxTzmHncRAu7upLxtao+ERi/6ytjCijCmZmmC6GjDpcdCl/6 9I1fE1yeW+Fs9FC4+A0aGLm09vn4zi2gjdxIV4I6Itoy3lDZ+MhVGSddlmOxruk3zMw9 exd+Jk7ZLYDWmYoOwhjt1ABpgpDhxerQJOVfC+JO6Q/JAfKEw2Z7GZHJH7bWMbBnjDuO AOv9dwq0Z/kXAd+oSMNnxXjlB6OMUE/MqCtcr62TADrvnezv2BDm6rpp+mnH4hm2i5Nr 9z1Q== 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 k88si1917321qtd.334.2018.01.16.03.01.21; Tue, 16 Jan 2018 03:01:22 -0800 (PST) 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 D54E96178F; Tue, 16 Jan 2018 11:01:21 +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_H2 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 E1E41616F5; Tue, 16 Jan 2018 11:00:29 +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 A683161767; Tue, 16 Jan 2018 11:00:18 +0000 (UTC) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by lists.linaro.org (Postfix) with ESMTPS id 6D90960C4C for ; Tue, 16 Jan 2018 11:00:12 +0000 (UTC) Received: from mxback7j.mail.yandex.net (mxback7j.mail.yandex.net [IPv6:2a02:6b8:0:1619::110]) by forward105p.mail.yandex.net (Yandex) with ESMTP id 963424081177 for ; Tue, 16 Jan 2018 14:00:10 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback7j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id VlppqwAzhA-0AAqEa5R; Tue, 16 Jan 2018 14:00:10 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7uRxxYxlfl-096axi0w; Tue, 16 Jan 2018 14:00:09 +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, 16 Jan 2018 14:00:03 +0300 Message-Id: <1516100408-8246-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516100408-8246-1-git-send-email-odpbot@yandex.ru> References: <1516100408-8246-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 392 Subject: [lng-odp] [PATCH API-NEXT v1 1/6] linux-gen: packet: single user ptr field 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 unnecessary union of user context u64/pointer. Rename the field for better code readability. Signed-off-by: Petri Savolainen --- /** Email created from pull request 392 (psavol:next-user-ptr-init-rebase) ** https://github.com/Linaro/odp/pull/392 ** Patch: https://github.com/Linaro/odp/pull/392.patch ** Base sha: f6dab2bfa90ef5d3146cb76f86bc8782666f0f3e ** Merge commit sha: 7244f46bcf5e4a0fce4048e306f224f31e9a4d2f **/ platform/linux-generic/include/odp_buffer_internal.h | 8 +------- platform/linux-generic/odp_packet.c | 10 +++++----- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index c56c5b01b..5252dc808 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -84,13 +84,7 @@ struct odp_buffer_hdr_t { struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE]; /* --- Mostly read only data --- */ - - /* User context pointer or u64 */ - union { - uint64_t buf_u64; - void *buf_ctx; - const void *buf_cctx; /* const alias for ctx */ - }; + const void *user_ptr; /* Reference count */ odp_atomic_u32_t ref_cnt; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index a812fec15..8f0a4eb83 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -35,7 +35,7 @@ const _odp_packet_inline_offset_t _odp_packet_inline ODP_ALIGNED_CACHE = { .pool = offsetof(odp_packet_hdr_t, buf_hdr.pool_ptr), .input = offsetof(odp_packet_hdr_t, input), .segcount = offsetof(odp_packet_hdr_t, buf_hdr.segcount), - .user_ptr = offsetof(odp_packet_hdr_t, buf_hdr.buf_ctx), + .user_ptr = offsetof(odp_packet_hdr_t, buf_hdr.user_ptr), .user_area = offsetof(odp_packet_hdr_t, buf_hdr.uarea_addr), .l2_offset = offsetof(odp_packet_hdr_t, p.l2_offset), .l3_offset = offsetof(odp_packet_hdr_t, p.l3_offset), @@ -265,7 +265,7 @@ static inline void packet_seg_copy_md(odp_packet_hdr_t *dst, dst->timestamp = src->timestamp; /* buffer header side packet metadata */ - dst->buf_hdr.buf_u64 = src->buf_hdr.buf_u64; + dst->buf_hdr.user_ptr = src->buf_hdr.user_ptr; dst->buf_hdr.uarea_addr = src->buf_hdr.uarea_addr; /* segmentation data is not copied: @@ -1258,9 +1258,9 @@ int odp_packet_input_index(odp_packet_t pkt) return odp_pktio_index(packet_hdr(pkt)->input); } -void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx) +void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ptr) { - packet_hdr(pkt)->buf_hdr.buf_cctx = ctx; + packet_hdr(pkt)->buf_hdr.user_ptr = ptr; } int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset) @@ -1931,7 +1931,7 @@ int _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t dstpkt) dsthdr->input = srchdr->input; dsthdr->dst_queue = srchdr->dst_queue; - dsthdr->buf_hdr.buf_u64 = srchdr->buf_hdr.buf_u64; + dsthdr->buf_hdr.user_ptr = srchdr->buf_hdr.user_ptr; if (dsthdr->buf_hdr.uarea_addr != NULL && srchdr->buf_hdr.uarea_addr != NULL) { memcpy(dsthdr->buf_hdr.uarea_addr, srchdr->buf_hdr.uarea_addr,