diff mbox series

[API-NEXT,v1,4/6] api: packet: initialize user ptr to NULL

Message ID 1516100408-8246-5-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [API-NEXT,v1,1/6] linux-gen: packet: single user ptr field | expand

Commit Message

Github ODP bot Jan. 16, 2018, 11 a.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Require that implementation initializes the pointer value
to NULL. Application can use the pointer more robustly when
it can tell if the pointer has been set previously or not.

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

---
/** Email created from pull request 392 (psavol:next-user-ptr-init-rebase)
 ** https://github.com/Linaro/odp/pull/392
 ** Patch: https://github.com/Linaro/odp/pull/392.patch
 ** Base sha: f6dab2bfa90ef5d3146cb76f86bc8782666f0f3e
 ** Merge commit sha: 7244f46bcf5e4a0fce4048e306f224f31e9a4d2f
 **/
 include/odp/api/spec/packet.h | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 3655f5899..8aca552f6 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -1341,7 +1341,10 @@  int odp_packet_input_index(odp_packet_t pkt);
 /**
  * User context pointer
  *
- * Return previously stored user context pointer.
+ * Return previously stored user context pointer. If not otherwise documented,
+ * the pointer value is maintained over packet manipulating operations.
+ * Implementation initializes the pointer value to NULL during new packet
+ * creation (e.g. alloc and packet input) and reset.
  *
  * @param pkt  Packet handle
  *
@@ -1357,10 +1360,10 @@  void *odp_packet_user_ptr(odp_packet_t pkt);
  * value of type intptr_t. ODP may use the pointer for data prefetching, but
  * must ignore any invalid addresses.
  *
- * @param pkt  Packet handle
- * @param ctx  User context pointer
+ * @param pkt       Packet handle
+ * @param user_ptr  User context pointer
  */
-void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx);
+void odp_packet_user_ptr_set(odp_packet_t pkt, const void *user_ptr);
 
 /**
  * User area address