From patchwork Fri Feb 27 14:15:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 45225 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 59A9120674 for ; Fri, 27 Feb 2015 14:16:40 +0000 (UTC) Received: by wiwl15 with SMTP id l15sf379834wiw.0 for ; Fri, 27 Feb 2015 06:16:39 -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=GNrAjTK3KaE2QzMKKoPj0eIlZdzLqWDHMMEE6G6Fm7w=; b=lmRYSBXVj5YLBZoM2OkdBi83TvIIsMYnjW77YgvIfi2zRjTXW9eu+XtwLaZmAa+rY1 di6Btoe04PC+Es57W4SQHGGpHkpA9nJa3CCjyaT2JWN44ur9ChrgFwHHNAU62ZscF9A+ xXbe4M1MMyu3Wn7GmW/b9wt8svKBCiuUHUNCBn0o1lFXtKzcvnIoCtGn3geRpmO/Ngz2 w6E/drz7fhBb2h34UYDKqCdrfB4wGMlYf++L4OCGKXdf/KfM4v+Uh5Qb/Gsy/hlg0Ark O+vD0P4wa06Ni43l67L1Af2gO027QNg4S7nA6d7aC0YDRstv6t70j3d+96bCoY79S38k 6MqQ== X-Gm-Message-State: ALoCoQljxJ2KNJxSftx+BrYiTRbh+NuOH1jsDEjItdnXby3QR3XKnntOeyfZtB5nW/ZCTeYu5DFK X-Received: by 10.180.101.101 with SMTP id ff5mr507987wib.5.1425046599591; Fri, 27 Feb 2015 06:16:39 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.132 with SMTP id q4ls153591laj.26.gmail; Fri, 27 Feb 2015 06:16:39 -0800 (PST) X-Received: by 10.112.130.39 with SMTP id ob7mr3030530lbb.32.1425046599355; Fri, 27 Feb 2015 06:16:39 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id b6si3051496lak.36.2015.02.27.06.16.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Feb 2015 06:16:39 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by labgq15 with SMTP id gq15so17843953lab.6 for ; Fri, 27 Feb 2015 06:16:39 -0800 (PST) X-Received: by 10.152.21.100 with SMTP id u4mr12494445lae.41.1425046599258; Fri, 27 Feb 2015 06:16:39 -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 h5csp3967816lbj; Fri, 27 Feb 2015 06:16:38 -0800 (PST) X-Received: by 10.236.50.193 with SMTP id z41mr12189268yhb.124.1425046597937; Fri, 27 Feb 2015 06:16:37 -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 n19si4118483qae.95.2015.02.27.06.16.36 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 27 Feb 2015 06:16:37 -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 1YRLiU-00052o-CU; Fri, 27 Feb 2015 14:16:34 +0000 Received: from mail-pd0-f176.google.com ([209.85.192.176]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YRLiA-00052M-Fx for lng-odp@lists.linaro.org; Fri, 27 Feb 2015 14:16:14 +0000 Received: by pdno5 with SMTP id o5so21332189pdn.8 for ; Fri, 27 Feb 2015 06:16:09 -0800 (PST) X-Received: by 10.66.171.199 with SMTP id aw7mr24811122pac.6.1425046569028; Fri, 27 Feb 2015 06:16:09 -0800 (PST) Received: from manoharan-Vostro-2520.domain.name ([117.207.69.110]) by mx.google.com with ESMTPSA id sl5sm4147661pbc.45.2015.02.27.06.16.06 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Feb 2015 06:16:08 -0800 (PST) From: bala.manoharan@linaro.org To: lng-odp@lists.linaro.org Date: Fri, 27 Feb 2015 19:45:51 +0530 Message-Id: <1425046551-3386-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 2.0.1.472.g6f92e5f X-Topics: Classification patch Subject: [lng-odp] [PATCH v1] validation: classification: destroy pktio default inqueue during teardown 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: bala.manoharan@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.48 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: Balasubramanian Manoharan Destroys pktio default inqueue for a clean odp_classification_term_global() Fixes https://bugs.linaro.org/show_bug.cgi?id=1281 Signed-off-by: Balasubramanian Manoharan --- .../classification/odp_classification_tests.c | 50 +++++++++++++++++++--- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index ee2c420..65e1011 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -5,6 +5,7 @@ */ #include "odp_classification_testsuites.h" +#include #include #include #include @@ -154,6 +155,33 @@ static uint32_t cls_pkt_get_seq(odp_packet_t pkt) return TEST_SEQ_INVALID; } + +static int destroy_inq(odp_pktio_t pktio) +{ + odp_queue_t inq; + odp_event_t ev; + + inq = odp_pktio_inq_getdef(pktio); + + if (inq == ODP_QUEUE_INVALID) { + CU_FAIL("attempting to destroy invalid inq"); + return -1; + } + + if (0 > odp_pktio_inq_remdef(pktio)) + return -1; + + while (1) { + ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT); + + if (ev != ODP_EVENT_INVALID) + odp_buffer_free(odp_buffer_from_event(ev)); + else + break; + } + + return odp_queue_destroy(inq); +} odp_packet_t create_packet(bool vlan) { uint32_t seqno; @@ -296,11 +324,22 @@ int classification_tests_init(void) int classification_tests_finalize(void) { int i; - if (0 > odp_pktio_close(pktio_loop)) - return -1; + int retcode = 0; - if (0 != odp_pool_destroy(pool_default)) - return -1; + if (0 > destroy_inq(pktio_loop)) { + fprintf(stderr, "destroy pktio inq failed.\n"); + retcode = -1; + } + + if (0 > odp_pktio_close(pktio_loop)) { + fprintf(stderr, "pktio close failed.\n"); + retcode = -1; + } + + if (0 != odp_pool_destroy(pool_default)) { + fprintf(stderr, "pool_default destroy failed.\n"); + retcode = -1; + } for (i = 0; i < CLS_ENTRIES; i++) odp_cos_destroy(cos_list[i]); @@ -310,7 +349,8 @@ int classification_tests_finalize(void) for (i = 0; i < CLS_ENTRIES; i++) odp_queue_destroy(queue_list[i]); - return 0; + + return retcode; } void configure_cls_pmr_chain(void)