From patchwork Wed Oct 21 05:14:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 55339 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f71.google.com (mail-lf0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id E86B122EA2 for ; Wed, 21 Oct 2015 05:15:24 +0000 (UTC) Received: by lffz202 with SMTP id z202sf12696509lff.3 for ; Tue, 20 Oct 2015 22:15:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to: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=ng39snY9nK3mvq8eduqp89ghZNjpy5wpb7Xf+ksnRSQ=; b=eK9+CkaHUs62Xgoc9TN9jP9KQtpm0/QDtFguhLOEvSLKdaUFv7FrksBQqGTtaNyXo3 jWXy0Hio4xF8eUBsXeRrRDeSXgJnaU89/pbn6kKhem559enjOBMNC2RVnFITg3Us+EI8 9/LNIIC1p1Z3Ur4HWSqjThCRzRpbCgJKOeaoLDzT1FUlrvTZsyvlvT8YJBYOEhubUH2s Rhd1uI6mNo59O6viW58wcvxVX8s6mUW566ccGqeNA+1idfoP8g1a1xyEuminWJIBGpG9 3megdiuJJc9Z3B24vCsuo6uyFBalnO1h60Dn83elLdlgu/PR14PtoZO/oxguSXd62zNo 0liA== X-Gm-Message-State: ALoCoQk1EPao0Abuh2qvK9vojgdahjAa+suqod2sBwcWjAWx2ByNStuYWK++L583XKPqRQB46kF6 X-Received: by 10.112.55.69 with SMTP id q5mr1565901lbp.24.1445404523880; Tue, 20 Oct 2015 22:15:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.86.70 with SMTP id k67ls165913lfb.43.gmail; Tue, 20 Oct 2015 22:15:23 -0700 (PDT) X-Received: by 10.112.131.8 with SMTP id oi8mr3180169lbb.99.1445404523740; Tue, 20 Oct 2015 22:15:23 -0700 (PDT) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id f79si5049132lfg.45.2015.10.20.22.15.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2015 22:15:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lffv3 with SMTP id v3so15548319lff.0 for ; Tue, 20 Oct 2015 22:15:23 -0700 (PDT) X-Received: by 10.25.150.199 with SMTP id y190mr2674883lfd.35.1445404523330; Tue, 20 Oct 2015 22:15:23 -0700 (PDT) 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.59.35 with SMTP id w3csp2467060lbq; Tue, 20 Oct 2015 22:15:22 -0700 (PDT) X-Received: by 10.140.82.199 with SMTP id h65mr8547702qgd.52.1445404522464; Tue, 20 Oct 2015 22:15:22 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w53si6447679qge.125.2015.10.20.22.15.13; Tue, 20 Oct 2015 22:15:22 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 437C461FE6; Wed, 21 Oct 2015 05:15:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id EF1F061FD2; Wed, 21 Oct 2015 05:15:09 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id B6D2D61FD2; Wed, 21 Oct 2015 05:15:07 +0000 (UTC) Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by lists.linaro.org (Postfix) with ESMTPS id CA76D61FCF for ; Wed, 21 Oct 2015 05:15:06 +0000 (UTC) Received: by pacfv9 with SMTP id fv9so45113429pac.3 for ; Tue, 20 Oct 2015 22:15:06 -0700 (PDT) X-Received: by 10.66.155.167 with SMTP id vx7mr8307636pab.127.1445404506035; Tue, 20 Oct 2015 22:15:06 -0700 (PDT) Received: from localhost.localdomain ([122.166.219.57]) by smtp.gmail.com with ESMTPSA id dd4sm6749251pbb.52.2015.10.20.22.15.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Oct 2015 22:15:05 -0700 (PDT) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Wed, 21 Oct 2015 10:44:52 +0530 Message-Id: <1445404495-14144-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: Classification patch Subject: [lng-odp] [API-NEXT/PATCHv1 1/4] validation: classification: move destroy_inq() to common file X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" 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.50 as permitted sender) smtp.mailfrom=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 Common in-queue destroy function destroy_inq() is moved to odp_classification_common.c file Signed-off-by: Balasubramanian Manoharan Reviewed-by: Bill Fischofer Reviewed-by: Ivan Khoronzhuk --- .../classification/odp_classification_common.c | 27 ++++++++++++++++++++++ .../classification/odp_classification_test_pmr.c | 27 ---------------------- .../classification/odp_classification_tests.c | 27 ---------------------- .../classification/odp_classification_testsuites.h | 2 +- 4 files changed, 28 insertions(+), 55 deletions(-) diff --git a/test/validation/classification/odp_classification_common.c b/test/validation/classification/odp_classification_common.c index b975dfb..9966d5f 100644 --- a/test/validation/classification/odp_classification_common.c +++ b/test/validation/classification/odp_classification_common.c @@ -17,6 +17,33 @@ typedef struct cls_test_packet { uint32be_t seq; } cls_test_packet_t; +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_event_free(ev); + else + break; + } + + return odp_queue_destroy(inq); +} + int cls_pkt_set_seq(odp_packet_t pkt) { static uint32_t seq; diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c index e794bda..c6b733c 100644 --- a/test/validation/classification/odp_classification_test_pmr.c +++ b/test/validation/classification/odp_classification_test_pmr.c @@ -17,33 +17,6 @@ static odp_pool_t pool_default; /** sequence number of IP packets */ odp_atomic_u32_t seq; -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); -} - int classification_suite_pmr_init(void) { odp_pool_t pool; diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index fe55419..03a855e 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -22,33 +22,6 @@ static odp_pktio_t pktio_loop; /** sequence number of IP packets */ odp_atomic_u32_t seq; -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_event_free(ev); - else - break; - } - - return odp_queue_destroy(inq); -} - int classification_suite_init(void) { odp_pool_param_t param; diff --git a/test/validation/classification/odp_classification_testsuites.h b/test/validation/classification/odp_classification_testsuites.h index 33547a7..a7a8baa 100644 --- a/test/validation/classification/odp_classification_testsuites.h +++ b/test/validation/classification/odp_classification_testsuites.h @@ -43,6 +43,6 @@ void configure_pmr_cos(void); void test_pmr_cos(void); void configure_pktio_pmr_match_set_cos(void); void test_pktio_pmr_match_set_cos(void); - +int destroy_inq(odp_pktio_t pktio); #endif /* ODP_BUFFER_TESTSUITES_H_ */