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 <[email protected]> --- include/odp/api/packet.h | 30 ++++-------------------------- platform/linux-generic/odp_packet.c | 10 ---------- test/validation/odp_packet.c | 15 +-------------- 3 files changed, 5 insertions(+), 50 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 04a24f3..fb27ae4 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_user_area(odp_packet_t pkt) { return odp_packet_hdr(pkt)->buf_hdr.uarea_addr; diff --git a/test/validation/odp_packet.c b/test/validation/odp_packet.c index 77e0409..a363438 100644 --- a/test/validation/odp_packet.c +++ b/test/validation/odp_packet.c @@ -184,22 +184,14 @@ static void packet_context(void) { odp_packet_t pkt = test_packet; char ptr_test_value = 2; - uint64_t u64_test_value = 0x0123456789abcdf; - struct udata_struct *udat; - void *prev_ptr; - uint64_t prev_u64; + struct udata_struct *udat; 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); - udat = odp_packet_user_area(pkt); CU_ASSERT(udat != NULL); CU_ASSERT(odp_packet_user_area_size(pkt) == @@ -509,7 +501,6 @@ 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; struct udata_struct *udat, *new_udat; pkt = odp_packet_alloc(packet_pool, PACKET_BUF_LEN); @@ -517,7 +508,6 @@ static void packet_add_rem_data(void) pkt_len = odp_packet_len(pkt); usr_ptr = odp_packet_user_ptr(pkt); - usr_u64 = odp_packet_user_u64(pkt); udat = odp_packet_user_area(pkt); CU_ASSERT(odp_packet_user_area_size(pkt) == sizeof(struct udata_struct)); @@ -534,7 +524,6 @@ 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); /* Verify that user metadata has been preserved */ new_udat = odp_packet_user_area(new_pkt); @@ -548,14 +537,12 @@ static void packet_add_rem_data(void) 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); /* Verify that user metadata has been preserved */ new_udat = odp_packet_user_area(new_pkt); -- 2.4.0 _______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
