[API-NEXT,v1,2/4] api: packet: add combined packet data and seg len

Message ID 1519308009-12837-3-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • api: packet: data and segment length
Related show

Commit Message

Github ODP bot Feb. 22, 2018, 2 p.m.
From: Petri Savolainen <petri.savolainen@linaro.org>


Packet data pointer and segment length used often. Combine
two calls into one call. One call performs better in ABI
compatible mode than two calls.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 497 (psavol:next-packet-data-doc)
 ** https://github.com/Linaro/odp/pull/497
 ** Patch: https://github.com/Linaro/odp/pull/497.patch
 ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88
 ** Merge commit sha: d1c9a3d36dfe9e38ecfe7d4a52bebe13d0c01098
 **/
 include/odp/api/spec/packet.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Patch

diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 746f6fbf7..e1f2f2218 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -439,6 +439,22 @@  void *odp_packet_data(odp_packet_t pkt);
  */
 uint32_t odp_packet_seg_len(odp_packet_t pkt);
 
+/**
+ * Packet data pointer with segment length
+ *
+ * Returns both data pointer and number of data bytes (in the segment)
+ * following it. This is equivalent to calling odp_packet_data() and
+ * odp_packet_seg_len().
+ *
+ * @param      pkt      Packet handle
+ * @param[out] seg_len  Pointer to output segment length
+ *
+ * @return Pointer to the packet data
+ *
+ * @see odp_packet_data(), odp_packet_seg_len()
+ */
+void *odp_packet_data_seg_len(odp_packet_t pkt, uint32_t *seg_len);
+
 /**
  * Packet data length
  *