This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, api-next has been updated via cc97d3ae6d6d4c07ec77e7b33e2529154fb0ed24 (commit) via 94cb17b703f1efba6a89207b893d9f4ef5297d8d (commit) via c04eff910a7b18f47365f90fadb6133474e9cae5 (commit) from 201a96f9bbcbabd904362ba05a179c72689a578e (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit cc97d3ae6d6d4c07ec77e7b33e2529154fb0ed24 Author: Petri Savolainen petri.savolainen@linaro.org Date: Wed Oct 25 13:35:32 2017 +0300
validation: packet: add packet_print_data test
Test the new packet payload print function with couple of lengths and offsets. Added line feeds to separate packet print output from CUnit prints.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Ilias Apalodimas ilias.apalodimas@linaro.org Reviewed-by: Balasubramanian Manoharan bala.manoharan@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 431444cf..37550a2f 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -554,7 +554,10 @@ void packet_test_prefetch(void) void packet_test_debug(void) { CU_ASSERT(odp_packet_is_valid(test_packet) == 1); + printf("\n\n"); odp_packet_print(test_packet); + odp_packet_print_data(test_packet, 0, 100); + odp_packet_print_data(test_packet, 14, 20); }
void packet_test_context(void) @@ -2152,7 +2155,10 @@ void packet_test_ref(void) packet_compare_data(pkt3, ref2);
/* Try print function on a reference */ + printf("\n\n"); odp_packet_print(ref2); + odp_packet_print_data(ref2, 0, 100); + odp_packet_print_data(ref2, 14, 20);
odp_packet_free(ref); odp_packet_free(ref2);
commit 94cb17b703f1efba6a89207b893d9f4ef5297d8d Author: Petri Savolainen petri.savolainen@linaro.org Date: Wed Oct 25 13:29:55 2017 +0300
linux-gen: packet: implement odp_packet_data_print
Implemented the new packet payload print function using ODP_PRINT macro. Removed an extra space from the print macro as well as extra null char and line feed from odp_packet_print.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Ilias Apalodimas ilias.apalodimas@linaro.org Reviewed-by: Balasubramanian Manoharan bala.manoharan@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h index 02ae87a9..4c44bebe 100644 --- a/platform/linux-generic/include/odp_debug_internal.h +++ b/platform/linux-generic/include/odp_debug_internal.h @@ -81,7 +81,7 @@ extern "C" { * specifically for dumping internal data. */ #define ODP_PRINT(fmt, ...) \ - odp_global_data.log_fn(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) + odp_global_data.log_fn(ODP_LOG_PRINT, fmt, ##__VA_ARGS__)
#ifdef __cplusplus } diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 603ac718..67f103b3 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -1739,9 +1739,68 @@ void odp_packet_print(odp_packet_t pkt) seg = odp_packet_next_seg(pkt, seg); }
- str[len] = '\0'; + ODP_PRINT("%s\n", str); +} + +void odp_packet_print_data(odp_packet_t pkt, uint32_t offset, + uint32_t byte_len) +{ + odp_packet_hdr_t *hdr = packet_hdr(pkt); + uint32_t bytes_per_row = 16; + int num_rows = (byte_len + bytes_per_row - 1) / bytes_per_row; + int max_len = 256 + (3 * byte_len) + (3 * num_rows); + char str[max_len]; + int len = 0; + int n = max_len - 1; + uint32_t data_len = odp_packet_len(pkt); + pool_t *pool = hdr->buf_hdr.pool_ptr; + + len += snprintf(&str[len], n - len, "Packet\n------\n"); + len += snprintf(&str[len], n - len, + " pool index %" PRIu32 "\n", pool->pool_idx); + len += snprintf(&str[len], n - len, + " buf index %" PRIu32 "\n", hdr->buf_hdr.index); + len += snprintf(&str[len], n - len, + " segcount %" PRIu16 "\n", hdr->buf_hdr.segcount); + len += snprintf(&str[len], n - len, + " data len %" PRIu32 "\n", data_len); + len += snprintf(&str[len], n - len, + " data ptr %p\n", odp_packet_data(pkt)); + len += snprintf(&str[len], n - len, + " print offset %" PRIu32 "\n", offset); + len += snprintf(&str[len], n - len, + " print length %" PRIu32 "\n", byte_len); + + if (offset + byte_len > data_len) { + len += snprintf(&str[len], n - len, " BAD OFFSET OR LEN\n"); + ODP_PRINT("%s\n", str); + return; + } + + while (byte_len) { + uint32_t copy_len; + uint8_t data[bytes_per_row]; + uint32_t i; + + if (byte_len > bytes_per_row) + copy_len = bytes_per_row; + else + copy_len = byte_len; + + odp_packet_copy_to_mem(pkt, offset, copy_len, data); + + len += snprintf(&str[len], n - len, " "); + + for (i = 0; i < copy_len; i++) + len += snprintf(&str[len], n - len, " %02x", data[i]); + + len += snprintf(&str[len], n - len, "\n"); + + byte_len -= copy_len; + offset += copy_len; + }
- ODP_PRINT("\n%s\n", str); + ODP_PRINT("%s\n", str); }
int odp_packet_is_valid(odp_packet_t pkt)
commit c04eff910a7b18f47365f90fadb6133474e9cae5 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Oct 24 14:32:01 2017 +0300
api: packet: print packet data
Added debug print function which includes packet payload bytes. Printing starts from offset, so it's easy to e.g. limit print to IPv4 header bytes only: odp_packet_print_data(pkt, l3_offset(pkt), 20)
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Ilias Apalodimas ilias.apalodimas@linaro.org Reviewed-by: Balasubramanian Manoharan bala.manoharan@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 62ecf70e..3fc46064 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1561,14 +1561,27 @@ void odp_packet_shaper_len_adjust_set(odp_packet_t pkt, int8_t adj); */
/** - * Print packet to the console + * Print packet debug information * - * Print all packet debug information to the console. + * Print all packet debug information to the ODP log. * * @param pkt Packet handle */ void odp_packet_print(odp_packet_t pkt);
+/** + * Print packet data + * + * Print packet debug information with packet data to the ODP log. Operation + * prints 'len' bytes of packet data starting from 'offset' byte. Offset plus + * length must not exceed packet length (odp_packet_len()). + * + * @param pkt Packet handle + * @param offset Byte offset into the packet + * @param len Number of bytes to print + */ +void odp_packet_print_data(odp_packet_t pkt, uint32_t offset, uint32_t len); + /** * Perform full packet validity check *
-----------------------------------------------------------------------
Summary of changes: include/odp/api/spec/packet.h | 17 +++++- .../linux-generic/include/odp_debug_internal.h | 2 +- platform/linux-generic/odp_packet.c | 63 +++++++++++++++++++++- test/validation/api/packet/packet.c | 6 +++ 4 files changed, 83 insertions(+), 5 deletions(-)
hooks/post-receive