From patchwork Tue Jan 23 09:00:09 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: 125485 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1633257ljf; Tue, 23 Jan 2018 01:04:20 -0800 (PST) X-Google-Smtp-Source: AH8x225mav9yGhusDQVFlWVjxzUM0XnqGGKD5UVGjGgbzGJvEQSlww9srQTDmryTmhQg2A/kkkXA X-Received: by 10.237.61.66 with SMTP id h2mr2596714qtf.268.1516698260070; Tue, 23 Jan 2018 01:04:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516698260; cv=none; d=google.com; s=arc-20160816; b=a4UsJlRBqKX6Pu+tYdbb8FZbguRXmFt3tlRpFXmQwoNYQF3ICM4vwhovaPoEuXPUJV 7u04PZOJXAJ86taWa9LVXBSs5ASLmnbbqc/euxe33GhLzFVf2KYfiBPiNU4osf3HfPBL W5tBDiRIi5QowwJIB0vnUpYQkpZO2HAHWL3dKtU8iGFfRBwEWDd4a1FVZDUWjJma7fBy AwUipDdsCSNJQsURM6oF1471uTjTY41QzpFlLIiEgCSgkvF/s1e+BEjTvFjMSebReAGU bS//1UZqSFDwM0pCR1xf/UQhz6rc+TNlnnM6G7q9upG5XhE8PTCiC0aA1mjjP8bO/b9L lM2A== 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=fL2qGBrIZJog3/CrujwOf8X884eU6lCDg+PAd1i5q34=; b=VWbsRa9X1rQZu9cLHSdYMRvxPQlMUH+JjjqZFeHYszr6Tm1w2sxkU4J78XEqgbNAlY YvIROQ/s7Mb/W6WHB29wCPHAOg2KukK4a9GWQdyeniYZRKngMNvV1+rCr4hivo0u+6yR 6+ZzfQkzy+fsP+rPLPcukv6eXRROmmL31g1SjpNf4xnwq5mE4AjN1FO1UNJaZhNkTo5C kF++LjRY7oDY18EmBWejyof2PgaYlOWd9tDSAUPsKb4STKFx/peH9GfdP3n7nDXOiUn0 elAYgOZPEK8xphbYW+Y4C3N3LRThI/X5Y80AII53qgAh7zlvud2DYJKdNr3okWwICXge sA0w== 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 v62si3127579qkd.376.2018.01.23.01.04.19; Tue, 23 Jan 2018 01:04:20 -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 B28ED61768; Tue, 23 Jan 2018 09:04:19 +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 D587961794; Tue, 23 Jan 2018 09:01:02 +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 2707B609A8; Tue, 23 Jan 2018 09:00:27 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id 3F7C960887 for ; Tue, 23 Jan 2018 09:00:18 +0000 (UTC) Received: from mxback6o.mail.yandex.net (mxback6o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::20]) by forward103p.mail.yandex.net (Yandex) with ESMTP id 77272218258E for ; Tue, 23 Jan 2018 12:00:16 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback6o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id P3SM1TX6EX-0G5K2q8g; Tue, 23 Jan 2018 12:00:16 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id VKzM4bguQ1-0FDmODVv; Tue, 23 Jan 2018 12:00:15 +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, 23 Jan 2018 12:00:09 +0300 Message-Id: <1516698014-28886-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> References: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 392 Subject: [lng-odp] [PATCH API-NEXT v4 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: 4508f410a04cf1657d607d24aa2530a42ef011f7 ** Merge commit sha: 3781732a78e4a3f0347b6b4299e9753da3929a42 **/ 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 2ac356785..735670479 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -36,7 +36,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), @@ -266,7 +266,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: @@ -1259,9 +1259,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) @@ -1932,7 +1932,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,