From patchwork Fri Jan 30 02:46:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 44003 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3756C24128 for ; Fri, 30 Jan 2015 02:47:52 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id u10sf26037665lbd.3 for ; Thu, 29 Jan 2015 18:47:51 -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:in-reply-to :references: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=wof1NjaUXP9F7b4yrwnfaMChDKquxUXxtaRsv1IfHY8=; b=eaIWHIfVRbz+HQzjvfMetAFek1NdzIUudprP7Ghv74TAAbJwKi5j63EIi6w8l+do7t lxIbM6ynAkydExX31xuOlFa3+ysldA0okBFxvxBrH4YWCPSTM8c/CQhWScTP7yCPHPNf GRCOk3Wd5MGmxwU6pT75wUE4zTsucKQ+/zSYHDobmLL148eHg9/BZRlluXQ0ScaMhvDz iQlsJAUweZNT8jS/6u7ZMBt954rjO13PSqiRyjgJ/9DLNzunPyj25UQnO9T/B8tPgj46 sV9m1pDc2kJdYvBZTmXvBVz6mtK8PXxkzwqq67wBL8KzP8l6pxqmP12Hvc/9nXc84vgn HmXQ== X-Gm-Message-State: ALoCoQlBKuSnyEAOssJT/NNUTtwbc2B608nb5LFhaRhoQFF4dMHTDLbr1HQPWwLpGilQmDll6gHf X-Received: by 10.112.51.100 with SMTP id j4mr482455lbo.24.1422586071068; Thu, 29 Jan 2015 18:47:51 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.5 with SMTP id ua5ls314538lac.68.gmail; Thu, 29 Jan 2015 18:47:50 -0800 (PST) X-Received: by 10.112.125.4 with SMTP id mm4mr4299877lbb.86.1422586070858; Thu, 29 Jan 2015 18:47:50 -0800 (PST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id l4si1655676lbp.82.2015.01.29.18.47.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Jan 2015 18:47:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id l4so34330841lbv.3 for ; Thu, 29 Jan 2015 18:47:50 -0800 (PST) X-Received: by 10.152.219.37 with SMTP id pl5mr267551lac.6.1422586070597; Thu, 29 Jan 2015 18:47:50 -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 h5csp140830lbj; Thu, 29 Jan 2015 18:47:49 -0800 (PST) X-Received: by 10.224.29.137 with SMTP id q9mr7843351qac.95.1422586069390; Thu, 29 Jan 2015 18:47:49 -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 x1si11951843qcd.36.2015.01.29.18.47.48 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Jan 2015 18:47:49 -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 1YH1cY-0002k4-Gq; Fri, 30 Jan 2015 02:47:46 +0000 Received: from mail-qg0-f48.google.com ([209.85.192.48]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YH1c1-0002h9-Qg for lng-odp@lists.linaro.org; Fri, 30 Jan 2015 02:47:13 +0000 Received: by mail-qg0-f48.google.com with SMTP id z60so36427579qgd.7 for ; Thu, 29 Jan 2015 18:47:08 -0800 (PST) X-Received: by 10.229.25.200 with SMTP id a8mr8128721qcc.22.1422586028662; Thu, 29 Jan 2015 18:47:08 -0800 (PST) Received: from mike-desktop.?.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id n4sm8829452qas.20.2015.01.29.18.47.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jan 2015 18:47:08 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Thu, 29 Jan 2015 21:46:51 -0500 Message-Id: <1422586015-29874-6-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422586015-29874-1-git-send-email-mike.holmes@linaro.org> References: <1422586015-29874-1-git-send-email-mike.holmes@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 05/10] linux-generic: queue: add term_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.217.172 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 Signed-off-by: Yan Songming Signed-off-by: Mike Holmes --- platform/linux-generic/include/odp_internal.h | 1 + platform/linux-generic/odp_init.c | 5 +++++ platform/linux-generic/odp_queue.c | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 79bf6e3..4790481 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -43,6 +43,7 @@ int odp_classification_init_global(void); int odp_classification_term_global(void); int odp_queue_init_global(void); +int odp_queue_term_global(void); int odp_crypto_init_global(void); int odp_crypto_term_global(void); diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index b91fca4..d381fd4 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -92,6 +92,11 @@ int odp_term_global(void) return -1; } + if (odp_queue_term_global()) { + ODP_ERR("ODP queue term failed.\n"); + return -1; + } + return 0; } diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 60be9c2..4549b25 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -128,6 +128,31 @@ int odp_queue_init_global(void) return 0; } +int odp_queue_term_global(void) +{ + odp_shm_t shm; + int ret = 0; + queue_entry_t *queue; + int i; + + for (i = 0; i < ODP_CONFIG_QUEUES; i++) { + queue = &queue_tbl->queue[i]; + LOCK(&queue->s.lock); + if (queue->s.status != QUEUE_STATUS_FREE) { + ODP_ERR("Not destroyed queue: %s\n", queue->s.name); + ret = -1; + } + UNLOCK(&queue->s.lock); + } + + shm = odp_shm_lookup("odp_queues"); + if (shm == ODP_SHM_INVALID) + return -1; + ret = odp_shm_free(shm); + + return ret; +} + odp_queue_type_t odp_queue_type(odp_queue_t handle) { queue_entry_t *queue;