From patchwork Thu Oct 16 17:39:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 38833 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B82FD20973 for ; Thu, 16 Oct 2014 17:39:50 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id hi2sf34367wib.1 for ; Thu, 16 Oct 2014 10:39:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=Pubwx0bdQI0ulUuUT1zN/ZuwHNX1SPHOiejGOZAYEag=; b=cWLr/XJHO4pJplkmdT5csDownRVvVES5ogTKfYyw7Wfh3TWm6pbinops9sTdf7p4ga pFW2iP4R+ibJH/NYtOrYgEXhw9jHt+2aCR2o39Yo2xd1IpWDCSgNiuWr584CDvWJTH41 lAupeSS+kyXIshRX/S3TJ8ARh5TwdXcs8zhfcuoGzIDePF1oluYyr8WUSpJd4j6gcMuy WWWgRthL8QMsKOQumFKbTwHFk/q5oPymppeETfQYVJrAqlrkooW5wzIn/wnY8FUhjS9+ j0clzlrhCSKdr8qWNFez0pim6n2dBbagyWCC0TvhWlPTGEt7jHqO62JQ+xJezUKSfJOD 3a0w== X-Gm-Message-State: ALoCoQkJVt3wLjDliJ9ic2gGWTWTcfcF14y5dEI2OAaR8CcyvMTtXT/S/yRPQAKoNCQMV+d+osSc X-Received: by 10.180.186.142 with SMTP id fk14mr3647123wic.4.1413481188831; Thu, 16 Oct 2014 10:39:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.195 with SMTP id g3ls190834lam.59.gmail; Thu, 16 Oct 2014 10:39:48 -0700 (PDT) X-Received: by 10.112.125.33 with SMTP id mn1mr1030943lbb.99.1413481188625; Thu, 16 Oct 2014 10:39:48 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com [209.85.215.47]) by mx.google.com with ESMTPS id lv8si35828992lac.74.2014.10.16.10.39.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 Oct 2014 10:39:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id pv20so3271458lab.20 for ; Thu, 16 Oct 2014 10:39:48 -0700 (PDT) X-Received: by 10.112.221.197 with SMTP id qg5mr3293937lbc.32.1413481188426; Thu, 16 Oct 2014 10:39:48 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp85910lbz; Thu, 16 Oct 2014 10:39:46 -0700 (PDT) X-Received: by 10.140.92.37 with SMTP id a34mr2621040qge.103.1413481186041; Thu, 16 Oct 2014 10:39:46 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id l30si30980120qge.70.2014.10.16.10.39.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 16 Oct 2014 10:39:46 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xep1c-0000F0-1J; Thu, 16 Oct 2014 17:39:44 +0000 Received: from mail-qa0-f46.google.com ([209.85.216.46]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xep1U-0000EF-Qw for lng-odp@lists.linaro.org; Thu, 16 Oct 2014 17:39:36 +0000 Received: by mail-qa0-f46.google.com with SMTP id w8so2692683qac.19 for ; Thu, 16 Oct 2014 10:39:31 -0700 (PDT) X-Received: by 10.224.130.198 with SMTP id u6mr4142787qas.99.1413481171468; Thu, 16 Oct 2014 10:39:31 -0700 (PDT) Received: from fedora1.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id j2sm15090976qab.39.2014.10.16.10.39.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Oct 2014 10:39:30 -0700 (PDT) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Thu, 16 Oct 2014 13:39:24 -0400 Message-Id: <1413481164-46378-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCH] odp_init.h: Add odp_term_ local/global X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mike.holmes@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 --- 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 }