diff mbox

odp_init.h: Add odp_term_ local/global

Message ID 1413481164-46378-1-git-send-email-mike.holmes@linaro.org
State Accepted
Commit 558ad1788492a89c41497b19d38a656640a0cea9
Headers show

Commit Message

Mike Holmes Oct. 16, 2014, 5:39 p.m. UTC
Unit testing replicates a situation similar to an NFV case where the workload
is varied without rebooting the HW.
In this use case there have to be hooks for the application to inform the
implementation that HW needs to be released.

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 platform/linux-generic/include/api/odp_init.h | 68 +++++++++++++++++++++++++--
 1 file changed, 65 insertions(+), 3 deletions(-)

Comments

Mike Holmes Oct. 21, 2014, 3:27 p.m. UTC | #1
Ping

On 16 October 2014 13:39, Mike Holmes <mike.holmes@linaro.org> wrote:

> Unit testing replicates a situation similar to an NFV case where the
> workload
> is varied without rebooting the HW.
> In this use case there have to be hooks for the application to inform the
> implementation that HW needs to be released.
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>  platform/linux-generic/include/api/odp_init.h | 68
> +++++++++++++++++++++++++--
>  1 file changed, 65 insertions(+), 3 deletions(-)
>
> diff --git a/platform/linux-generic/include/api/odp_init.h
> b/platform/linux-generic/include/api/odp_init.h
> index fab4f6e..002b6a3 100644
> --- a/platform/linux-generic/include/api/odp_init.h
> +++ b/platform/linux-generic/include/api/odp_init.h
> @@ -8,7 +8,15 @@
>  /**
>   * @file
>   *
> - * ODP initialization
> + * ODP initialization.
> + * ODP requires a global level init for the process and a local init per
> + * thread before the other ODP APIs may be called.
> + * - odp_init_global()
> + * - odp_init_local()
> + *
> + * For a graceful termination the matching termination APIs exit
> + * - odp_term_global()
> + * - odp_term_local()
>   */
>
>  #ifndef ODP_INIT_H_
> @@ -48,24 +56,78 @@ typedef struct odp_platform_init_t {
>   *
>   * This function must be called once before calling any other ODP API
>   * functions.
> + *
> + * @sa odp_term_global()
> + * @sa odp_init_local() which is required per thread before use.
> + *
>   * @param[in] params Those parameters that are interpreted by the ODP API
>   * @param[in] platform_params Those parameters that are passed without
>   * interpretation by the ODP API to the implementation.
> - * @return 0 if successful
> + *
> + * @retval 0 if successful
> + * @retval 1 on failure
>   */
>  int odp_init_global(odp_init_t *params, odp_platform_init_t
> *platform_params);
>
>  /**
> + * Terminate ODP session.
> + *
> + * This function is the final ODP call made when terminating
> + * an ODP application in a controlled way. It cannot handle exceptional
> + * circumstances.
> + * In general it calls the API modules terminate functions in the reverse
> order
> + * to that which the module init functions were called during
> odp_init_global()
> + *
> + * @warning The unwinding of HW resources to allow them to be re used
> without reseting
> + * the device is a complex task that the application is expected to
> coordinate.
> + * This api may have  platform dependant implications.
> + *
> + * @sa odp_init_global()
> + * @sa odp_term_local() which must have been called prior to this.
> + *
> + * @retval 0 if successful
> + * @retval 1 on failure
> + */
> +int odp_term_global(void);
> +
> +/**
>   * Perform thread local ODP initialization.
>   *
>   * All threads must call this function before calling
>   * any other ODP API functions.
>   *
> - * @return 0 if successful
> + * @sa odp_term_local()
> + * @sa odp_init_global() which must have been called prior to this.
> + *
> + * @retval 0 if successful
> + * @retval 1 on failure
>   */
>  int odp_init_local(void);
>
>
> +/**
> + * Perform thread local ODP termination.
> + *
> + * This function is the second to final ODP call made when terminating
> + * an ODP application in a controlled way. It cannot handle exceptional
> + * circumstances.
> + * In general it calls the API modules per thread terminate functions in
> the
> + * reverse order to that which the module init functions were called
> during
> + * odp_init_local()
> + *
> + * @sa odp_init_local()
> + * @sa odp_term_global() which is the final ODP call before exit of an
> application.
> + *
> + * @warning The unwinding of HW resources to allow them to be re used
> without reseting
> + * the device is a complex task that the application is expected to
> coordinate.
> + * All threads must call this function before calling
> + * any other ODP API functions.
> + *
> + * @retval 0 if successful
> + * @retval 1 on failure
> + */
> +int odp_term_local(void);
> +
>
>  #ifdef __cplusplus
>  }
> --
> 1.9.1
>
>
Maxim Uvarov Oct. 21, 2014, 3:31 p.m. UTC | #2
Merged,

