From patchwork Tue Jan 20 11:17:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43348 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 30C592034D for ; Tue, 20 Jan 2015 11:19:34 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id l18sf5935431wgh.3 for ; Tue, 20 Jan 2015 03:19:33 -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=AQB0jkUzQPnsShDssyDVfI5mznIGFwfWB/ATikECjIE=; b=BQ4khTwoxmSbFHMwESAH997V0XeO2IRslKTJOlCqXOrvknup/cnMjVtH9RrplZwqx5 mwbs0j2vtT93+9Rkl8EhiEFH2BOvKaWiJkLRlUf7MRnrM3f870k00nO6VtOV9PFfP+Z5 3FcXDWlkgidp2SDv8TpMufwcQDgaZlSyHX9VDRS2Fohpc6dKwYu+1EjvBrIVlTi25Rx2 puyLs2cT9Ftz6IBqqlZd+Xs8DgJsXD8PTUSiM15/8opI53CiZ50PIhE7s/m/Z6zJLExa klQgsXlKajvF//mxH2jKC0MWL5HTCbKI8Hx0gME5UjU7bSkI3ROefz/CWLdqTjQ1W6Ib ySAA== X-Gm-Message-State: ALoCoQndy2M6BC7ip/McpsfnAL0RGit4OrBsSnkLwrqjgemnR3fN/uw4Ah2N6/8ya1c4677DeDWn X-Received: by 10.152.182.204 with SMTP id eg12mr10649lac.10.1421752773407; Tue, 20 Jan 2015 03:19:33 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.101 with SMTP id 5ls697564lal.72.gmail; Tue, 20 Jan 2015 03:19:33 -0800 (PST) X-Received: by 10.112.159.195 with SMTP id xe3mr37103248lbb.64.1421752773259; Tue, 20 Jan 2015 03:19:33 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id u2si16278874lae.110.2015.01.20.03.19.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:33 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id u10so2301292lbd.9 for ; Tue, 20 Jan 2015 03:19:33 -0800 (PST) X-Received: by 10.152.45.4 with SMTP id i4mr37746587lam.74.1421752773126; Tue, 20 Jan 2015 03:19:33 -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.9.200 with SMTP id c8csp1380790lbb; Tue, 20 Jan 2015 03:19:32 -0800 (PST) X-Received: by 10.140.90.112 with SMTP id w103mr42048612qgd.65.1421752770875; Tue, 20 Jan 2015 03:19:30 -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 x8si21714238qab.52.2015.01.20.03.19.29 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:30 -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 1YDWqA-0006F8-4V; Tue, 20 Jan 2015 11:19:22 +0000 Received: from mail-qg0-f54.google.com ([209.85.192.54]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YDWpy-0006Be-BC for lng-odp@lists.linaro.org; Tue, 20 Jan 2015 11:19:10 +0000 Received: by mail-qg0-f54.google.com with SMTP id q108so2250368qgd.13 for ; Tue, 20 Jan 2015 03:19:05 -0800 (PST) X-Received: by 10.229.50.135 with SMTP id z7mr56481550qcf.21.1421752745152; Tue, 20 Jan 2015 03:19:05 -0800 (PST) Received: from mcpro03.emea.nsn-net.net (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id t2sm14975907qae.6.2015.01.20.03.19.03 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:04 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Tue, 20 Jan 2015 13:17:59 +0200 Message-Id: <1421752692-24439-4-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1421752692-24439-1-git-send-email-petri.savolainen@linaro.org> References: <1421752692-24439-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v2 03/16] api: event: schedule_multi and queue_enq_multi 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: petri.savolainen@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.217.178 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 Changed odp_schedule_multi() and odp_queue_enq_multi() to use events instead of buffers. Signed-off-by: Petri Savolainen --- platform/linux-generic/include/api/odp_queue.h | 8 ++++---- platform/linux-generic/include/api/odp_schedule.h | 16 ++++++++-------- platform/linux-generic/odp_queue.c | 4 ++-- platform/linux-generic/odp_schedule.c | 4 ++-- test/performance/odp_scheduling.c | 22 +++++++++++++--------- test/validation/odp_pktio.c | 8 ++++---- test/validation/odp_queue.c | 16 ++++++++++------ test/validation/odp_schedule.c | 12 +++++++----- 8 files changed, 50 insertions(+), 40 deletions(-) diff --git a/platform/linux-generic/include/api/odp_queue.h b/platform/linux-generic/include/api/odp_queue.h index 3caa7c1..61afd36 100644 --- a/platform/linux-generic/include/api/odp_queue.h +++ b/platform/linux-generic/include/api/odp_queue.h @@ -181,15 +181,15 @@ void *odp_queue_get_context(odp_queue_t queue); int odp_queue_enq(odp_queue_t queue, odp_event_t ev); /** - * Enqueue multiple buffers to a queue + * Enqueue multiple events to a queue * * @param queue Queue handle - * @param buf Buffer handles - * @param num Number of buffer handles + * @param ev Event handles + * @param num Number of event handles * * @return 0 if succesful */ -int odp_queue_enq_multi(odp_queue_t queue, odp_buffer_t buf[], int num); +int odp_queue_enq_multi(odp_queue_t queue, odp_event_t ev[], int num); /** * Queue dequeue diff --git a/platform/linux-generic/include/api/odp_schedule.h b/platform/linux-generic/include/api/odp_schedule.h index 45fa48c..688a6db 100644 --- a/platform/linux-generic/include/api/odp_schedule.h +++ b/platform/linux-generic/include/api/odp_schedule.h @@ -64,22 +64,22 @@ uint64_t odp_schedule_wait_time(uint64_t ns); odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait); /** - * Schedule multiple buffers + * Schedule multiple events * - * Like odp_schedule(), but returns multiple buffers from a queue. + * Like odp_schedule(), but returns multiple events from a queue. * - * @param from Output parameter for the source queue (where the buffer was + * @param from Output parameter for the source queue (where the event was * dequeued from). Ignored if NULL. - * @param wait Minimum time to wait for a buffer. Waits infinitely, if set to + * @param wait Minimum time to wait for an event. Waits infinitely, if set to * ODP_SCHED_WAIT. Does not wait, if set to ODP_SCHED_NO_WAIT. * Use odp_schedule_wait_time() to convert time to other wait * values. - * @param out_buf Buffer array for output - * @param num Maximum number of buffers to output + * @param events Event array for output + * @param num Maximum number of events to output * - * @return Number of buffers outputed (0 ... num) + * @return Number of events outputed (0 ... num) */ -int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_buffer_t out_buf[], +int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t events[], unsigned int num); /** diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index c027f23..f3046e2 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -385,7 +385,7 @@ int queue_enq_multi_dummy(queue_entry_t *queue ODP_UNUSED, return -1; } -int odp_queue_enq_multi(odp_queue_t handle, odp_buffer_t buf[], int num) +int odp_queue_enq_multi(odp_queue_t handle, odp_event_t ev[], int num) { odp_buffer_hdr_t *buf_hdr[QUEUE_MULTI_MAX]; queue_entry_t *queue; @@ -397,7 +397,7 @@ int odp_queue_enq_multi(odp_queue_t handle, odp_buffer_t buf[], int num) queue = queue_to_qentry(handle); for (i = 0; i < num; i++) - buf_hdr[i] = odp_buf_to_hdr(buf[i]); + buf_hdr[i] = odp_buf_to_hdr(odp_buffer_from_event(ev[i])); return queue->s.enqueue_multi(queue, buf_hdr, num); } diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 7b25e8a..1e54fd2 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -380,9 +380,9 @@ odp_event_t odp_schedule(odp_queue_t *out_queue, uint64_t wait) int odp_schedule_multi(odp_queue_t *out_queue, uint64_t wait, - odp_buffer_t out_buf[], unsigned int num) + odp_event_t events[], unsigned int num) { - return schedule_loop(out_queue, wait, out_buf, num, MAX_DEQ); + return schedule_loop(out_queue, wait, (odp_buffer_t *)events, num, MAX_DEQ); } diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index 09f5db1..7a48eed 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -481,7 +481,7 @@ static int test_schedule_multi(const char *str, int thr, odp_buffer_pool_t msg_pool, int prio, odp_barrier_t *barrier) { - odp_buffer_t buf[MULTI_BUFS_MAX]; + odp_event_t ev[MULTI_BUFS_MAX]; odp_queue_t queue; uint64_t t1 = 0; uint64_t t2 = 0; @@ -508,16 +508,20 @@ static int test_schedule_multi(const char *str, int thr, } for (j = 0; j < MULTI_BUFS_MAX; j++) { - buf[j] = odp_buffer_alloc(msg_pool); + odp_buffer_t buf; - if (!odp_buffer_is_valid(buf[j])) { + buf = odp_buffer_alloc(msg_pool); + + if (!odp_buffer_is_valid(buf)) { LOG_ERR(" [%i] msg_pool alloc failed\n", thr); return -1; } + + ev[j] = odp_buffer_to_event(buf); } - if (odp_queue_enq_multi(queue, buf, MULTI_BUFS_MAX)) { + if (odp_queue_enq_multi(queue, ev, MULTI_BUFS_MAX)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } @@ -527,22 +531,22 @@ static int test_schedule_multi(const char *str, int thr, t1 = odp_time_cycles(); for (i = 0; i < QUEUE_ROUNDS; i++) { - num = odp_schedule_multi(&queue, ODP_SCHED_WAIT, buf, + num = odp_schedule_multi(&queue, ODP_SCHED_WAIT, ev, MULTI_BUFS_MAX); tot += num; - if (odp_queue_enq_multi(queue, buf, num)) { + if (odp_queue_enq_multi(queue, ev, num)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } - /* Clear possible locally stored buffers */ + /* Clear possible locally stored events */ odp_schedule_pause(); while (1) { - num = odp_schedule_multi(&queue, ODP_SCHED_NO_WAIT, buf, + num = odp_schedule_multi(&queue, ODP_SCHED_NO_WAIT, ev, MULTI_BUFS_MAX); if (num == 0) @@ -550,7 +554,7 @@ static int test_schedule_multi(const char *str, int thr, tot += num; - if (odp_queue_enq_multi(queue, buf, num)) { + if (odp_queue_enq_multi(queue, ev, num)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index b404a14..16e85fa 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -300,7 +300,7 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b, int num_pkts) { odp_packet_t tx_pkt[num_pkts]; - odp_buffer_t tx_buf[num_pkts]; + odp_event_t tx_ev[num_pkts]; odp_packet_t rx_pkt; uint32_t tx_seq[num_pkts]; int i, ret; @@ -319,7 +319,7 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b, if (pktio_fixup_checksums(tx_pkt[i]) != 0) break; - tx_buf[i] = odp_packet_to_buffer(tx_pkt[i]); + tx_ev[i] = odp_packet_to_event(tx_pkt[i]); } if (i != num_pkts) { @@ -329,9 +329,9 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b, /* send packet(s) out */ if (num_pkts == 1) - ret = odp_queue_enq(pktio_a->outq, odp_buffer_to_event(tx_buf[0])); + ret = odp_queue_enq(pktio_a->outq, tx_ev[0]); else - ret = odp_queue_enq_multi(pktio_a->outq, tx_buf, num_pkts); + ret = odp_queue_enq_multi(pktio_a->outq, tx_ev, num_pkts); if (ret != 0) { CU_FAIL("failed to enqueue test packets"); diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c index a083c26..7c5e8dd 100644 --- a/test/validation/odp_queue.c +++ b/test/validation/odp_queue.c @@ -35,7 +35,8 @@ static int init_queue_suite(void) static void test_odp_queue_sunnyday(void) { odp_queue_t queue_creat_id, queue_id; - odp_buffer_t enbuf[MAX_BUFFER_QUEUE], debuf[MAX_BUFFER_QUEUE]; + odp_event_t enev[MAX_BUFFER_QUEUE]; + odp_buffer_t debuf[MAX_BUFFER_QUEUE]; odp_buffer_t buf; odp_buffer_pool_t msg_pool; odp_queue_param_t param; @@ -72,14 +73,16 @@ static void test_odp_queue_sunnyday(void) CU_ASSERT_EQUAL(buf, odp_queue_deq(queue_id)); odp_buffer_free(buf); - for (i = 0; i < MAX_BUFFER_QUEUE; i++) - enbuf[i] = odp_buffer_alloc(msg_pool); + for (i = 0; i < MAX_BUFFER_QUEUE; i++) { + odp_buffer_t buf = odp_buffer_alloc(msg_pool); + enev[i] = odp_buffer_to_event(buf); + } /* * odp_queue_enq_multi may return 0..n buffers due to the resource * constraints in the implementation at that given point of time. */ - ret = odp_queue_enq_multi(queue_id, enbuf, MAX_BUFFER_QUEUE); + ret = odp_queue_enq_multi(queue_id, enev, MAX_BUFFER_QUEUE); CU_ASSERT(0 == ret); pbuf_tmp = debuf; do { @@ -92,8 +95,9 @@ static void test_odp_queue_sunnyday(void) } while (nr_deq_entries < MAX_BUFFER_QUEUE); for (i = 0; i < MAX_BUFFER_QUEUE; i++) { - CU_ASSERT_EQUAL(enbuf[i], debuf[i]); - odp_buffer_free(enbuf[i]); + odp_buffer_t enbuf = odp_buffer_from_event(enev[i]); + CU_ASSERT_EQUAL(enbuf, debuf[i]); + odp_buffer_free(enbuf); } return; diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c index 8f33f69..74f9b6f 100644 --- a/test/validation/odp_schedule.c +++ b/test/validation/odp_schedule.c @@ -117,16 +117,18 @@ static void *schedule_common_(void *arg) odp_ticketlock_unlock(&globals->count_lock); if (args->enable_schd_multi) { - odp_buffer_t bufs[BURST_BUF_SIZE]; + odp_event_t events[BURST_BUF_SIZE]; int j; - num = odp_schedule_multi(&from, ODP_SCHED_NO_WAIT, bufs, - BURST_BUF_SIZE); + num = odp_schedule_multi(&from, ODP_SCHED_NO_WAIT, + events, BURST_BUF_SIZE); CU_ASSERT(num >= 0); CU_ASSERT(num <= BURST_BUF_SIZE); if (num == 0) continue; - for (j = 0; j < num; j++) - odp_buffer_free(bufs[j]); + for (j = 0; j < num; j++) { + buf = odp_buffer_from_event(events[j]); + odp_buffer_free(buf); + } } else { ev = odp_schedule(&from, ODP_SCHED_NO_WAIT); buf = odp_buffer_from_event(ev);