From patchwork Sun Jan 25 10:50:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "yan.songming" X-Patchwork-Id: 43723 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 593B821BCE for ; Sun, 25 Jan 2015 10:50:30 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id n3sf2001015wiv.0 for ; Sun, 25 Jan 2015 02:50:29 -0800 (PST) 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:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=nYrREd5wcow9ws4F7TFZs838Z1U0JdXZrmZHE++xgg0=; b=NuCxmE3M1AABfF+jtMBE8bc+VAmo5pKuFu12VLD6sBHGI6gPj4Ac3pkZfBMqTRjEmU CZbUiJfpYRgtsbITLxmUgzTG+P2IPQLrG9f5ysarxKSNPfr/Lg8jWE89H239GWBOmpvb N7tEpU05grtMZfUTITcNyhoW+mQ7Ht6hEk9sH2rO8SQEQy/EHN8PYhQlDXaMQxCbhGV6 NCEZDySOu1ms9Y9fVZuiExnKFyinnaVpKtwV+oGoe913RZiH4eFJsJWCWGl5LNRmMG/x NCsaAH9lyRutdBdLk/JaAP7eBe/Hf2Ea9eMG+1/B4Sb635LeNUzOK2SAgWpi9yDNP7wK Pzxg== X-Gm-Message-State: ALoCoQkz03OkM42skfHwX9zUzQyGzNDu6pMDRXf3NgK/XTJlRPR5jQBcyBrmXBL6hTYAI+S16XYS X-Received: by 10.112.133.98 with SMTP id pb2mr1948421lbb.2.1422183029533; Sun, 25 Jan 2015 02:50:29 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.205 with SMTP id q13ls404788lal.85.gmail; Sun, 25 Jan 2015 02:50:29 -0800 (PST) X-Received: by 10.152.197.5 with SMTP id iq5mr16071335lac.6.1422183029245; Sun, 25 Jan 2015 02:50:29 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id uc2si6206165lac.80.2015.01.25.02.50.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 25 Jan 2015 02:50:29 -0800 (PST) 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 hz20so3790008lab.6 for ; Sun, 25 Jan 2015 02:50:29 -0800 (PST) X-Received: by 10.112.170.36 with SMTP id aj4mr15968173lbc.3.1422183029025; Sun, 25 Jan 2015 02:50:29 -0800 (PST) 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.35.133 with SMTP id h5csp462063lbj; Sun, 25 Jan 2015 02:50:28 -0800 (PST) X-Received: by 10.140.23.180 with SMTP id 49mr15437904qgp.84.1422183027711; Sun, 25 Jan 2015 02:50:27 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id d9si9185946qag.47.2015.01.25.02.50.24 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 25 Jan 2015 02:50:27 -0800 (PST) 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 1YFKlp-00065w-5O; Sun, 25 Jan 2015 10:50:21 +0000 Received: from mail-pa0-f48.google.com ([209.85.220.48]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YFKlj-000658-5T for lng-odp@lists.linaro.org; Sun, 25 Jan 2015 10:50:15 +0000 Received: by mail-pa0-f48.google.com with SMTP id ey11so6219374pad.7 for ; Sun, 25 Jan 2015 02:50:09 -0800 (PST) X-Received: by 10.68.238.234 with SMTP id vn10mr25594118pbc.140.1422183009727; Sun, 25 Jan 2015 02:50:09 -0800 (PST) Received: from ysm-linux.localdomain ([120.136.34.176]) by mx.google.com with ESMTPSA id d12sm6908305pbu.64.2015.01.25.02.50.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Jan 2015 02:50:08 -0800 (PST) From: Yan Songming To: lng-odp@lists.linaro.org Date: Sun, 25 Jan 2015 18:50:54 +0800 Message-Id: <1422183054-23030-1-git-send-email-yan.songming@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Topics: patch Subject: [lng-odp] [PATCH v3 3/3] linux-generic: implement of odp_term_local. 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: yan.songming@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 From: Yan Sonming Free local resource of odp. Signed-off-by: Yan Songming --- platform/linux-generic/include/odp_internal.h | 2 ++ platform/linux-generic/odp_buffer_pool.c | 7 +++++++ platform/linux-generic/odp_init.c | 10 ++++++++++ platform/linux-generic/odp_schedule.c | 6 +++++- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 60d89b1..ddf5dd5 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -37,6 +37,7 @@ int odp_shm_init_local(void); int odp_buffer_pool_init_global(void); int odp_buffer_pool_term_global(void); +int odp_buffer_pool_term_local(void); int odp_pktio_init_global(void); int odp_pktio_term_global(void); @@ -54,6 +55,7 @@ int odp_crypto_term_global(void); int odp_schedule_init_global(void); int odp_schedule_term_global(void); int odp_schedule_init_local(void); +int odp_schedule_term_local(void); int odp_timer_init_global(void); int odp_timer_disarm_all(void); diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c index f9b0ba5..77f4a1e 100644 --- a/platform/linux-generic/odp_buffer_pool.c +++ b/platform/linux-generic/odp_buffer_pool.c @@ -124,6 +124,13 @@ int odp_buffer_pool_term_global(void) return ret; } +int odp_buffer_pool_term_local(void) +{ + _odp_flush_caches(); + return 0; +} + + /** * Buffer pool creation */ diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index a6f5c2c..73df6a7 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -141,5 +141,15 @@ int odp_init_local(void) int odp_term_local(void) { + if (odp_schedule_term_local()) { + ODP_ERR("ODP schedule local term failed.\n"); + return -1; + } + + if (odp_buffer_pool_term_local()) { + ODP_ERR("ODP buffer pool local term failed.\n"); + return -1; + } + return (odp_thread_term_local() > 0) ? 1 : 0; } diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 316bb01..a65a1d7 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -184,7 +184,11 @@ int odp_schedule_init_local(void) return 0; } - +int odp_schedule_term_local(void) +{ + memset(&sched_local, 0, sizeof(sched_local_t)); + return 0; +} void odp_schedule_mask_set(odp_queue_t queue, int prio) {