Maxim.

On 10/16/2014 09:39 PM, Mike Holmes wrote:
> Unit testing replicates a situation similar to an NFV case where the workload
> is varied without rebooting the HW.
> In this use case there have to be hooks for the application to inform the
> implementation that HW needs to be released.
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   platform/linux-generic/include/api/odp_init.h | 68 +++++++++++++++++++++++++--
>   1 file changed, 65 insertions(+), 3 deletions(-)
>
> diff --git a/platform/linux-generic/include/api/odp_init.h b/platform/linux-generic/include/api/odp_init.h
> index fab4f6e..002b6a3 100644
> --- a/platform/linux-generic/include/api/odp_init.h
> +++ b/platform/linux-generic/include/api/odp_init.h
> @@ -8,7 +8,15 @@
>   /**
>    * @file
>    *
> - * ODP initialization
> + * ODP initialization.
> + * ODP requires a global level init for the process and a local init per
> + * thread before the other ODP APIs may be called.
> + * - odp_init_global()
> + * - odp_init_local()
> + *
> + * For a graceful termination the matching termination APIs exit
> + * - odp_term_global()
> + * - odp_term_local()
>    */
>   
>   #ifndef ODP_INIT_H_
> @@ -48,24 +56,78 @@ typedef struct odp_platform_init_t {
>    *
>    * This function must be called once before calling any other ODP API
>    * functions.
> + *
> + * @sa odp_term_global()
> + * @sa odp_init_local() which is required per thread before use.
> + *
>    * @param[in] params Those parameters that are interpreted by the ODP API
>    * @param[in] platform_params Those parameters that are passed without
>    * interpretation by the ODP API to the implementation.
> - * @return 0 if successful
> + *
> + * @retval 0 if successful
> + * @retval 1 on failure
>    */
>   int odp_init_global(odp_init_t *params, odp_platform_init_t *platform_params);
>   
>   /**
> + * Terminate ODP session.
> + *
> + * This function is the final ODP call made when terminating
> + * an ODP application in a controlled way. It cannot handle exceptional
> + * circumstances.
> + * In general it calls the API modules terminate functions in the reverse order
> + * to that which the module init functions were called during odp_init_global()
> + *
> + * @warning The unwinding of HW resources to allow them to be re used without reseting
> + * the device is a complex task that the application is expected to coordinate.
> + * This api may have  platform dependant implications.
> + *
> + * @sa odp_init_global()
> + * @sa odp_term_local() which must have been called prior to this.
> + *
> + * @retval 0 if successful
> + * @retval 1 on failure
> + */
> +int odp_term_global(void);
> +
> +/**
>    * Perform thread local ODP initialization.
>    *
>    * All threads must call this function before calling
>    * any other ODP API functions.
>    *
> - * @return 0 if successful
> + * @sa odp_term_local()
> + * @sa odp_init_global() which must have been called prior to this.
> + *
> + * @retval 0 if successful
> + * @retval 1 on failure
>    */
>   int odp_init_local(void);
>   
>   
> +/**
> + * Perform thread local ODP termination.
> + *
> + * This function is the second to final ODP call made when terminating
> + * an ODP application in a controlled way. It cannot handle exceptional
> + * circumstances.
> + * In general it calls the API modules per thread terminate functions in the
> + * reverse order to that which the module init functions were called during
> + * odp_init_local()
> + *
> + * @sa odp_init_local()
> + * @sa odp_term_global() which is the final ODP call before exit of an application.
> + *
> + * @warning The unwinding of HW resources to allow them to be re used without reseting
> + * the device is a complex task that the application is expected to coordinate.
> + * All threads must call this function before calling
> + * any other ODP API functions.
> + *
> + * @retval 0 if successful
> + * @retval 1 on failure
> + */
> +int odp_term_local(void);
> +
>   
>   #ifdef __cplusplus
>   }
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_init.h b/platform/linux-generic/include/api/odp_init.h
index fab4f6e..002b6a3 100644
--- a/platform/linux-generic/include/api/odp_init.h
+++ b/platform/linux-generic/include/api/odp_init.h
@@ -8,7 +8,15 @@ 
 /**
  * @file
  *
- * ODP initialization
+ * ODP initialization.
+ * ODP requires a global level init for the process and a local init per
+ * thread before the other ODP APIs may be called.
+ * - odp_init_global()
+ * - odp_init_local()
+ *
+ * For a graceful termination the matching termination APIs exit
+ * - odp_term_global()
+ * - odp_term_local()
  */
 
 #ifndef ODP_INIT_H_
