diff mbox series

[API-NEXT,v4,1/6] linux-gen: packet: single user ptr field

Message ID 1516698014-28886-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v4,1/6] linux-gen: packet: single user ptr field | expand

Commit Message

Github ODP bot Jan. 23, 2018, 9 a.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Remove unnecessary union of user context u64/pointer. Rename
the field for better code readability.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** 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 mbox series

Patch

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,