Skip to content

Commit

Permalink
helper: clarify that ODP must be initialized before calling helper fu…
Browse files Browse the repository at this point in the history
…nctions

Explicitly state that ODP must be initialized before calling helper
functions. Document exceptions to this rule individually.

This has been the intended interpretation of the helper API all along,
so this is only a clarification, not an API change.

Signed-off-by: Jere Leppänen <[email protected]>
  • Loading branch information
JereLeppanen committed Dec 4, 2024
1 parent 7de9ac6 commit e543a75
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/helper-guide/odp.dox
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
*
* @image html overview.svg
*
* ODP must be initialized before calling helper functions, unless stated
* otherwise. Pre-processor macros may be invoked independently of ODP
* initialization.
*
* @section contact Contact Details
* - The main web site is http://www.opendataplane.org/
* - The git repo is https://github.com/OpenDataPlane/odp.git
Expand Down
2 changes: 2 additions & 0 deletions helper/include/odp/helper/eth.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ ODP_STATIC_ASSERT(sizeof(odph_vlanhdr_t) == ODPH_VLANHDR_LEN,
* and may have leading zeros. String does not have to be NULL terminated.
* The address is written only when successful.
*
* This function may be called before ODP initialization.
*
* @param[out] mac Pointer to Ethernet address for output
* @param str MAC address string to be parsed
*
Expand Down
2 changes: 2 additions & 0 deletions helper/include/odp/helper/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ typedef struct ODP_PACKED {
* NULL terminated. The address is written only when successful. The address
* byte order is CPU native.
*
* This function may be called before ODP initialization.
*
* @param[out] ip_addr Pointer to IPv4 address for output (in native endian)
* @param str IPv4 address string to be parsed
*
Expand Down
3 changes: 3 additions & 0 deletions helper/include/odp/helper/odph_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*
* The OpenDataPlane helper API
*
* ODP must be initialized before calling helper functions, unless stated
* otherwise. Pre-processor macros may be invoked independently of ODP
* initialization.
*/

#ifndef ODP_HELPER_H_
Expand Down
2 changes: 2 additions & 0 deletions helper/include/odp/helper/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ extern "C" {
* terminated, unless sz is zero in which case returns dst without doing
* anything else.
*
* This function may be called before ODP initialization.
*
* @param[out] dst Pointer to destination string.
* @param src Pointer to source string.
* @param sz Destination size.
Expand Down
4 changes: 4 additions & 0 deletions helper/include/odp/helper/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ int odph_odpthread_getaffinity(void);
* pthreads are used instead.
* </table>
*
* This function may be called before ODP initialization.
*
* @param argc Argument count
* @param argv Argument vector
*
Expand All @@ -361,6 +363,8 @@ int odph_parse_options(int argc, char *argv[]);
* Return used ODP helper options. odph_parse_options() must be called before
* using this function.
*
* This function may be called before ODP initialization.
*
* @param[out] options ODP helper options
*
* @return 0 on success, -1 on failure
Expand Down
2 changes: 2 additions & 0 deletions helper/include/odp/helper/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ extern "C" {
*
* The string is null terminated.
*
* This function may be called before ODP initialization.
*
* @return Pointer to helper library version string
*/
const char *odph_version_str(void);
Expand Down

0 comments on commit e543a75

Please sign in to comment.