@@ -48,24 +56,78 @@  typedef struct odp_platform_init_t {
  *
  * This function must be called once before calling any other ODP API
  * functions.
+ *
+ * @sa odp_term_global()
+ * @sa odp_init_local() which is required per thread before use.
+ *
  * @param[in] params Those parameters that are interpreted by the ODP API
  * @param[in] platform_params Those parameters that are passed without
  * interpretation by the ODP API to the implementation.
- * @return 0 if successful
+ *
+ * @retval 0 if successful
+ * @retval 1 on failure
  */
 int odp_init_global(odp_init_t *params, odp_platform_init_t *platform_params);
 
 /**
+ * Terminate ODP session.
+ *
+ * This function is the final ODP call made when terminating
+ * an ODP application in a controlled way. It cannot handle exceptional
+ * circumstances.
+ * In general it calls the API modules terminate functions in the reverse order
+ * to that which the module init functions were called during odp_init_global()
+ *
+ * @warning The unwinding of HW resources to allow them to be re used without reseting
+ * the device is a complex task that the application is expected to coordinate.
+ * This api may have  platform dependant implications.
+ *
+ * @sa odp_init_global()
+ * @sa odp_term_local() which must have been called prior to this.
+ *
+ * @retval 0 if successful
+ * @retval 1 on failure
+ */
+int odp_term_global(void);
+
+/**
  * Perform thread local ODP initialization.
  *
  * All threads must call this function before calling
  * any other ODP API functions.
  *
- * @return 0 if successful
+ * @sa odp_term_local()
+ * @sa odp_init_global() which must have been called prior to this.
+ *
+ * @retval 0 if successful
+ * @retval 1 on failure
  */
 int odp_init_local(void);
 
 
+/**
+ * Perform thread local ODP termination.
+ *
+ * This function is the second to final ODP call made when terminating
+ * an ODP application in a controlled way. It cannot handle exceptional
+ * circumstances.
+ * In general it calls the API modules per thread terminate functions in the
+ * reverse order to that which the module init functions were called during
+ * odp_init_local()
+ *
+ * @sa odp_init_local()
+ * @sa odp_term_global() which is the final ODP call before exit of an application.
+ *
+ * @warning The unwinding of HW resources to allow them to be re used without reseting
+ * the device is a complex task that the application is expected to coordinate.
+ * All threads must call this function before calling
+ * any other ODP API functions.
+ *
+ * @retval 0 if successful
+ * @retval 1 on failure
+ */
+int odp_term_local(void);
+
 
 #ifdef __cplusplus
 }