From patchwork Tue Feb 24 16:00:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robbie King X-Patchwork-Id: 44946 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 319A62029F for ; Tue, 24 Feb 2015 16:01:51 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id r20sf15773887wiv.3 for ; Tue, 24 Feb 2015 08:01:50 -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=jEJgAWtQyXxIAV6VKlSE7bPKUnwitaFDQXoFa3c8NY0=; b=l62+R0QYRFeVi45ZVtnD1K9K33+CEDjPyjY49XgHjNtoI+a4GQHA57hHxhSAP3uiJO XuB57qK5LWBLlzoeCUMatJgxjh59HmOFwwVvmGWMGd1f7ilNvCsD4fY9SBTzuOO6TSI2 VY/ugo1/YN+K/qqda/gA4xuChYA40d8anoM/6Ivm30c7zBGnWxT7NzApUVgRclbWMv5l dKWwg13hwAWdfoqhZ7mpK3FGBFvQEAiQ4K0+aRw2ZM7SIBv05mG8bTkpgIIfdtWcwcgo FQyA8tMOZc6aFR9LpXxby0+y+q/52oge6AE90cChzZithw72bCMjrlvkQBDyoTMkFCNq lnrg== X-Gm-Message-State: ALoCoQkwjaoWcCXXCV7PThN95yudQx5oKJH6gfHL0fj6CG9pKUsfnOZbWOqj8xbWQ8kAqQy38VPV X-Received: by 10.194.142.174 with SMTP id rx14mr2260726wjb.4.1424793710485; Tue, 24 Feb 2015 08:01:50 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.6 with SMTP id v6ls690753laa.13.gmail; Tue, 24 Feb 2015 08:01:50 -0800 (PST) X-Received: by 10.112.188.165 with SMTP id gb5mr198607lbc.35.1424793710281; Tue, 24 Feb 2015 08:01:50 -0800 (PST) Received: from mail-lb0-x232.google.com (mail-lb0-x232.google.com. [2a00:1450:4010:c04::232]) by mx.google.com with ESMTPS id ru4si26274353lbb.178.2015.02.24.08.01.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2015 08:01:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::232 as permitted sender) client-ip=2a00:1450:4010:c04::232; Received: by lbiz11 with SMTP id z11so25867935lbi.8 for ; Tue, 24 Feb 2015 08:01:50 -0800 (PST) X-Received: by 10.152.179.172 with SMTP id dh12mr14615969lac.76.1424793710155; Tue, 24 Feb 2015 08:01: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 h5csp2000622lbj; Tue, 24 Feb 2015 08:01:49 -0800 (PST) X-Received: by 10.140.135.200 with SMTP id 191mr38260952qhh.25.1424793708659; Tue, 24 Feb 2015 08:01:48 -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 142si26033159qhr.25.2015.02.24.08.01.47 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 24 Feb 2015 08:01:48 -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 1YQHvd-0006e2-MM; Tue, 24 Feb 2015 16:01:45 +0000 Received: from alln-iport-5.cisco.com ([173.37.142.92]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YQHvK-0006Zw-3o for lng-odp@lists.linaro.org; Tue, 24 Feb 2015 16:01:26 +0000 X-IronPort-AV: E=Sophos;i="5.09,639,1418083200"; d="scan'208";a="126473058" Received: from alln-core-4.cisco.com ([173.36.13.137]) by alln-iport-5.cisco.com with ESMTP; 24 Feb 2015 16:01:20 +0000 Received: from cpp-rtpbld-55.cisco.com (cpp-rtpbld-55.cisco.com [172.18.5.199]) by alln-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id t1OG1KDr019778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 24 Feb 2015 16:01:20 GMT Received: from cpp-rtpbld-55.cisco.com (localhost.localdomain [127.0.0.1]) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8) with ESMTP id t1OG1J6l028850; Tue, 24 Feb 2015 11:01:19 -0500 Received: (from robking@localhost) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8/Submit) id t1OG1Ju7028849; Tue, 24 Feb 2015 11:01:19 -0500 From: Robbie King To: lng-odp@lists.linaro.org Date: Tue, 24 Feb 2015 11:00:42 -0500 Message-Id: <1424793647-28572-6-git-send-email-robking@cisco.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1424793647-28572-1-git-send-email-robking@cisco.com> References: <1424793647-28572-1-git-send-email-robking@cisco.com> X-Topics: patch Subject: [lng-odp] [PATCHv4 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-Original-Sender: robking@cisco.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::232 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=fail header.i=@cisco.com 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 Signed-off-by: Robbie King --- platform/linux-generic/include/odp_internal.h | 1 + platform/linux-generic/odp_init.c | 5 ++++ platform/linux-generic/odp_queue.c | 38 +++++++++++++++++++++++++-- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 83b0beb..c6da30b 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -48,6 +48,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 966009a..f15485f 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -98,6 +98,11 @@ int odp_term_global(void) rc = -1; } + if (odp_queue_term_global()) { + ODP_ERR("ODP queue term failed.\n"); + rc = -1; + } + return rc; } diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 6806a95..b945e03 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -128,6 +128,32 @@ int odp_queue_init_global(void) return 0; } +int odp_queue_term_global(void) +{ + int ret = 0; + int rc = 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); + rc = -1; + } + UNLOCK(&queue->s.lock); + } + + ret = odp_shm_free(odp_shm_lookup("odp_queues")); + if (ret < 0) { + ODP_ERR("shm free failed for odp_queues"); + rc = -1; + } + + return rc; +} + odp_queue_type_t odp_queue_type(odp_queue_t handle) { queue_entry_t *queue; @@ -217,9 +243,17 @@ int odp_queue_destroy(odp_queue_t handle) queue = queue_to_qentry(handle); LOCK(&queue->s.lock); - if (queue->s.status == QUEUE_STATUS_FREE || queue->s.head != NULL) { + if (queue->s.status == QUEUE_STATUS_FREE) { UNLOCK(&queue->s.lock); - return -1; /* Queue is already free or not empty */ + ODP_ERR("queue_destroy: queue \"%s\" already free\n", + queue->s.name); + return -1; + } + if (queue->s.head != NULL) { + UNLOCK(&queue->s.lock); + ODP_ERR("queue_destroy: queue \"%s\" not empty\n", + queue->s.name); + return -1; } queue->s.enqueue = queue_enq_dummy;