Removed buffer to packet conversion. Signed-off-by: Petri Savolainen <petri.savolai...@linaro.org> --- platform/linux-generic/include/api/odp_packet.h | 9 --------- platform/linux-generic/include/odp_packet_internal.h | 11 ++++------- platform/linux-generic/odp_packet.c | 2 +- platform/linux-generic/odp_packet_io.c | 4 ++-- test/validation/crypto/odp_crypto_test_async_inp.c | 10 +++++----- test/validation/crypto/odp_crypto_test_sync_inp.c | 6 ++---- 6 files changed, 14 insertions(+), 28 deletions(-)
diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h index c67fd62..03f2b18 100644 --- a/platform/linux-generic/include/api/odp_packet.h +++ b/platform/linux-generic/include/api/odp_packet.h @@ -96,15 +96,6 @@ void odp_packet_free(odp_packet_t pkt); int odp_packet_reset(odp_packet_t pkt, uint32_t len); /** - * Convert a buffer handle to a packet handle - * - * @param buf Buffer handle - * - * @return Packet handle - */ -odp_packet_t odp_packet_from_buffer(odp_buffer_t buf); - -/** * Get packet handle from event * * Converts an ODP_EVENT_PACKET type event to a packet. diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index fe4a223..33c9d92 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -257,15 +257,12 @@ odp_packet_t _odp_packet_alloc(odp_buffer_pool_t pool_hdl); int _odp_packet_parse(odp_packet_t pkt); -/* - * Convert a packet handle to a buffer handle - * - * @param pkt Packet handle - * - * @return Buffer handle - */ +/* Convert a packet handle to a buffer handle */ odp_buffer_t _odp_packet_to_buffer(odp_packet_t pkt); +/* Convert a buffer handle to a packet handle */ +odp_packet_t _odp_packet_from_buffer(odp_buffer_t buf); + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index bcbac79..3ce6f47 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -65,7 +65,7 @@ int odp_packet_reset(odp_packet_t pkt, uint32_t len) return 0; } -odp_packet_t odp_packet_from_buffer(odp_buffer_t buf) +odp_packet_t _odp_packet_from_buffer(odp_buffer_t buf) { return (odp_packet_t)buf; } diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 7f5a95d..abbc9f6 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -454,7 +454,7 @@ odp_queue_t odp_pktio_outq_getdef(odp_pktio_t id) int pktout_enqueue(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr) { - odp_packet_t pkt = odp_packet_from_buffer(buf_hdr->handle.handle); + odp_packet_t pkt = _odp_packet_from_buffer(buf_hdr->handle.handle); int len = 1; int nbr; @@ -476,7 +476,7 @@ int pktout_enq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[], int i; for (i = 0; i < num; ++i) - pkt_tbl[i] = odp_packet_from_buffer(buf_hdr[i]->handle.handle); + pkt_tbl[i] = _odp_packet_from_buffer(buf_hdr[i]->handle.handle); nbr = odp_pktio_send(qentry->s.pktout, pkt_tbl, num); return (nbr == num ? 0 : -1); diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c b/test/validation/crypto/odp_crypto_test_async_inp.c index 01e4d7d..e771b2c 100644 --- a/test/validation/crypto/odp_crypto_test_async_inp.c +++ b/test/validation/crypto/odp_crypto_test_async_inp.c @@ -61,9 +61,7 @@ static void alg_test(enum odp_crypto_op op, CU_ASSERT(status == ODP_CRYPTO_SES_CREATE_ERR_NONE); /* Prepare input data */ - odp_buffer_t buf = odp_buffer_alloc(pool); - CU_ASSERT(buf != ODP_BUFFER_INVALID); - odp_packet_t pkt = odp_packet_from_buffer(buf); + odp_packet_t pkt = odp_packet_alloc(pool, input_vec_len); CU_ASSERT(pkt != ODP_PACKET_INVALID); uint8_t *data_addr = odp_packet_data(pkt); memcpy(data_addr, input_vec, input_vec_len); @@ -91,6 +89,8 @@ static void alg_test(enum odp_crypto_op op, } if (compl_new == ODP_BUFFER_INVALID) { + /* hack: buf is removed after crypto API update tp events */ + odp_buffer_t buf = odp_buffer_from_event(odp_packet_to_event(pkt)); odp_crypto_set_operation_compl_ctx(buf, (void *)0xdeadbeef); rc = odp_crypto_operation(&op_params, &posted, buf); } else { @@ -106,7 +106,7 @@ static void alg_test(enum odp_crypto_op op, } while (compl_event == ODP_EVENT_INVALID); if (compl_new == ODP_BUFFER_INVALID) - CU_ASSERT(odp_buffer_from_event(compl_event) == buf) + CU_ASSERT(compl_event == odp_packet_to_event(pkt)) else CU_ASSERT(odp_buffer_from_event(compl_event) == compl_new) @@ -127,7 +127,7 @@ static void alg_test(enum odp_crypto_op op, void *ctx = odp_crypto_get_operation_compl_ctx(odp_buffer_from_event(compl_event)); CU_ASSERT(ctx == (void *)0xdeadbeef); - odp_buffer_free(buf); + odp_packet_free(pkt); } /* This test verifies the correctness of encode (plaintext -> ciphertext) diff --git a/test/validation/crypto/odp_crypto_test_sync_inp.c b/test/validation/crypto/odp_crypto_test_sync_inp.c index f37ad54..c527b90 100644 --- a/test/validation/crypto/odp_crypto_test_sync_inp.c +++ b/test/validation/crypto/odp_crypto_test_sync_inp.c @@ -50,9 +50,7 @@ static void alg_test(enum odp_crypto_op op, CU_ASSERT(status == ODP_CRYPTO_SES_CREATE_ERR_NONE); /* Prepare input data */ - odp_buffer_t buf = odp_buffer_alloc(pool); - CU_ASSERT(buf != ODP_BUFFER_INVALID); - odp_packet_t pkt = odp_packet_from_buffer(buf); + odp_packet_t pkt = odp_packet_alloc(pool, input_vec_len); CU_ASSERT(pkt != ODP_PACKET_INVALID); uint8_t *data_addr = odp_packet_data(pkt); memcpy(data_addr, input_vec, input_vec_len); @@ -80,7 +78,7 @@ static void alg_test(enum odp_crypto_op op, } /* TEST : odp_crypto_operation */ - rc = odp_crypto_operation(&op_params, &posted, buf); + rc = odp_crypto_operation(&op_params, &posted, odp_buffer_from_event(odp_packet_to_event(pkt))); CU_ASSERT(!rc); /* indication that the operation completed */ CU_ASSERT(!posted); -- 2.2.2 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp