From patchwork Thu Jan 29 13:10:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "yan.songming" X-Patchwork-Id: 43936 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8EFC724119 for ; Thu, 29 Jan 2015 13:11:19 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id l4sf19687185lbv.1 for ; Thu, 29 Jan 2015 05:11:18 -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=TJPwBssp9EkgJAbRn6M6IpVH1lFyw04vxskAQ5HEJW8=; b=dSGw4ZW3rQcU55kQiiEO4DPVrg/WF+JjZfGAHz1L/IIb6XOmY3bBSWgQV/7OaN9sD9 sqY7wea3nXcNcrOWDhh967VSDI0sW/FCKfRdsv/2sIWVDalG3MH6g3EGm8VjhPl+T+AD 7rZdJ+ZXZfALz4TPqnD+AGlAVh82TnJojQ3ouyP+w5Ff8fOzdyauoUMHbPoVSPT2k/wE jCKr5TOsSZUgRIB1zEyamBNn8rkaCuUBS+gNn7Rlke7GEe6AvODKds/EGakBjHi4rc2B OHmvCDhd04wt6fL8QRvHJiPqpfRgWMdBUogjwfpB4gD/oI1uhlpOYigmk/MsTT40SnCv /xig== X-Gm-Message-State: ALoCoQmsQVWTB0Nn79BmITw19rEbN6BlAiG5x6VqtBUJgyUIgbySEwWvyafkpeBnTACS6VnzH9oF X-Received: by 10.112.154.233 with SMTP id vr9mr81261lbb.9.1422537078519; Thu, 29 Jan 2015 05:11:18 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.35 with SMTP id p3ls337667lap.49.gmail; Thu, 29 Jan 2015 05:11:18 -0800 (PST) X-Received: by 10.152.4.200 with SMTP id m8mr730108lam.2.1422537078371; Thu, 29 Jan 2015 05:11:18 -0800 (PST) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id rc4si7390877lac.23.2015.01.29.05.11.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Jan 2015 05:11:18 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id 10so27845893lbg.6 for ; Thu, 29 Jan 2015 05:11:18 -0800 (PST) X-Received: by 10.152.5.226 with SMTP id v2mr680522lav.34.1422537078256; Thu, 29 Jan 2015 05:11:18 -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 h5csp1757812lbj; Thu, 29 Jan 2015 05:11:17 -0800 (PST) X-Received: by 10.140.30.197 with SMTP id d63mr765111qgd.13.1422537076717; Thu, 29 Jan 2015 05:11:16 -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 c4si10066331qga.84.2015.01.29.05.11.15 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Jan 2015 05:11:16 -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 1YGosL-00068L-Fi; Thu, 29 Jan 2015 13:11:13 +0000 Received: from mail-pa0-f54.google.com ([209.85.220.54]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YGosE-00067h-Eb for lng-odp@lists.linaro.org; Thu, 29 Jan 2015 13:11:06 +0000 Received: by mail-pa0-f54.google.com with SMTP id eu11so38960994pac.13 for ; Thu, 29 Jan 2015 05:11:01 -0800 (PST) X-Received: by 10.70.37.104 with SMTP id x8mr394258pdj.119.1422537060940; Thu, 29 Jan 2015 05:11:00 -0800 (PST) Received: from ysm-linux.localdomain (119.81.145.116-static.reverse.softlayer.com. [119.81.145.116]) by mx.google.com with ESMTPSA id nw6sm6916974pbb.94.2015.01.29.05.10.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jan 2015 05:10:59 -0800 (PST) From: Yan Songming To: lng-odp@lists.linaro.org Date: Thu, 29 Jan 2015 21:10:26 +0800 Message-Id: <1422537026-25694-1-git-send-email-yan.songming@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Topics: patch Subject: [lng-odp] [PATCH v4 2/2] 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.217.175 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 | 6 ++++++ platform/linux-generic/odp_init.c | 10 ++++++++++ platform/linux-generic/odp_schedule.c | 8 +++++++- 4 files changed, 25 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 3f4a3e6..94027d5 100644 --- a/platform/linux-generic/odp_buffer_pool.c +++ b/platform/linux-generic/odp_buffer_pool.c @@ -124,6 +124,12 @@ int odp_buffer_pool_term_global(void) return ret; } +int odp_buffer_pool_term_local(void) +{ + _odp_flush_caches(); + return 0; +} + /** * Pool creation */ diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 1351b31..1e0255c 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 bff28d9..cbda67f 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -20,7 +20,8 @@ #include #include - +#include +#include /* Limits to number of scheduled queues */ #define SCHED_POOL_SIZE (256*1024) @@ -188,6 +189,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) {