From patchwork Wed Jul 1 17:06:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 50536 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AAF21229E5 for ; Wed, 1 Jul 2015 17:10:35 +0000 (UTC) Received: by wgbbj7 with SMTP id bj7sf14591071wgb.2 for ; Wed, 01 Jul 2015 10:10:35 -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:in-reply-to:references:cc: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=2tDJk7Bojdfo8RfpyHjpCkTiu/4wqN0o7+iJvspffq4=; b=gNRzAL4nrR77uepkwhFBUi4zg5sCySZ6+7Tgde763ROBnZGvlabnNAfo+TPH3da4y/ j/kMBWPlDIQFHT8kf4Z3n0YLzq0imLs/m0EJwlIvJWBFYbNnt/ZIDbFqyVF1HdMUsWDQ tDndMRIG4V96SJBHaZxf2Sh9KYiVIASdme0MRDE8ceWymqYv6GtfU/Quauxuq5U6nXR1 4SrHST8DDZBBJJlD+0HpENzFB+mvPoYIv91LfruK8NlZ1KAZSwyvBEom6JPGqywWh8nC VskpkqDSjQ4V8aySvELgyCZDsOv9EaJEqCFVXuNPOtHyl1nSDPMxFvCHvk12h+mnjnE3 bStw== X-Gm-Message-State: ALoCoQnx3Os+spFIkbIhFqvGgmycdmRKHENlVZuDmBlesayBbscVs3DU6/vejNxgBOI1iI7X7SMe X-Received: by 10.181.12.104 with SMTP id ep8mr15447483wid.7.1435770635034; Wed, 01 Jul 2015 10:10:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.73 with SMTP id y9ls195764lay.18.gmail; Wed, 01 Jul 2015 10:10:34 -0700 (PDT) X-Received: by 10.152.37.102 with SMTP id x6mr26236841laj.69.1435770634863; Wed, 01 Jul 2015 10:10:34 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id qb5si2232704lbb.28.2015.07.01.10.10.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2015 10:10:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lagh6 with SMTP id h6so45034359lag.2 for ; Wed, 01 Jul 2015 10:10:34 -0700 (PDT) X-Received: by 10.152.26.163 with SMTP id m3mr26372687lag.86.1435770634748; Wed, 01 Jul 2015 10:10:34 -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.108.230 with SMTP id hn6csp744195lbb; Wed, 1 Jul 2015 10:10:33 -0700 (PDT) X-Received: by 10.140.149.129 with SMTP id 123mr37655125qhv.56.1435770631862; Wed, 01 Jul 2015 10:10:31 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id d8si3000895qhc.5.2015.07.01.10.10.31; Wed, 01 Jul 2015 10:10:31 -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 06D2661F4A; Wed, 1 Jul 2015 17:10:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5A2A661F5E; Wed, 1 Jul 2015 17:07:37 +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 39FD261F57; Wed, 1 Jul 2015 17:07:33 +0000 (UTC) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by lists.linaro.org (Postfix) with ESMTPS id B86F661F5A for ; Wed, 1 Jul 2015 17:06:43 +0000 (UTC) Received: by widjy10 with SMTP id jy10so63400058wid.1 for ; Wed, 01 Jul 2015 10:06:43 -0700 (PDT) X-Received: by 10.195.11.168 with SMTP id ej8mr50964880wjd.150.1435770402990; Wed, 01 Jul 2015 10:06:42 -0700 (PDT) Received: from localhost.localdomain ([90.152.119.35]) by mx.google.com with ESMTPSA id fi6sm4335895wib.6.2015.07.01.10.06.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Jul 2015 10:06:42 -0700 (PDT) From: Zoltan Kiss To: lng-odp@lists.linaro.org Date: Wed, 1 Jul 2015 18:06:17 +0100 Message-Id: <1435770379-30000-8-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435770379-30000-1-git-send-email-zoltan.kiss@linaro.org> References: <1435770379-30000-1-git-send-email-zoltan.kiss@linaro.org> X-Topics: patch Cc: Petri Savolainen Subject: [lng-odp] [API-NEXT PATCH v4 7/9] event: replace complicated buffer releases with odp_event_free() 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: zoltan.kiss@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.44 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 Instead of converting types let odp_event_free() to do the right thing. Signed-off-by: Zoltan Kiss --- v3: rebase to latest master example/timer/odp_timer_test.c | 2 +- platform/linux-generic/odp_schedule.c | 5 +---- test/performance/odp_pktio_perf.c | 4 ++-- test/performance/odp_scheduling.c | 4 +--- test/validation/classification/odp_classification_tests.c | 2 +- test/validation/odp_timer.c | 2 +- test/validation/pktio/pktio.c | 6 +++--- test/validation/scheduler/scheduler.c | 11 +++-------- 8 files changed, 13 insertions(+), 23 deletions(-) diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index ccd07fd..8bbf7ef 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -167,7 +167,7 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) /* Cancel and free last timer used */ (void)odp_timer_cancel(ttp->tim, &ttp->ev); if (ttp->ev != ODP_EVENT_INVALID) - odp_timeout_free(odp_timeout_from_event(ttp->ev)); + odp_event_free(ttp->ev); else EXAMPLE_ERR("Lost timeout event at timer cancel\n"); /* Since we have cancelled the timer, there is no timeout event to diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 7fe42d7..9206d5c 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -328,10 +328,7 @@ int schedule_queue_init(queue_entry_t *qe) void schedule_queue_destroy(queue_entry_t *qe) { - odp_buffer_t buf; - - buf = odp_buffer_from_event(qe->s.cmd_ev); - odp_buffer_free(buf); + odp_event_free(qe->s.cmd_ev); pri_clr_queue(queue_handle(qe), queue_prio(qe)); diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 6d9b66c..686056e 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -427,7 +427,7 @@ static void *run_thread_rx(void *arg) else stats->s.rx_ignore++; } - odp_buffer_free(odp_buffer_from_event(ev[i])); + odp_event_free(ev[i]); } if (n_ev == 0 && odp_atomic_load_u32(&shutdown)) break; @@ -768,7 +768,7 @@ static int destroy_inq(odp_pktio_t pktio) ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT); if (ev != ODP_EVENT_INVALID) - odp_buffer_free(odp_buffer_from_event(ev)); + odp_event_free(ev); else break; } diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index 99f0f9b..558fec8 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -69,7 +69,6 @@ typedef struct { static void clear_sched_queues(void) { odp_event_t ev; - odp_buffer_t buf; while (1) { ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT); @@ -77,8 +76,7 @@ static void clear_sched_queues(void) if (ev == ODP_EVENT_INVALID) break; - buf = odp_buffer_from_event(ev); - odp_buffer_free(buf); + odp_event_free(ev); } } diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index 502105e..0aa4998 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -176,7 +176,7 @@ static int destroy_inq(odp_pktio_t pktio) ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT); if (ev != ODP_EVENT_INVALID) - odp_buffer_free(odp_buffer_from_event(ev)); + odp_event_free(ev); else break; } diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c index 88f5208..3a5255a 100644 --- a/test/validation/odp_timer.c +++ b/test/validation/odp_timer.c @@ -425,7 +425,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED) CU_ASSERT(rc == 0); for (i = 0; i < NTIMERS; i++) { if (tt[i].ev != ODP_EVENT_INVALID) - odp_timeout_free(odp_timeout_from_event(tt[i].ev)); + odp_event_free(tt[i].ev); } free(tt); diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c index 82ced5c..ab9a305 100644 --- a/test/validation/pktio/pktio.c +++ b/test/validation/pktio/pktio.c @@ -284,7 +284,7 @@ static int destroy_inq(odp_pktio_t pktio) ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT); if (ev != ODP_EVENT_INVALID) - odp_buffer_free(odp_buffer_from_event(ev)); + odp_event_free(ev); else break; } @@ -334,7 +334,7 @@ static odp_packet_t wait_for_packet(odp_queue_t queue, } /* not interested in this event */ - odp_buffer_free(odp_buffer_from_event(ev)); + odp_event_free(ev); } now = odp_time_cycles(); @@ -546,7 +546,7 @@ static void pktio_test_inq_remdef(void) for (i = 0; i < 100; i++) { ev = odp_schedule(NULL, ODP_TIME_MSEC); if (ev != ODP_EVENT_INVALID) { - odp_buffer_free(odp_buffer_from_event(ev)); + odp_event_free(ev); CU_FAIL("received unexpected event"); } } diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c index e03af13..d7f2ac3 100644 --- a/test/validation/scheduler/scheduler.c +++ b/test/validation/scheduler/scheduler.c @@ -68,10 +68,7 @@ static int exit_schedule_loop(void) while ((ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT)) != ODP_EVENT_INVALID) { - odp_buffer_t buf; - - buf = odp_buffer_from_event(ev); - odp_buffer_free(buf); + odp_event_free(ev); ret++; } @@ -200,10 +197,8 @@ static void *schedule_common_(void *arg) CU_ASSERT(num <= BURST_BUF_SIZE); if (num == 0) continue; - for (j = 0; j < num; j++) { - buf = odp_buffer_from_event(events[j]); - odp_buffer_free(buf); - } + for (j = 0; j < num; j++) + odp_event_free(events[j]); } else { ev = odp_schedule(&from, ODP_SCHED_NO_WAIT); buf = odp_buffer_from_event(ev);