From patchwork Wed Feb 25 12:15:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 45044 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f197.google.com (mail-we0-f197.google.com [74.125.82.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EB0462142A for ; Wed, 25 Feb 2015 12:16:58 +0000 (UTC) Received: by wesk11 with SMTP id k11sf2570127wes.3 for ; Wed, 25 Feb 2015 04:16:58 -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=5I6QVkDzWLUS8iwmWpRFhQIlURDNQkExV9kav/4W9E0=; b=XU7E2gybrS9VG9Jv8fpwqW/FMF9+U1zIZogqG4y1vyPWx5vrVHagpnvaM1J2xUz2oS bgPJJ0upObQ+vijg1coVKbr3v5qv8R6/kyCHdTBKQMCNmvfI2+IpJh9dqVkSODzXPEO2 Y9wqzC6M0Dn3A+VRoL/SY5Q21TZFlwr6oiPKcxe7XOw1SqNJJaWhe4sV/9k/mPza7T2G Qyhy48hK1dslJw/Zpk4DKOCiX/rd/2IvXmGGmi1tPhFTTcqhrV1As0yV+RCria0D+Ivi 0L21Ro7Xdkv/aaV1G+CIeeKcBQDtquJUuXlaViubXJ+5xEInh7QFOFGYexviDXlrgDNN rueg== X-Gm-Message-State: ALoCoQlgxx/DqP2t26Wi7ESQHVpx2qdhsOlwkwREmG8WoMWg1D0llY6x25jUBTwmrFLrRXJRnZXi X-Received: by 10.194.239.41 with SMTP id vp9mr432251wjc.5.1424866618262; Wed, 25 Feb 2015 04:16:58 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.9 with SMTP id bc9ls867731lab.101.gmail; Wed, 25 Feb 2015 04:16:58 -0800 (PST) X-Received: by 10.112.54.228 with SMTP id m4mr2614105lbp.20.1424866617996; Wed, 25 Feb 2015 04:16:57 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id l6si16604932laf.78.2015.02.25.04.16.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Feb 2015 04:16:57 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by labgd6 with SMTP id gd6so3401945lab.8 for ; Wed, 25 Feb 2015 04:16:57 -0800 (PST) X-Received: by 10.152.21.100 with SMTP id u4mr2442049lae.41.1424866617880; Wed, 25 Feb 2015 04:16:57 -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 h5csp2578497lbj; Wed, 25 Feb 2015 04:16:57 -0800 (PST) X-Received: by 10.140.83.202 with SMTP id j68mr5707904qgd.99.1424866616035; Wed, 25 Feb 2015 04:16:56 -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 z7si37830962qaj.27.2015.02.25.04.16.54 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 25 Feb 2015 04:16:56 -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 1YQatY-000685-Uo; Wed, 25 Feb 2015 12:16:52 +0000 Received: from mail-wi0-f179.google.com ([209.85.212.179]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YQatQ-00067e-Ba for lng-odp@lists.linaro.org; Wed, 25 Feb 2015 12:16:44 +0000 Received: by mail-wi0-f179.google.com with SMTP id ex7so4580108wid.0 for ; Wed, 25 Feb 2015 04:16:38 -0800 (PST) X-Received: by 10.194.179.166 with SMTP id dh6mr5600636wjc.87.1424866598782; Wed, 25 Feb 2015 04:16:38 -0800 (PST) Received: from e106441.cambridge.arm.com ([2001:41d0:a:3cb4::1]) by mx.google.com with ESMTPSA id u16sm25388747wjr.5.2015.02.25.04.16.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Feb 2015 04:16:38 -0800 (PST) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Wed, 25 Feb 2015 12:15:59 +0000 Message-Id: <1424866561-3728-2-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1424866561-3728-1-git-send-email-stuart.haslam@linaro.org> References: <1424866561-3728-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 1/3] validation: pktio: destroy pktio input queues 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: stuart.haslam@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.53 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 Signed-off-by: Stuart Haslam --- test/validation/odp_pktio.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index 3f9de3c..6bcec6c 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -248,6 +248,39 @@ static int create_inq(odp_pktio_t pktio) return odp_pktio_inq_setdef(pktio, inq_def); } +static int destroy_inq(odp_pktio_t pktio) +{ + odp_queue_t inq; + odp_event_t ev; + odp_queue_type_t q_type; + + inq = odp_pktio_inq_getdef(pktio); + + if (inq == ODP_QUEUE_INVALID) { + CU_FAIL("attempting to destroy invalid inq"); + return -1; + } + + CU_ASSERT(odp_pktio_inq_remdef(pktio) == 0); + + q_type = odp_queue_type(inq); + + /* flush any pending events */ + while (1) { + if (q_type == ODP_QUEUE_TYPE_POLL) + ev = odp_queue_deq(inq); + else + 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); +} + static odp_event_t queue_deq_wait_time(odp_queue_t queue, uint64_t ns) { uint64_t start, now, diff; @@ -387,7 +420,7 @@ static void pktio_test_txrx(odp_queue_type_t q_type, int num_pkts) pktio_txrx_multi(&pktios[0], &pktios[if_b], num_pkts); for (i = 0; i < num_ifaces; ++i) { - odp_pktio_inq_remdef(pktios[i].id); + destroy_inq(pktios[i].id); ret = odp_pktio_close(pktios[i].id); CU_ASSERT(ret == 0); } @@ -484,15 +517,18 @@ static void test_odp_pktio_mac(void) static void test_odp_pktio_inq_remdef(void) { odp_pktio_t pktio = create_pktio(iface_name[0]); + odp_queue_t inq; int i; CU_ASSERT(pktio != ODP_PKTIO_INVALID); CU_ASSERT(create_inq(pktio) == 0); + CU_ASSERT((inq = odp_pktio_inq_getdef(pktio)) != ODP_QUEUE_INVALID); CU_ASSERT(odp_pktio_inq_remdef(pktio) == 0); for (i = 0; i < 100; i++) odp_schedule(NULL, ODP_TIME_MSEC); + CU_ASSERT(odp_queue_destroy(inq) == 0); CU_ASSERT(odp_pktio_close(pktio) == 0); } @@ -538,7 +574,7 @@ static void test_odp_pktio_inq(void) CU_ASSERT(pktio != ODP_PKTIO_INVALID); CU_ASSERT(create_inq(pktio) == 0); - + CU_ASSERT(destroy_inq(pktio) == 0); CU_ASSERT(odp_pktio_close(pktio) == 0); }