diff mbox series

[API-NEXT,v1,15/19] linux-gen: packet: enhance segment prints

Message ID 1505422809-5632-16-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v1,1/19] travis: fix powerpc test name | expand

Commit Message

Github ODP bot Sept. 14, 2017, 9 p.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


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>

---
/** Email created from pull request 179 (muvarov:api-next)
 ** https://github.com/Linaro/odp/pull/179
 ** Patch: https://github.com/Linaro/odp/pull/179.patch
 ** Base sha: 6b6253c30f88c80bf632436ff06c1b000860a2f1
 ** Merge commit sha: ada61f5ba5f940d03a95893940c21028d4c75d19
 **/
 platform/linux-generic/odp_packet.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 1a21ab0c6..5990f878d 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -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;
@@ -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);
 	}