From patchwork Mon Jan 15 13:00:04 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: 124517 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp661663lje; Mon, 15 Jan 2018 05:04:44 -0800 (PST) X-Google-Smtp-Source: ACJfBouDwUf8jHe79dtJp+SsH4CsNYtT6ejikeiT/4Y4nQ8X9nNS5TmTPsf87HwFzU4JyzIEuXUC X-Received: by 10.200.27.232 with SMTP id m37mr20144791qtk.171.1516021484004; Mon, 15 Jan 2018 05:04:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516021483; cv=none; d=google.com; s=arc-20160816; b=AYbZKEmBTn5Ul3w/wrhznS0QFyqjs1X3c9g0looG4as+lqNjSc6eYFjl1+6za3ayoM Lf/oX0kcKg8Bx5k/+poPQQabrVH/wegxTMV3R5OML9+qmbfOtwR+Zr0ObaO6VH2rLmgF EG4hdsd2dl/PDYiWsTlE0nRPxOOfb3Ci7VoSwlSGaoM0dZ8Q51SfbX4k8YOGW6sn2i57 XwJ6e6aQ/vDunp5OSQalOlhHrSQXACxImcsANDF0PV4TNSZU+IJ8MKXgl0tZTFeR8QTT G7kBh7luq7w9naPhBzcycNf4p/c/HyEOqC1EKYRiI3Sf72Y/NCHntxirZ0S3WEPNatlP pPnQ== 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=9gVrRwyxyiCwsMino++Nh4DscNS2mbzvqTOry13cU18=; b=WMRSmGHIWPE2FtaGgZhDdn/VUXELxgLcvlK2ScY//IHEs2aTF2n3B1TUgPWQwoSf/k oqr47RT4B3LrSY3l4D1pxEMNAMzllAGG4lSPA2bz6hy+ZKKJ3Z5ETS80YcnFz6LcUmDM 9g2qjukGfxRuy4ln4X0kHZKQMaFS6bX0O3dGJp/F0MqI2K7oLktM7PYGP/19pM67lo/Y 7A5x3Pk1w9mq5wCkxnreGLto2MbNuSBXP1ftXptnhKJpOXUUKiVipSXyR1D7WULj7zoB BwLTaymF+1lfr9sO4FxgdBnENEb7BmqixgC3V/AKwbK1O0COB7fYu5FJXhserRTHc9e9 R9Uw== 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 u21si8528117qke.165.2018.01.15.05.04.43; Mon, 15 Jan 2018 05:04:43 -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 AE3C761751; Mon, 15 Jan 2018 13:04:43 +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 715DE61742; Mon, 15 Jan 2018 13:03:33 +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 117E460881; Mon, 15 Jan 2018 13:03:20 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 9B36460881 for ; Mon, 15 Jan 2018 13:00:12 +0000 (UTC) Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 3CF875D81DBE for ; Mon, 15 Jan 2018 16:00:11 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id kq7T4BDwyF-0Bvmp5UP; Mon, 15 Jan 2018 16:00:11 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Bnqb3pkuSH-0A1mYuw0; Mon, 15 Jan 2018 16:00:10 +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, 15 Jan 2018 16:00:04 +0300 Message-Id: <1516021209-8997-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516021209-8997-1-git-send-email-odpbot@yandex.ru> References: <1516021209-8997-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 388 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 388 (psavol:next-user-ptr-init) ** https://github.com/Linaro/odp/pull/388 ** Patch: https://github.com/Linaro/odp/pull/388.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 76bd874ba5677533132a4c0a39c8e5cf9049a9af **/ 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 83a880947..2a977f064 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,