diff mbox series

[API-NEXT,v1,1/3] api: packet: print packet data

Message ID 1508932806-2089-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v1,1/3] api: packet: print packet data | expand

Commit Message

Github ODP bot Oct. 25, 2017, noon UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


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>

---
/** Email created from pull request 258 (psavol:next-packet-dump)
 ** https://github.com/Linaro/odp/pull/258
 ** Patch: https://github.com/Linaro/odp/pull/258.patch
 ** Base sha: 63d92eb289261d1534b5b9e1e04291faa5e45d30
 ** Merge commit sha: 08d635e94f01265704fddd47cd98b0ccbdc669d4
 **/
 include/odp/api/spec/packet.h | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 62ecf70e1..3fc460641 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -1561,15 +1561,28 @@  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
  *
  * The operation may consume considerable number of cpu cycles depending on