Simplified the API by removing user_u64 option. User has now room for a pointer (or upto intptr_t sized variable) and a configurable sized user_area. Both can be used at the same time. User has to use the user_area when more space than sizeof(intptr_t) bytes is needed.
Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com> --- include/odp/api/packet.h | 30 ++++-------------------------- platform/linux-generic/odp_packet.c | 10 ---------- test/validation/odp_packet.c | 13 ------------- 3 files changed, 4 insertions(+), 49 deletions(-) diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h index cbd06d5..91a124a 100644 --- a/include/odp/api/packet.h +++ b/include/odp/api/packet.h @@ -434,9 +434,10 @@ void *odp_packet_user_ptr(odp_packet_t pkt); /** * Set user context pointer * - * Each packet has room for a user defined context. The context can be stored - * either as a pointer OR as a uint64_t value, but not both at the same time. - * The latest context set operation determines which one has been stored. + * Each packet has room for a user defined context pointer. The pointer value + * does not necessarily represent a valid address - e.g. user may store any + * value of type intptr_t. ODP may use the pointer for data prefetching, but + * must ignore any invalid addresses. * * @param pkt Packet handle * @param ctx User context pointer @@ -444,29 +445,6 @@ void *odp_packet_user_ptr(odp_packet_t pkt); void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx); /** - * User context data (uint64_t) - * - * Return previously stored user context uint64_t value. - * - * @param pkt Packet handle - * - * @return User context data - */ -uint64_t odp_packet_user_u64(odp_packet_t pkt); - -/** - * Set user context data (uint64_t) - * - * Each packet has room for a user defined context. The context can be stored - * either as a pointer OR as a uint64_t value, but not both at the same time. - * The latest context set operation determines which one has been stored. - * - * @param pkt Packet handle - * @param ctx User context data - */ -void odp_packet_user_u64_set(odp_packet_t pkt, uint64_t ctx); - -/** * User area address * * Each packet has an area for user data. Size of the area is fixed and defined diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index c5a3f7d..e05a402 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -229,16 +229,6 @@ void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx) odp_packet_hdr(pkt)->buf_hdr.buf_cctx = ctx; } -uint64_t odp_packet_user_u64(odp_packet_t pkt) -{ - return odp_packet_hdr(pkt)->buf_hdr.buf_u64; -} - -void odp_packet_user_u64_set(odp_packet_t pkt, uint64_t ctx) -{ - odp_packet_hdr(pkt)->buf_hdr.buf_u64 = ctx; -} - void *odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len) { odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); diff --git a/test/validation/odp_packet.c b/test/validation/odp_packet.c index 0c1d069..5894b1d 100644 --- a/test/validation/odp_packet.c +++ b/test/validation/odp_packet.c @@ -161,21 +161,13 @@ static void packet_context(void) { odp_packet_t pkt = test_packet; char ptr_test_value = 2; - uint64_t u64_test_value = 0x0123456789abcdf; - void *prev_ptr; - uint64_t prev_u64; prev_ptr = odp_packet_user_ptr(pkt); odp_packet_user_ptr_set(pkt, &ptr_test_value); CU_ASSERT(odp_packet_user_ptr(pkt) == &ptr_test_value); odp_packet_user_ptr_set(pkt, prev_ptr); - prev_u64 = odp_packet_user_u64(pkt); - odp_packet_user_u64_set(pkt, u64_test_value); - CU_ASSERT(odp_packet_user_u64(pkt) == u64_test_value); - odp_packet_user_u64_set(pkt, prev_u64); - odp_packet_reset(pkt, packet_len); } @@ -478,14 +470,12 @@ static void packet_add_rem_data(void) odp_packet_t pkt, new_pkt; uint32_t pkt_len, offset, add_len; void *usr_ptr; - uint64_t usr_u64; pkt = odp_packet_alloc(packet_pool, PACKET_BUF_LEN); CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); pkt_len = odp_packet_len(pkt); usr_ptr = odp_packet_user_ptr(pkt); - usr_u64 = odp_packet_user_u64(pkt); /* Insert one more packet length in the middle of a packet */ offset = pkt_len / 2; add_len = pkt_len; @@ -497,20 +487,17 @@ static void packet_add_rem_data(void) CU_ASSERT(odp_packet_len(new_pkt) == pkt_len + add_len); /* Verify that user metadata is preserved */ CU_ASSERT(odp_packet_user_ptr(new_pkt) == usr_ptr); - CU_ASSERT(odp_packet_user_u64(new_pkt) == usr_u64); pkt = new_pkt; pkt_len = odp_packet_len(pkt); usr_ptr = odp_packet_user_ptr(pkt); - usr_u64 = odp_packet_user_u64(pkt); new_pkt = odp_packet_rem_data(pkt, offset, add_len); CU_ASSERT(new_pkt != ODP_PACKET_INVALID); if (new_pkt == ODP_PACKET_INVALID) goto free_packet; CU_ASSERT(odp_packet_len(new_pkt) == pkt_len - add_len); CU_ASSERT(odp_packet_user_ptr(new_pkt) == usr_ptr); - CU_ASSERT(odp_packet_user_u64(new_pkt) == usr_u64); pkt = new_pkt; free_packet: -- 2.3.5 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp