From 4bf68c9eb76fb939cb30736c6d8108c38968411d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jere=20Lepp=C3=A4nen?= Date: Fri, 8 Nov 2024 17:03:42 +0200 Subject: [PATCH] helper: clarify that ODP must be initialized before calling helper functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- doc/helper-guide/odp.dox | 4 ++++ helper/include/odp/helper/eth.h | 2 ++ helper/include/odp/helper/ip.h | 2 ++ helper/include/odp/helper/string.h | 2 ++ helper/include/odp/helper/threads.h | 4 ++++ helper/include/odp/helper/version.h.in | 2 ++ 6 files changed, 16 insertions(+) diff --git a/doc/helper-guide/odp.dox b/doc/helper-guide/odp.dox index ae341918e7..9442860026 100644 --- a/doc/helper-guide/odp.dox +++ b/doc/helper-guide/odp.dox @@ -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 diff --git a/helper/include/odp/helper/eth.h b/helper/include/odp/helper/eth.h index 2a1f3f159b..3ae16edb85 100644 --- a/helper/include/odp/helper/eth.h +++ b/helper/include/odp/helper/eth.h @@ -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 * diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h index bbae401b24..be8e37d982 100644 --- a/helper/include/odp/helper/ip.h +++ b/helper/include/odp/helper/ip.h @@ -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 * diff --git a/helper/include/odp/helper/string.h b/helper/include/odp/helper/string.h index 25096f0fdb..c3dc8b6a15 100644 --- a/helper/include/odp/helper/string.h +++ b/helper/include/odp/helper/string.h @@ -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. diff --git a/helper/include/odp/helper/threads.h b/helper/include/odp/helper/threads.h index ca420e80a3..04eab27cf7 100644 --- a/helper/include/odp/helper/threads.h +++ b/helper/include/odp/helper/threads.h @@ -347,6 +347,8 @@ int odph_odpthread_getaffinity(void); * pthreads are used instead. * * + * This function may be called before ODP initialization. + * * @param argc Argument count * @param argv Argument vector * @@ -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 diff --git a/helper/include/odp/helper/version.h.in b/helper/include/odp/helper/version.h.in index e576de561e..19bc64203b 100644 --- a/helper/include/odp/helper/version.h.in +++ b/helper/include/odp/helper/version.h.in @@ -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);