diff mbox series

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

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

Commit Message

Github ODP bot Jan. 16, 2018, 11 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: 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 mbox series

Patch

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,