Skip to content

Commit

Permalink
linux-gen: packet: enhance segment prints
Browse files Browse the repository at this point in the history
Print segment addresses and reference counts in addition to
segment lengths.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
  • Loading branch information
Petri Savolainen authored and muvarov committed Sep 14, 2017
1 parent ef4e4d4 commit 6efe7d9
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions platform/linux-generic/odp_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1579,11 +1579,13 @@ int _odp_packet_cmp_data(odp_packet_t pkt, uint32_t offset,
* ********************************************************
*
*/

void odp_packet_print(odp_packet_t pkt)
{
odp_packet_seg_t seg;
int max_len = 512;
seg_entry_t *seg_entry;
odp_packet_hdr_t *seg_hdr;
uint8_t idx;
int max_len = 1024;
char str[max_len];
int len = 0;
int n = max_len - 1;
Expand Down Expand Up @@ -1619,12 +1621,22 @@ void odp_packet_print(odp_packet_t pkt)
len += snprintf(&str[len], n - len,
" num_segs %i\n", odp_packet_num_segs(pkt));

seg_hdr = hdr;
idx = 0;
seg = odp_packet_first_seg(pkt);

while (seg != ODP_PACKET_SEG_INVALID) {
odp_buffer_hdr_t *buf_hdr;

seg_entry = seg_entry_next(&seg_hdr, &idx);
buf_hdr = seg_entry->hdr;

len += snprintf(&str[len], n - len,
" seg_len %" PRIu32 "\n",
odp_packet_seg_data_len(pkt, seg));
" seg_len %-4" PRIu32 " seg_data %p ",
odp_packet_seg_data_len(pkt, seg),
odp_packet_seg_data(pkt, seg));
len += snprintf(&str[len], n - len, "ref_cnt %u\n",
buffer_ref(buf_hdr));

seg = odp_packet_next_seg(pkt, seg);
}
Expand Down

0 comments on commit 6efe7d9

Please sign in to comment.