From patchwork Mon Jan 22 10:00:14 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: 125372 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1067053ljf; Mon, 22 Jan 2018 02:01:27 -0800 (PST) X-Google-Smtp-Source: AH8x224jDFLodZTZTWvgpWkCF7e2ibqWS7qlqk0jW9SjbZlrPFrDhyFwc76zdJzbNE/nHpTCaQt/ X-Received: by 10.55.1.207 with SMTP id u76mr9236621qkg.344.1516615287506; Mon, 22 Jan 2018 02:01:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516615287; cv=none; d=google.com; s=arc-20160816; b=1C4ydYBPEo7aI1GN+wYbSeEW0kBW5xrbMjPhZFZNNie23trUna5R212fnY5pxG6DqF tummVPpfKeD+/UKv+QWCb0FEFHlb30hgMMNDQRxJLbpwpTjSf8aaBNLUNOmt0ETPKjDI EgR88iF1QPS5U0x0rBn7RiTianrbONJubnF1GFKUyw+IRq2VYsPykEV9i+Csy3ITVSRy 89R2WzF2FiNE+7eC1UH1Z97bFQLFvRVs0q69cAs34eF+1nOtr5r78HYbu1qBupEvxdSh a+h/IxoMpmFCPdJCMn61X17une3xRO43/82p9+l5mERX4EwqGTuIPQmhm4hlq9XxbpLP Bi6w== 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=Y44oHy/mJxyMawkCuXIvjyZLbfRpmla5zdM7G2eG7VI=; b=umPVy+iWtEpJa/vO0ps/I5nn6mMNdwroOc+GxXyFesB6efVhLLwVDsULy+u9zZOsCE wnpN3q792MnnfZMZoWDOspWMG+Qim93Ja6m2gSGBDd0EG9i+hWE4AeR9A9aR8f0TnSSv B0B+laEMwFX4XpK0+q4e1zYZx1Qm6VR4sEY3WvP+0CDBzwUriEZu6QY5yKKQ69ycVyEL IH6Zjfbg31Bl8MiAWxfdPGPGgL2XnWOr339ElMTlBVEa10ldfqnukyiRPSMaMd55kX1u 09q34EZWkgp8ixDzcethlkcUeWULHAVvVgKNNBuvaaJOcmvP2Pzugh0LCqpn7N+OUbme 3sRw== 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 s78si2571916qki.293.2018.01.22.02.01.27; Mon, 22 Jan 2018 02:01:27 -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 2BAB560997; Mon, 22 Jan 2018 10:01:27 +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_H3, RCVD_IN_MSPIKE_WL 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 67B1061518; Mon, 22 Jan 2018 10:00:38 +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 735CB607B5; Mon, 22 Jan 2018 10:00:29 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id C1208607B5 for ; Mon, 22 Jan 2018 10:00:22 +0000 (UTC) Received: from mxback15g.mail.yandex.net (mxback15g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:94]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 528901242D75 for ; Mon, 22 Jan 2018 13:00:21 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback15g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id fMEI12ITbF-0LS41kmH; Mon, 22 Jan 2018 13:00:21 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id uZYuxzgHNY-0KHeplJj; Mon, 22 Jan 2018 13:00:20 +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, 22 Jan 2018 13:00:14 +0300 Message-Id: <1516615219-32202-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516615219-32202-1-git-send-email-odpbot@yandex.ru> References: <1516615219-32202-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 392 Subject: [lng-odp] [PATCH API-NEXT v2 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: f925f103c90591776f73863d30159357b08bf71e ** Merge commit sha: 81c268611ef9755e8347f532022e22148f7d2a09 **/ 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 d78c6c37e..bd90ee156 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_ALIGNED_CACHE 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 0f2001a10..545dae2dd 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_ALIGNED_CACHE _odp_packet_inline = { .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,