From patchwork Wed Feb 21 11:59:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129048 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp548614ljc; Wed, 21 Feb 2018 04:09:59 -0800 (PST) X-Google-Smtp-Source: AH8x224kMb1VnUjvuAiNVjCFRBKSwRejyVrQp6HOXAZ76MBx3lQy7Xpnv3EO062BljjnAwzqXFf+ X-Received: by 10.200.41.18 with SMTP id y18mr5031320qty.181.1519214999164; Wed, 21 Feb 2018 04:09:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519214999; cv=none; d=google.com; s=arc-20160816; b=EIK5sAku2FPq5SJ+olkIcXEhCOTqLofBs2E1LMNfNxl9Wuj6urLos9cPLdthTlAvq2 NLOG/XGLN24wIzGl3QTXhS9H/jeh8Y2BcgmTvFEbxiix4QZfina95JXtT6I7wIOoF4AW fBQh+OedNIhotaYQf7J1x6dcJAPn+A4WnA9GY5qJ7Tm7NSZ979twpEKlhUFhVGIN6GkR RI+85FTqCwz0ucMusnH2UxPYA9zjvGFNoJmgvKXa4BnvOr4CkDXai67R1jlagbplWRUI vDTMvjG6Z8Mrh2aJxplYIoTjQMj+44wMZps/R4XdyCeX5+XvouMbLvfQR1H6fC/RVE2c P+RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=NdtJ1aXwjxNFRe7hf/Bng3JRhk8yeBMoEvr4mWHxT4E=; b=VmOW7hyMkkzzBwx0/DLUg8a3aGP0Fy/apb2KZDz9LycK9syIopJXjFew2lNjLmzitx e2iAqHJdFpnhplg/+L54U5U9CA6U4ij29WhgzXGerZ+8K9dRryPuC+wNLG02p0DQAPsD LnqltQVtlhF5MVqmwFIriH6iZ0n7/Y0FZUT8bXR4Ymr0ONVEFdp+0C6VqEZyIaXH3YTM fRqLipYpt6LOFoN1KvRGCayY6i4oX0RpNPNLWpsEVcC5py9sxYgkpACiMOUjimvSx5An u4Hk0IbOHYlvBxqZG0MBmPeTPaq2mM6LNWf6/jvzGOGwHGRW1iTX4jgNlkUr8ruISsty 0t/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id y186si378083qkd.306.2018.02.21.04.09.58; Wed, 21 Feb 2018 04:09:59 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id D3B586176B; Wed, 21 Feb 2018 12:09:58 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 4561A6173E; Wed, 21 Feb 2018 12:02:33 +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 C141260750; Wed, 21 Feb 2018 12:02:06 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 38A4060750 for ; Wed, 21 Feb 2018 12:01:08 +0000 (UTC) Received: from mxback7g.mail.yandex.net (mxback7g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:168]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 723B55105B29 for ; Wed, 21 Feb 2018 15:00:09 +0300 (MSK) Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [2a02:6b8:0:801::ac]) by mxback7g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id LtX1oeOB62-09dOqIOg; Wed, 21 Feb 2018 15:00:09 +0300 Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id a6UlmCoovI-08v8LoHk; Wed, 21 Feb 2018 15:00:08 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 14:59:58 +0300 Message-Id: <1519214407-28047-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> References: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 492 Subject: [lng-odp] [PATCH v1 1/10] linux-gen: queue: inline queue from index conversion X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Inline queue handle from queue index conversion function. Signed-off-by: Petri Savolainen --- /** Email created from pull request 492 (psavol:master-sched-optim) ** https://github.com/Linaro/odp/pull/492 ** Patch: https://github.com/Linaro/odp/pull/492.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: 82a6bfe942419330a430b63149220e6b472f419c **/ .../linux-generic/include/odp_queue_internal.h | 7 ++++- platform/linux-generic/odp_queue.c | 30 +++++++--------------- platform/linux-generic/odp_schedule.c | 5 +--- platform/linux-generic/odp_schedule_iquery.c | 2 +- platform/linux-generic/odp_schedule_sp.c | 3 ++- 5 files changed, 19 insertions(+), 28 deletions(-) diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index 158b1d5f1..6fe3fb462 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -62,11 +62,16 @@ union queue_entry_u { uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct queue_entry_s))]; }; -static inline uint32_t queue_to_id(odp_queue_t handle) +static inline uint32_t queue_to_index(odp_queue_t handle) { return _odp_typeval(handle) - 1; } +static inline odp_queue_t queue_from_index(uint32_t queue_id) +{ + return _odp_cast_scalar(odp_queue_t, queue_id + 1); +} + static inline queue_entry_t *qentry_from_int(queue_t q_int) { return (queue_entry_t *)(void *)(q_int); diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 58103930c..21135df63 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -45,26 +45,19 @@ typedef struct queue_table_t { static queue_table_t *queue_tbl; -static -queue_entry_t *get_qentry(uint32_t queue_id); +static queue_entry_t *get_qentry(uint32_t queue_id); -static inline queue_entry_t *handle_to_qentry(odp_queue_t handle) +static inline queue_entry_t *get_qentry(uint32_t queue_id) { - uint32_t queue_id; - - queue_id = queue_to_id(handle); - return get_qentry(queue_id); + return &queue_tbl->queue[queue_id]; } -static inline odp_queue_t queue_from_id(uint32_t queue_id) +static inline queue_entry_t *handle_to_qentry(odp_queue_t handle) { - return _odp_cast_scalar(odp_queue_t, queue_id + 1); -} + uint32_t queue_id; -static -queue_entry_t *get_qentry(uint32_t queue_id) -{ - return &queue_tbl->queue[queue_id]; + queue_id = queue_to_index(handle); + return get_qentry(queue_id); } static int queue_init_global(void) @@ -90,7 +83,7 @@ static int queue_init_global(void) queue_entry_t *queue = get_qentry(i); LOCK_INIT(&queue->s.lock); queue->s.index = i; - queue->s.handle = queue_from_id(i); + queue->s.handle = queue_from_index(i); } ODP_DBG("done\n"); @@ -620,7 +613,7 @@ static int queue_info(odp_queue_t handle, odp_queue_info_t *info) return -1; } - queue_id = queue_to_id(handle); + queue_id = queue_to_index(handle); if (odp_unlikely(queue_id >= ODP_CONFIG_QUEUES)) { ODP_ERR("Invalid queue handle:%" PRIu64 "\n", @@ -648,11 +641,6 @@ static int queue_info(odp_queue_t handle, odp_queue_info_t *info) return 0; } -odp_queue_t sched_cb_queue_handle(uint32_t queue_index) -{ - return queue_from_id(queue_index); -} - int sched_cb_queue_deq_multi(uint32_t queue_index, odp_event_t ev[], int num) { queue_entry_t *qe = get_qentry(queue_index); diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 118f9eb17..0a12487e9 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -25,10 +25,7 @@ #include #include #include - -/* Should remove this dependency */ #include -#include /* Number of priority levels */ #define NUM_PRIO 8 @@ -876,7 +873,7 @@ static inline int do_schedule_grp(odp_queue_t *out_queue, odp_event_t out_ev[], continue; } - handle = sched_cb_queue_handle(qi); + handle = queue_from_index(qi); sched_local.num = num; sched_local.index = 0; sched_local.queue = handle; diff --git a/platform/linux-generic/odp_schedule_iquery.c b/platform/linux-generic/odp_schedule_iquery.c index 33767c1f8..c41eb857d 100644 --- a/platform/linux-generic/odp_schedule_iquery.c +++ b/platform/linux-generic/odp_schedule_iquery.c @@ -1529,7 +1529,7 @@ static inline int consume_queue(int prio, unsigned int queue_index) cache->top = &cache->stash[0]; cache->count = count; - cache->queue = sched_cb_queue_handle(queue_index); + cache->queue = queue_from_index(queue_index); return count; } diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index 017eaee34..01a3d4948 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -18,6 +18,7 @@ #include #include #include +#include #define NUM_THREAD ODP_THREAD_COUNT_MAX #define NUM_QUEUE ODP_CONFIG_QUEUES @@ -564,7 +565,7 @@ static int schedule_multi(odp_queue_t *from, uint64_t wait, sched_local.cmd = cmd; if (from) - *from = sched_cb_queue_handle(qi); + *from = queue_from_index(qi); return num; } From patchwork Wed Feb 21 11:59:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129041 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp541971ljc; Wed, 21 Feb 2018 04:03:43 -0800 (PST) X-Google-Smtp-Source: AG47ELtYT18Yk9dkFxFJQfdl7g/4CFnWBTAGbhYn3pVHeC7rYfSl6WvEU2JVhcCfI4ohOlGKEQIX X-Received: by 10.55.125.65 with SMTP id y62mr145608qkc.241.1519214623023; Wed, 21 Feb 2018 04:03:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519214623; cv=none; d=google.com; s=arc-20160816; b=yNrgJKKFSTdbc35jQpHHEJvRmBqRJlJd8TbQAyxB8x9GE3aKlYNbKQS90DZ6liTrQv I+LEUk1BGT7PZli7A7GGzX+O1+Oqq8yquHp+x4PGmcE7B77/EXTqR7zM5YLvzm5f/7hV OGYU8mUW7szM80aR7XxDllC/20Ur0YLGvoCZHIO3FqGIJbna2WEbRdWmiU1lGtqbB2vP yBVizEyfPyYFtqeYlL0VKYiLQ381rUqkQq/+t24lUs0IbEBMo6UtrGVMLsGMiHAkTzC8 1VHPyR2WrV7H+3G8sGp10D2Mj/xDThXe1QcjEyqVcs00cJj5P/22yTrwp+OThfBTS+kH NkFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=Vnrp8hQIQ2srp39qhZBDL5h7Fft4Ntl0HV/trxHgo5I=; b=Wd3OVMy6yofm86kpFKaPBfOoZAJm+jY3dZXGPQNJv5B+/sSU4sd0GcMfUH24oX3Twg M8FkPZlseQNZsmf21rhQEgpIAJHCHhun/Qac5XajdRsD/OV/LYmbYB+YyciD5sDZi4OD mxAast8EH9EpvcvyfQyDwJLIeUTyxeveq//Td+vYM5b342eS2X21qS5XcBxccGzq1b5m G2/ymRL7IxJ4U4xIBwYDksEqOfbaLigolBXki0ZkUfSpAnh0K4gU4srCCZShykOvlk0T vl+eYGdWUrjjmqKMJxZuBg0abGF++pYChmPsSR/WkGCTRBYoLQgeLCrTYMhJs8sUmThi uRdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id 200si3213825qkn.115.2018.02.21.04.03.42; Wed, 21 Feb 2018 04:03:42 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id AE9FF61789; Wed, 21 Feb 2018 12:03:42 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 2B8FD60C40; Wed, 21 Feb 2018 12:01:59 +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 2A62A61522; Wed, 21 Feb 2018 12:01:43 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id CD2286171C for ; Wed, 21 Feb 2018 12:00:11 +0000 (UTC) Received: from mxback19j.mail.yandex.net (mxback19j.mail.yandex.net [IPv6:2a02:6b8:0:1619::95]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 71314124451A for ; Wed, 21 Feb 2018 15:00:10 +0300 (MSK) Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [2a02:6b8:0:801::ac]) by mxback19j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id qbzXLSlvy0-0AJaKbbX; Wed, 21 Feb 2018 15:00:10 +0300 Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id a6UlmCoovI-09v8826m; Wed, 21 Feb 2018 15:00:09 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 14:59:59 +0300 Message-Id: <1519214407-28047-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> References: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 492 Subject: [lng-odp] [PATCH v1 2/10] linux-gen: ring_st: ring for single thread usage X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen This ring can be used as simple FIFO when enqueue / dequeue operation synchronization is not needed, or synchronization is provided by an upper layer already. Signed-off-by: Petri Savolainen --- /** Email created from pull request 492 (psavol:master-sched-optim) ** https://github.com/Linaro/odp/pull/492 ** Patch: https://github.com/Linaro/odp/pull/492.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: 82a6bfe942419330a430b63149220e6b472f419c **/ platform/linux-generic/Makefile.am | 3 +- .../linux-generic/include/odp_ring_st_internal.h | 118 +++++++++++++++++++++ 2 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 platform/linux-generic/include/odp_ring_st_internal.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 7f212fe5e..5250709bf 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -111,8 +111,9 @@ noinst_HEADERS = \ include/odp_posix_extensions.h \ include/odp_queue_internal.h \ include/odp_queue_scalable_internal.h \ - include/odp_ring_internal.h \ include/odp_queue_if.h \ + include/odp_ring_internal.h \ + include/odp_ring_st_internal.h \ include/odp_schedule_if.h \ include/odp_schedule_scalable.h \ include/odp_schedule_scalable_config.h \ diff --git a/platform/linux-generic/include/odp_ring_st_internal.h b/platform/linux-generic/include/odp_ring_st_internal.h new file mode 100644 index 000000000..8b6e102b3 --- /dev/null +++ b/platform/linux-generic/include/odp_ring_st_internal.h @@ -0,0 +1,118 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef ODP_RING_ST_INTERNAL_H_ +#define ODP_RING_ST_INTERNAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* Basic ring for single thread usage. Operations must be synchronized by using + * locks (or other means), when multiple threads use the same ring. */ +typedef struct { + uint32_t head; + uint32_t tail; + uint32_t mask; + uint32_t *data; + +} ring_st_t; + +/* Initialize ring. Ring size must be a power of two. */ +static inline void ring_st_init(ring_st_t *ring, uint32_t *data, uint32_t size) +{ + ring->head = 0; + ring->tail = 0; + ring->mask = size - 1; + ring->data = data; +} + +/* Dequeue data from the ring head. Max_num is smaller than ring size.*/ +static inline uint32_t ring_st_deq_multi(ring_st_t *ring, uint32_t data[], + uint32_t max_num) +{ + uint32_t head, tail, mask, idx; + uint32_t num, i; + + head = ring->head; + tail = ring->tail; + mask = ring->mask; + num = tail - head; + + /* Empty */ + if (num == 0) + return 0; + + if (num > max_num) + num = max_num; + + idx = head & mask; + + for (i = 0; i < num; i++) { + data[i] = ring->data[idx]; + idx = (idx + 1) & mask; + } + + ring->head = head + num; + + return num; +} + +/* Enqueue data into the ring tail. Num_data is smaller than ring size. */ +static inline uint32_t ring_st_enq_multi(ring_st_t *ring, const uint32_t data[], + uint32_t num_data) +{ + uint32_t head, tail, mask, size, idx; + uint32_t num, i; + + head = ring->head; + tail = ring->tail; + mask = ring->mask; + size = mask + 1; + num = size - (tail - head); + + /* Full */ + if (num == 0) + return 0; + + if (num > num_data) + num = num_data; + + idx = tail & mask; + + for (i = 0; i < num; i++) { + ring->data[idx] = data[i]; + idx = (idx + 1) & mask; + } + + ring->tail = tail + num; + + return num; +} + +/* Check if ring is empty */ +static inline int ring_st_is_empty(ring_st_t *ring) +{ + uint32_t head, tail, num; + + head = ring->head; + tail = ring->tail; + num = tail - head; + + if (num == 0) + return 1; + + return 0; +} + +#ifdef __cplusplus +} +#endif + +#endif From patchwork Wed Feb 21 12:00:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129040 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp541227ljc; Wed, 21 Feb 2018 04:03:03 -0800 (PST) X-Google-Smtp-Source: AG47ELs25CmKzG+aB6x5picQjj7jv0Zdu9Wku2KyNyJYWdvmkxW30NB083CnQtg9xO9hLbBwrJHj X-Received: by 10.55.120.5 with SMTP id t5mr4491879qkc.14.1519214583626; Wed, 21 Feb 2018 04:03:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519214583; cv=none; d=google.com; s=arc-20160816; b=dcTj7maz098TiMEgN7k6M8i0QvOHEB/bF7zbRP0j+PiZcf09yKPryD3G0ME8BiUHjk rnrHKf9F3OSU/gAb+jz5rDoCUxe3qRv/mU0KYivqh9YaN6vHQHFhyEOn9DvLBwp/Y2R6 pS3AAcvoA85UsHJ10sIINxdOi2H83sNaxbry6SfKHckbKvp5IcieBPmCYH5B0/9LB8Oa Nmtzt0++mO+hIuVSSNU71ELmgCPqI7NtmmgX5pwCeByaNQwW1QBiSpO3asOtrvJEKlAQ h7dmqy9gWfI9eb/EYJ5fS8MtjOQNYxzNJm2asufVQA3zxgTm9diHhkLi7ar/bMt9UImr z1KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=jWPwjOsSFUrEP+aaYY+apb2nI4Zv3bODm9C76yGMHco=; b=T75SlC25PU63RxGTEs5fiRrd114cdMREJvbCAIvCK5aGYC8KJddTXaOZbvKFBEbptX /l2X0Gx8cZboBEJYoHtIbWW5YOP0c56QDPlumjqHM58aFMiAnWUV8lCKvpyq21BVUtUo yIHbEFa0SbvX+kpxhgo8y0+KU8+WTbai08GzhCDU1PY/60k30j2vg8LLQnBl6/Rl0dDF VU1gr2L627d/DrlrHY5qZl3iEn10QkpEXFco+Wq7NjqC5j5gD6OdMboXR9cUBGfcLHaD 1SMQFd2xD6btsr+5KF+HRyFk0GnYUs+mYgV8K1KSP/+S3Rsi5szTtNStLXKzobOZub5A 9WHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id t67si1318172qkt.43.2018.02.21.04.03.03; Wed, 21 Feb 2018 04:03:03 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 4612A61522; Wed, 21 Feb 2018 12:03:03 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 D8E69607BE; Wed, 21 Feb 2018 12:01:54 +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 E623B61514; Wed, 21 Feb 2018 12:01:41 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id 7A55561724 for ; Wed, 21 Feb 2018 12:00:12 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 68C7A1245B99 for ; Wed, 21 Feb 2018 15:00:11 +0300 (MSK) Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [2a02:6b8:0:801::ac]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id EUsslnT5mP-0BWmwoDG; Wed, 21 Feb 2018 15:00:11 +0300 Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id a6UlmCoovI-0AvaIBZJ; Wed, 21 Feb 2018 15:00:10 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 15:00:00 +0300 Message-Id: <1519214407-28047-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> References: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 492 Subject: [lng-odp] [PATCH v1 3/10] helper: cuckoo: check pool and queue limits X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Use capability to check if pool and queue can hold enough events. Also lower test case resource requirement. Signed-off-by: Petri Savolainen --- /** Email created from pull request 492 (psavol:master-sched-optim) ** https://github.com/Linaro/odp/pull/492 ** Patch: https://github.com/Linaro/odp/pull/492.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: 82a6bfe942419330a430b63149220e6b472f419c **/ helper/cuckootable.c | 22 ++++++++++++++++++++++ helper/test/cuckootable.c | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/helper/cuckootable.c b/helper/cuckootable.c index 29298d42d..5fe0034c0 100644 --- a/helper/cuckootable.c +++ b/helper/cuckootable.c @@ -184,6 +184,8 @@ odph_cuckoo_table_create( odp_queue_t queue; odp_queue_param_t qparam; + odp_queue_capability_t qcapa; + odp_pool_capability_t pcapa; char pool_name[ODPH_TABLE_NAME_LEN + 3], queue_name[ODPH_TABLE_NAME_LEN + 3]; @@ -191,6 +193,26 @@ odph_cuckoo_table_create( uint32_t impl_size, kv_entry_size, bucket_num, bucket_size; + if (odp_queue_capability(&qcapa)) { + ODPH_DBG("queue capa failed\n"); + return NULL; + } + + if (qcapa.plain.max_size && qcapa.plain.max_size < capacity) { + ODPH_DBG("queue max_size too small\n"); + return NULL; + } + + if (odp_pool_capability(&pcapa)) { + ODPH_DBG("pool capa failed\n"); + return NULL; + } + + if (pcapa.buf.max_num && pcapa.buf.max_num < capacity) { + ODPH_DBG("pool max_num too small\n"); + return NULL; + } + /* Check for valid parameters */ if ( (capacity > HASH_ENTRIES_MAX) || diff --git a/helper/test/cuckootable.c b/helper/test/cuckootable.c index ebe791678..71c82cdc8 100644 --- a/helper/test/cuckootable.c +++ b/helper/test/cuckootable.c @@ -429,7 +429,7 @@ static int test_creation_with_bad_parameters(void) return 0; } -#define PERFORMANCE_CAPACITY 1000000 +#define PERFORMANCE_CAPACITY 4000 /* * Test the performance of cuckoo hash table. From patchwork Wed Feb 21 12:00:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129043 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp543851ljc; Wed, 21 Feb 2018 04:05:23 -0800 (PST) X-Google-Smtp-Source: AH8x226NN5PPGShepLcdCj6m2SndI9wsUyuSevJcuK2bRvmnJOk1fjy6OJy2TWhYG/wwG3akLyof X-Received: by 2002:a25:a108:: with SMTP id z8-v6mr897877ybh.452.1519214723456; Wed, 21 Feb 2018 04:05:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519214723; cv=none; d=google.com; s=arc-20160816; b=bM96OBhZYAKphcaLjBK5U8rgYRJY2uMOZFIO207zidGh6KPQeibVzzGZ/ph/je82Sk bePWlXFX0uYdEkshN4L0w/UdORacyzkCq0/VmJrWaFNnK+ud8Vh8Q6phUMQGHHdpByFA dsY50CCp5kJaXJ7iCdrwetUz1Posi7fnBO3pOiRldAhyooi8DM7zoLPrjQhCF5BxlhuE WGi8Xka52FB1D8RW+lon4J/VDjuV7wvE8t37irruVJt8VVP9/stWvsa8HY5F59AXuv0V w7vb2d4j05UujLUeY0vIHeQcBfy0O+Lvl+2MJMrSIH50ielkQB3RoQJIQ7nbHdKfsw2m EWgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=JXaDrqExLElfUcXycoBtWeR+bwdbzi5eFY00+VI/xbM=; b=JdO4dsRgjB2EoOKGIqgwNjddpVfll8Jv7R3QrtPqCRK9IUwK403IXZvFeIa8aPGGUt m15EA8FkxJdiVTTlXu5Ec7Wzl1RjQT53TWqUGPX59x9S9KnyX14qYCGk4vlc4J1nFdbj CGH2+dq1i5B3hD/IRSrNCL8DQN7BPmzeMDj3hRMU+ZBVYWSVuRhPLRakG97dpwirHXw5 w/onel2N3XbGZwmh+/53l+tXvjwfC2+yQb7HZYOk7bBIApHjIMtYuFTGQOoIBaphyu+8 OULbpN7WdfXVpSLqbC82Yd66cFRD2FY0hBp4NI1FvCsoNoHk379+bZRZkVLXxJst9IHa HKmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id y44si3167036qth.38.2018.02.21.04.05.23; Wed, 21 Feb 2018 04:05:23 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 2294461728; Wed, 21 Feb 2018 12:05:23 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 D0D31616F3; Wed, 21 Feb 2018 12:02: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 CE72560C40; Wed, 21 Feb 2018 12:01:49 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id E59A761728 for ; Wed, 21 Feb 2018 12:00:14 +0000 (UTC) Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward106o.mail.yandex.net (Yandex) with ESMTP id F335C782789 for ; Wed, 21 Feb 2018 15:00:11 +0300 (MSK) Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [2a02:6b8:0:801::ac]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id CPKMVERsyM-0BbSVx7o; Wed, 21 Feb 2018 15:00:11 +0300 Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id a6UlmCoovI-0BviwwqU; Wed, 21 Feb 2018 15:00:11 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 15:00:01 +0300 Message-Id: <1519214407-28047-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> References: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 492 Subject: [lng-odp] [PATCH v1 4/10] validation: sched: honour max queue size X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen When needed, scale down atomic queue size requirement to maximum queue size capability. Signed-off-by: Petri Savolainen --- /** Email created from pull request 492 (psavol:master-sched-optim) ** https://github.com/Linaro/odp/pull/492 ** Patch: https://github.com/Linaro/odp/pull/492.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: 82a6bfe942419330a430b63149220e6b472f419c **/ test/validation/api/scheduler/scheduler.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index 9d1e08ca1..d95766734 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -57,6 +57,7 @@ typedef struct { odp_barrier_t barrier; int buf_count; int buf_count_cpy; + uint32_t max_sched_queue_size; odp_ticketlock_t lock; odp_spinlock_t atomic_lock; struct { @@ -1060,7 +1061,7 @@ static void parallel_execute(odp_schedule_sync_t sync, int num_queues, args->num_queues = num_queues; args->num_prio = num_prio; if (enable_excl_atomic) - args->num_bufs = BUFS_PER_QUEUE_EXCL; + args->num_bufs = globals->max_sched_queue_size; else args->num_bufs = BUFS_PER_QUEUE; args->num_workers = globals->num_workers; @@ -1405,7 +1406,7 @@ static void scheduler_test_ordered_lock(void) CU_ASSERT(ret == 0); } -static int create_queues(void) +static int create_queues(test_globals_t *globals) { int i, j, prios, rc; odp_queue_capability_t capa; @@ -1427,6 +1428,12 @@ static int create_queues(void) capa.max_ordered_locks); } + globals->max_sched_queue_size = BUFS_PER_QUEUE_EXCL; + if (capa.sched.max_size && capa.sched.max_size < BUFS_PER_QUEUE_EXCL) { + printf("Max sched queue size %u\n", capa.sched.max_size); + globals->max_sched_queue_size = capa.sched.max_size; + } + prios = odp_schedule_num_prio(); odp_pool_param_init(¶ms); params.buf.size = sizeof(queue_context); @@ -1455,17 +1462,17 @@ static int create_queues(void) q = odp_queue_create(name, &p); if (q == ODP_QUEUE_INVALID) { - printf("Schedule queue create failed.\n"); + printf("Parallel queue create failed.\n"); return -1; } snprintf(name, sizeof(name), "sched_%d_%d_a", i, j); p.sched.sync = ODP_SCHED_SYNC_ATOMIC; - p.size = BUFS_PER_QUEUE_EXCL; + p.size = globals->max_sched_queue_size; q = odp_queue_create(name, &p); if (q == ODP_QUEUE_INVALID) { - printf("Schedule queue create failed.\n"); + printf("Atomic queue create failed.\n"); return -1; } @@ -1501,7 +1508,7 @@ static int create_queues(void) q = odp_queue_create(name, &p); if (q == ODP_QUEUE_INVALID) { - printf("Schedule queue create failed.\n"); + printf("Ordered queue create failed.\n"); return -1; } if (odp_queue_lock_count(q) != @@ -1598,7 +1605,7 @@ static int scheduler_suite_init(void) odp_ticketlock_init(&globals->lock); odp_spinlock_init(&globals->atomic_lock); - if (create_queues() != 0) + if (create_queues(globals) != 0) return -1; return 0; From patchwork Wed Feb 21 12:00:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129042 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp542874ljc; Wed, 21 Feb 2018 04:04:31 -0800 (PST) X-Google-Smtp-Source: AH8x227IGUQX0HgQdC1o+yx1BAo4I3t0Meupp8is0o29APp675jUkGRO7fFZziQCnSptiqk94Hcf X-Received: by 10.200.55.81 with SMTP id p17mr5092639qtb.282.1519214671229; Wed, 21 Feb 2018 04:04:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519214671; cv=none; d=google.com; s=arc-20160816; b=QDuFUYJ6uttiUd87Jh9WzWvJygzCdrkJbOOcb0llM3OxN5BxnnBfBHjKCdBr9WUKm9 lZ5owY+U1V0VNHDfTs0osuDn/FHkzHxghLWjVMU1Vm4s2RnRC31m7pipAzlSm6jWvvYj 8514z3JvHpJ+2O7y7jkCUetCQzkXtxGe3ojbR6rKBFSTdbhDKYtsa0GB08fMO8eXLZ+n +6wKM1HPjSDqnllwkKITcGo8hl+M0HAuNorzyaAHpzp71uTDHrdaaSMrmPSS2sNpdSaH VNkkxBKGgXqRr7ubjn/m2dXnHftHkVQVepABqZBZI2PVZHZ9jqDAOSrQSzFjWLdq9GbE Q9Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=P/scWgS2exPTRxmv+s9nfRz+Ad/q40XGrWOtDsOfkrQ=; b=piy8xj3vhzqQAeXwbMkJsFI6xHoy1JcuSPalyDSyuU7VPFrIsO/LMQWX5kXM8znrei gpMsA5BPNRAcu2kK57ETNOIrJuTsNRaNkF1z9VQSJQ1CmLbhOpAF257WmUgFb2gvGPUw CIxnb5ZUgEr1RZFDdwf9dCnFC9yK2f0q0U29JYysGex0YbeqvHJOnEGnOi6yna/kRPgN 8kdqG/V0RhYu1YKxZWbKND08p9t/XLT1R2lVkCjJvPzXcjBl7jO14dvT3YmCmLQYCDYZ TqCUR3NCqOP0rucjk+Rbc5Y6ImJupYWUKPV+HaSNixgfPuNRj2OcULEWI8kSod8C9cr4 MdJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id q15si2299706qtg.158.2018.02.21.04.04.30; Wed, 21 Feb 2018 04:04:31 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id E3F616170D; Wed, 21 Feb 2018 12:04:30 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 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 84DE8607F9; Wed, 21 Feb 2018 12:02:06 +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 CFCD461519; Wed, 21 Feb 2018 12:01:44 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id AD34460C48 for ; Wed, 21 Feb 2018 12:00:14 +0000 (UTC) Received: from mxback14j.mail.yandex.net (mxback14j.mail.yandex.net [IPv6:2a02:6b8:0:1619::90]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 43C0545247 for ; Wed, 21 Feb 2018 15:00:13 +0300 (MSK) Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [2a02:6b8:0:801::ac]) by mxback14j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id CTuj4R8imy-0DMm6P93; Wed, 21 Feb 2018 15:00:13 +0300 Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id a6UlmCoovI-0CvOuTPa; Wed, 21 Feb 2018 15:00:12 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 15:00:02 +0300 Message-Id: <1519214407-28047-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> References: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 492 Subject: [lng-odp] [PATCH v1 5/10] test: pktio_ordered: honour max queue size X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Limit maximum number of events to maximum pool and queue capability when needed. Pool size should not be larger than queue size as test run in validation suite suffers from queue enqueue failures (queue full) and sequence number checking does not pass due to that. Signed-off-by: Petri Savolainen --- /** Email created from pull request 492 (psavol:master-sched-optim) ** https://github.com/Linaro/odp/pull/492 ** Patch: https://github.com/Linaro/odp/pull/492.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: 82a6bfe942419330a430b63149220e6b472f419c **/ test/performance/odp_pktio_ordered.c | 44 +++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c index db9bfe764..0a1c556cc 100644 --- a/test/performance/odp_pktio_ordered.c +++ b/test/performance/odp_pktio_ordered.c @@ -75,12 +75,12 @@ #define JHASH_GOLDEN_RATIO 0x9e3779b9 +/* Maximum pool and queue size */ +#define MAX_NUM_PKT (8 * 1024) + /** Maximum number of worker threads */ #define MAX_WORKERS 64 -/** Number of packet buffers in the memory pool */ -#define PKT_POOL_SIZE 8192 - /** Buffer size of the packet pool buffer in bytes*/ #define PKT_POOL_BUF_SIZE 1856 @@ -93,9 +93,6 @@ /** Maximum number of pktio queues per interface */ #define MAX_QUEUES 32 -/** Seems to need at least 8192 elements per queue */ -#define QUEUE_SIZE 8192 - /** Maximum number of pktio interfaces */ #define MAX_PKTIOS 8 @@ -1074,7 +1071,8 @@ int main(int argc, char *argv[]) odp_pool_t pool; odp_pool_param_t params; odp_shm_t shm; - odp_queue_capability_t capa; + odp_queue_capability_t queue_capa; + odp_pool_capability_t pool_capa; odph_ethaddr_t new_addr; odph_odpthread_t thread_tbl[MAX_WORKERS]; stats_t *stats; @@ -1085,6 +1083,7 @@ int main(int argc, char *argv[]) int ret; int num_workers; int in_mode; + uint32_t queue_size, pool_size; /* Init ODP before calling anything else */ if (odp_init_global(&instance, NULL, NULL)) { @@ -1098,6 +1097,16 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } + if (odp_queue_capability(&queue_capa)) { + LOG_ERR("Error: Queue capa failed\n"); + exit(EXIT_FAILURE); + } + + if (odp_pool_capability(&pool_capa)) { + LOG_ERR("Error: Pool capa failed\n"); + exit(EXIT_FAILURE); + } + /* Reserve memory for args from shared mem */ shm = odp_shm_reserve("shm_args", sizeof(args_t), ODP_CACHE_LINE_SIZE, 0); @@ -1121,8 +1130,7 @@ int main(int argc, char *argv[]) if (gbl_args->appl.in_mode == SCHED_ORDERED) { /* At least one ordered lock required */ - odp_queue_capability(&capa); - if (capa.max_ordered_locks < 1) { + if (queue_capa.max_ordered_locks < 1) { LOG_ERR("Error: Ordered locks not available.\n"); exit(EXIT_FAILURE); } @@ -1145,11 +1153,25 @@ int main(int argc, char *argv[]) printf("First CPU: %i\n", odp_cpumask_first(&cpumask)); printf("CPU mask: %s\n\n", cpumaskstr); + pool_size = MAX_NUM_PKT; + if (pool_capa.pkt.max_num && pool_capa.pkt.max_num < MAX_NUM_PKT) + pool_size = pool_capa.pkt.max_num; + + queue_size = MAX_NUM_PKT; + if (queue_capa.sched.max_size && + queue_capa.sched.max_size < MAX_NUM_PKT) + queue_size = queue_capa.sched.max_size; + + /* Pool should not be larger than queue, otherwise queue enqueues at + * packet input may fail. */ + if (pool_size > queue_size) + pool_size = queue_size; + /* Create packet pool */ odp_pool_param_init(¶ms); params.pkt.seg_len = PKT_POOL_BUF_SIZE; params.pkt.len = PKT_POOL_BUF_SIZE; - params.pkt.num = PKT_POOL_SIZE; + params.pkt.num = pool_size; params.pkt.uarea_size = PKT_UAREA_SIZE; params.type = ODP_POOL_PACKET; @@ -1225,7 +1247,7 @@ int main(int argc, char *argv[]) qparam.sched.prio = ODP_SCHED_PRIO_DEFAULT; qparam.sched.sync = ODP_SCHED_SYNC_ATOMIC; qparam.sched.group = ODP_SCHED_GROUP_ALL; - qparam.size = QUEUE_SIZE; + qparam.size = queue_size; gbl_args->flow_qcontext[i][j].idx = i; gbl_args->flow_qcontext[i][j].input_queue = 0; From patchwork Wed Feb 21 12:00:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129046 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp546218ljc; Wed, 21 Feb 2018 04:07:40 -0800 (PST) X-Google-Smtp-Source: AH8x226VthHYjeWeGNSTbH0jpzfmRvyPUBRRx03yOwQgm45UNp3n4cCfiGzYg2ZscORcKGEfBS9S X-Received: by 10.55.11.65 with SMTP id 62mr4956269qkl.258.1519214860805; Wed, 21 Feb 2018 04:07:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519214860; cv=none; d=google.com; s=arc-20160816; b=u+QUOowneISC1cxvMmCptrywXLvEGBWFaRRkPdebTSwNyLvTKVdpYx3ATVgGz7qabR 8EFHtUUrtXEHcsHpezH5ugUANqcogQ1t3QB91KRHMeBYGZpk/2hBoNYGEv58p4e6Ni4c Gq1ekvlp5JgnXDcIk3J2Z3cvFMrsJ3+IlG360ymtPRq/J93sit90px1i/K8GYiiArx3R k/VYcwN4elnUov5LG4qJPD7o8R0CihEem27wU46VEVvaW9FmGq+f+dv5e/EwOShw/CVH t63WSJ7Hf1HLcvebp32Z63fqc55WqAZnmMSEHL3im6AAYpBciIf0yNfd/t3yDKH8ETcq 0XFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=ayXCK1oNiOhXeQkDDnSib42PHoyDCh1L0PGCX9cqpos=; b=QnR3FvQZwqU8grNqs7RdXwQ9w+ag5qr7Lx6NKlT+ujq6M5+JwAq8gmW5iwfla0vF1d bG9N2s3halXDHFbN1Jn6NkgaHIDsje53XY0ihMBWJixZfqY0lFXiSRiKyT5L0QBdF+iX DHmUZd7KkAIzfjENzj9A+nqAWH4FKWLRx3JWbWlREX+bd0pcvLXU26QOR5x4m1HcxFh/ l0c3R7QRVCJ/NAo5FkHVTL7sMzKHAm/WXKvNqEMhForywdiKY+T1rEDKVVg4/brMESa3 FVU9DY+olYfF4oYG0107guR5hv1BiYVN9VEWaTQuS3ReJ7f8SSZ6H67+ZCPIP5T6qdYC kPjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id p14si2210455qtj.222.2018.02.21.04.07.40; Wed, 21 Feb 2018 04:07:40 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 7514061519; Wed, 21 Feb 2018 12:07:40 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL 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 A123061741; Wed, 21 Feb 2018 12:02:26 +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 F2EC160C40; Wed, 21 Feb 2018 12:01:57 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id 35CD56172B for ; Wed, 21 Feb 2018 12:00:15 +0000 (UTC) Received: from mxback8g.mail.yandex.net (mxback8g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:169]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 19D845603162 for ; Wed, 21 Feb 2018 15:00:14 +0300 (MSK) Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [2a02:6b8:0:801::ac]) by mxback8g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 2xhl8Vfnjl-0EmuY63T; Wed, 21 Feb 2018 15:00:14 +0300 Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id a6UlmCoovI-0DvO71g3; Wed, 21 Feb 2018 15:00:13 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 15:00:03 +0300 Message-Id: <1519214407-28047-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> References: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 492 Subject: [lng-odp] [PATCH v1 6/10] linux-gen: queue: ring based queue implementation X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Change from linked list of bursts to a ring implementation. Queues have maximum size but code is simpler and performance is a bit better. This step helps in a potential future step to implement queues with a lockless ring. Signed-off-by: Petri Savolainen --- /** Email created from pull request 492 (psavol:master-sched-optim) ** https://github.com/Linaro/odp/pull/492 ** Patch: https://github.com/Linaro/odp/pull/492.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: 82a6bfe942419330a430b63149220e6b472f419c **/ .../linux-generic/include/odp_buffer_internal.h | 24 ++-- platform/linux-generic/include/odp_pool_internal.h | 28 ++++ .../linux-generic/include/odp_queue_internal.h | 5 +- platform/linux-generic/odp_packet.c | 3 +- platform/linux-generic/odp_pool.c | 22 +-- platform/linux-generic/odp_queue.c | 159 +++++++++------------ 6 files changed, 114 insertions(+), 127 deletions(-) diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index b52669387..7d649e1c4 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -41,11 +41,19 @@ typedef struct seg_entry_t { uint32_t len; } seg_entry_t; +typedef union buffer_index_t { + uint32_t u32; + + struct { + uint32_t pool :8; + uint32_t buffer :24; + }; +} buffer_index_t; + /* Common buffer header */ struct ODP_ALIGNED_CACHE odp_buffer_hdr_t { - - /* Buffer index in the pool */ - uint32_t index; + /* Combined pool and buffer index */ + buffer_index_t index; /* Total segment count */ uint16_t segcount; @@ -73,16 +81,6 @@ struct ODP_ALIGNED_CACHE odp_buffer_hdr_t { /* Segments */ seg_entry_t seg[CONFIG_PACKET_SEGS_PER_HDR]; - /* Burst counts */ - uint8_t burst_num; - uint8_t burst_first; - - /* Next buf in a list */ - struct odp_buffer_hdr_t *next; - - /* Burst table */ - struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE]; - /* --- Mostly read only data --- */ /* User context pointer or u64 */ diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h index 8284bcd7d..276032e7b 100644 --- a/platform/linux-generic/include/odp_pool_internal.h +++ b/platform/linux-generic/include/odp_pool_internal.h @@ -104,6 +104,34 @@ static inline odp_buffer_hdr_t *buf_hdl_to_hdr(odp_buffer_t buf) return (odp_buffer_hdr_t *)(uintptr_t)buf; } +static inline odp_buffer_hdr_t *buf_hdr_from_index(pool_t *pool, + uint32_t buffer_idx) +{ + uint32_t block_offset; + odp_buffer_hdr_t *buf_hdr; + + block_offset = buffer_idx * pool->block_size; + + /* clang requires cast to uintptr_t */ + buf_hdr = (odp_buffer_hdr_t *)(uintptr_t)&pool->base_addr[block_offset]; + + return buf_hdr; +} + +static inline odp_buffer_hdr_t *buf_hdr_from_index_u32(uint32_t u32) +{ + buffer_index_t index; + uint32_t pool_idx, buffer_idx; + pool_t *pool; + + index.u32 = u32; + pool_idx = index.pool; + buffer_idx = index.buffer; + pool = pool_entry(pool_idx); + + return buf_hdr_from_index(pool, buffer_idx); +} + int buffer_alloc_multi(pool_t *pool, odp_buffer_hdr_t *buf_hdr[], int num); void buffer_free_multi(odp_buffer_hdr_t *buf_hdr[], int num_free); diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index 6fe3fb462..68dddbb0b 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -29,6 +29,7 @@ extern "C" { #include #include #include +#include #define QUEUE_STATUS_FREE 0 #define QUEUE_STATUS_DESTROYED 1 @@ -38,9 +39,7 @@ extern "C" { struct queue_entry_s { odp_ticketlock_t ODP_ALIGNED_CACHE lock; - - odp_buffer_hdr_t *head; - odp_buffer_hdr_t *tail; + ring_st_t ring_st; int status; queue_enq_fn_t ODP_ALIGNED_CACHE enqueue; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 1c1b45ff1..6f8f2d039 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -1814,7 +1814,8 @@ void odp_packet_print_data(odp_packet_t pkt, uint32_t offset, len += snprintf(&str[len], n - len, " pool index %" PRIu32 "\n", pool->pool_idx); len += snprintf(&str[len], n - len, - " buf index %" PRIu32 "\n", hdr->buf_hdr.index); + " buf index %" PRIu32 "\n", + hdr->buf_hdr.index.buffer); len += snprintf(&str[len], n - len, " segcount %" PRIu16 "\n", hdr->buf_hdr.segcount); len += snprintf(&str[len], n - len, diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index e5ba8982a..a9c57f4cb 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -80,20 +80,6 @@ static inline pool_t *pool_from_buf(odp_buffer_t buf) return buf_hdr->pool_ptr; } -static inline odp_buffer_hdr_t *buf_hdr_from_index(pool_t *pool, - uint32_t buffer_idx) -{ - uint32_t block_offset; - odp_buffer_hdr_t *buf_hdr; - - block_offset = buffer_idx * pool->block_size; - - /* clang requires cast to uintptr_t */ - buf_hdr = (odp_buffer_hdr_t *)(uintptr_t)&pool->base_addr[block_offset]; - - return buf_hdr; -} - int odp_pool_init_global(void) { uint32_t i; @@ -296,7 +282,9 @@ static void init_buffers(pool_t *pool) memset(buf_hdr, 0, (uintptr_t)data - (uintptr_t)buf_hdr); /* Initialize buffer metadata */ - buf_hdr->index = i; + buf_hdr->index.u32 = 0; + buf_hdr->index.pool = pool->pool_idx; + buf_hdr->index.buffer = i; buf_hdr->type = type; buf_hdr->event_type = type; buf_hdr->pool_ptr = pool; @@ -782,7 +770,7 @@ static inline void buffer_free_to_pool(pool_t *pool, ring = &pool->ring->hdr; mask = pool->ring_mask; for (i = 0; i < num; i++) - buf_index[i] = buf_hdr[i]->index; + buf_index[i] = buf_hdr[i]->index.buffer; ring_enq_multi(ring, mask, buf_index, num); @@ -822,7 +810,7 @@ static inline void buffer_free_to_pool(pool_t *pool, } for (i = 0; i < num; i++) - cache->buf_index[cache_num + i] = buf_hdr[i]->index; + cache->buf_index[cache_num + i] = buf_hdr[i]->index.buffer; cache->num = cache_num + num; } diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 21135df63..eda872321 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -39,8 +39,15 @@ static int queue_init(queue_entry_t *queue, const char *name, const odp_queue_param_t *param); +typedef struct ODP_ALIGNED_CACHE { + /* Storage space for ring data */ + uint32_t data[CONFIG_QUEUE_SIZE]; +} ring_data_t; + typedef struct queue_table_t { - queue_entry_t queue[ODP_CONFIG_QUEUES]; + queue_entry_t queue[ODP_CONFIG_QUEUES]; + ring_data_t ring_data[ODP_CONFIG_QUEUES]; + } queue_table_t; static queue_table_t *queue_tbl; @@ -143,8 +150,10 @@ static int queue_capability(odp_queue_capability_t *capa) capa->max_sched_groups = sched_fn->num_grps(); capa->sched_prios = odp_schedule_num_prio(); capa->plain.max_num = capa->max_queues; + capa->plain.max_size = CONFIG_QUEUE_SIZE; capa->plain.nonblocking = ODP_BLOCKING; capa->sched.max_num = capa->max_queues; + capa->sched.max_size = CONFIG_QUEUE_SIZE; capa->sched.nonblocking = ODP_BLOCKING; return 0; @@ -192,6 +201,9 @@ static odp_queue_t queue_create(const char *name, param = &default_param; } + if (param->size > CONFIG_QUEUE_SIZE) + return ODP_QUEUE_INVALID; + for (i = 0; i < ODP_CONFIG_QUEUES; i++) { queue = &queue_tbl->queue[i]; @@ -263,7 +275,7 @@ static int queue_destroy(odp_queue_t handle) ODP_ERR("queue \"%s\" already destroyed\n", queue->s.name); return -1; } - if (queue->s.head != NULL) { + if (ring_st_is_empty(&queue->s.ring_st) == 0) { UNLOCK(&queue->s.lock); ODP_ERR("queue \"%s\" not empty\n", queue->s.name); return -1; @@ -326,81 +338,71 @@ static odp_queue_t queue_lookup(const char *name) return ODP_QUEUE_INVALID; } +static inline void buffer_index_from_buf(uint32_t buffer_index[], + odp_buffer_hdr_t *buf_hdr[], int num) +{ + int i; + + for (i = 0; i < num; i++) + buffer_index[i] = buf_hdr[i]->index.u32; +} + +static inline void buffer_index_to_buf(odp_buffer_hdr_t *buf_hdr[], + uint32_t buffer_index[], int num) +{ + int i; + + for (i = 0; i < num; i++) { + buf_hdr[i] = buf_hdr_from_index_u32(buffer_index[i]); + odp_prefetch(buf_hdr[i]); + } +} + static inline int enq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num) { int sched = 0; - int i, ret; + int ret; queue_entry_t *queue; - odp_buffer_hdr_t *hdr, *tail, *next_hdr; + int num_enq; + ring_st_t *ring_st; + uint32_t buf_idx[num]; queue = qentry_from_int(q_int); + ring_st = &queue->s.ring_st; + if (sched_fn->ord_enq_multi(q_int, (void **)buf_hdr, num, &ret)) return ret; - /* Optimize the common case of single enqueue */ - if (num == 1) { - tail = buf_hdr[0]; - hdr = tail; - hdr->burst_num = 0; - hdr->next = NULL; - } else { - int next; - - /* Start from the last buffer header */ - tail = buf_hdr[num - 1]; - hdr = tail; - hdr->next = NULL; - next = num - 2; - - while (1) { - /* Build a burst. The buffer header carrying - * a burst is the last buffer of the burst. */ - for (i = 0; next >= 0 && i < BUFFER_BURST_SIZE; - i++, next--) - hdr->burst[BUFFER_BURST_SIZE - 1 - i] = - buf_hdr[next]; - - hdr->burst_num = i; - hdr->burst_first = BUFFER_BURST_SIZE - i; - - if (odp_likely(next < 0)) - break; - - /* Get another header and link it */ - next_hdr = hdr; - hdr = buf_hdr[next]; - hdr->next = next_hdr; - next--; - } - } + buffer_index_from_buf(buf_idx, buf_hdr, num); LOCK(&queue->s.lock); + if (odp_unlikely(queue->s.status < QUEUE_STATUS_READY)) { UNLOCK(&queue->s.lock); ODP_ERR("Bad queue status\n"); return -1; } - /* Empty queue */ - if (queue->s.head == NULL) - queue->s.head = hdr; - else - queue->s.tail->next = hdr; + num_enq = ring_st_enq_multi(ring_st, buf_idx, num); - queue->s.tail = tail; + if (odp_unlikely(num_enq == 0)) { + UNLOCK(&queue->s.lock); + return 0; + } if (queue->s.status == QUEUE_STATUS_NOTSCHED) { queue->s.status = QUEUE_STATUS_SCHED; - sched = 1; /* retval: schedule queue */ + sched = 1; } + UNLOCK(&queue->s.lock); /* Add queue to scheduling */ if (sched && sched_fn->sched_queue(queue->s.index)) ODP_ABORT("schedule_queue failed\n"); - return num; /* All events enqueued */ + return num_enq; } static int queue_int_enq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], @@ -446,12 +448,15 @@ static int queue_enq(odp_queue_t handle, odp_event_t ev) static inline int deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], int num) { - odp_buffer_hdr_t *hdr, *next; - int i, j; - int updated = 0; int status_sync = sched_fn->status_sync; + int num_deq; + ring_st_t *ring_st; + uint32_t buf_idx[num]; + + ring_st = &queue->s.ring_st; LOCK(&queue->s.lock); + if (odp_unlikely(queue->s.status < QUEUE_STATUS_READY)) { /* Bad queue, or queue has been destroyed. * Scheduler finalizes queue destroy after this. */ @@ -459,9 +464,9 @@ static inline int deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], return -1; } - hdr = queue->s.head; + num_deq = ring_st_deq_multi(ring_st, buf_idx, num); - if (hdr == NULL) { + if (num_deq == 0) { /* Already empty queue */ if (queue->s.status == QUEUE_STATUS_SCHED) { queue->s.status = QUEUE_STATUS_NOTSCHED; @@ -471,51 +476,18 @@ static inline int deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], } UNLOCK(&queue->s.lock); - return 0; - } - - for (i = 0; i < num && hdr; ) { - int burst_num = hdr->burst_num; - int first = hdr->burst_first; - /* First, get bursted buffers */ - for (j = 0; j < burst_num && i < num; j++, i++) { - buf_hdr[i] = hdr->burst[first + j]; - odp_prefetch(buf_hdr[i]); - } - - if (burst_num) { - hdr->burst_num = burst_num - j; - hdr->burst_first = first + j; - } - - if (i == num) - break; - - /* When burst is empty, consume the current buffer header and - * move to the next header */ - buf_hdr[i] = hdr; - next = hdr->next; - hdr->next = NULL; - hdr = next; - updated++; - i++; + return 0; } - /* Write head only if updated */ - if (updated) - queue->s.head = hdr; - - /* Queue is empty */ - if (hdr == NULL) - queue->s.tail = NULL; - if (status_sync && queue->s.type == ODP_QUEUE_TYPE_SCHED) sched_fn->save_context(queue->s.index); UNLOCK(&queue->s.lock); - return i; + buffer_index_to_buf(buf_hdr, buf_idx, num_deq); + + return num_deq; } static int queue_int_deq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], @@ -584,8 +556,9 @@ static int queue_init(queue_entry_t *queue, const char *name, queue->s.pktin = PKTIN_INVALID; queue->s.pktout = PKTOUT_INVALID; - queue->s.head = NULL; - queue->s.tail = NULL; + ring_st_init(&queue->s.ring_st, + queue_tbl->ring_data[queue->s.index].data, + CONFIG_QUEUE_SIZE); return 0; } @@ -661,7 +634,7 @@ int sched_cb_queue_empty(uint32_t queue_index) return -1; } - if (queue->s.head == NULL) { + if (ring_st_is_empty(&queue->s.ring_st)) { /* Already empty queue. Update status. */ if (queue->s.status == QUEUE_STATUS_SCHED) queue->s.status = QUEUE_STATUS_NOTSCHED; From patchwork Wed Feb 21 12:00:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129045 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp545400ljc; Wed, 21 Feb 2018 04:06:52 -0800 (PST) X-Google-Smtp-Source: AH8x227SQMOdJ7jSHp/wWd/e7iMkIDQhgycIxrwFWggLQDZOzwP26ILbJx/Uux00lEoKA16rnFJZ X-Received: by 10.200.23.176 with SMTP id o45mr4939374qtj.255.1519214812633; Wed, 21 Feb 2018 04:06:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519214812; cv=none; d=google.com; s=arc-20160816; b=0KRX2GG/P7W99H0CGqKcGs+pZY/htp5uNz0J1+o+aAg1+wO/eOhnrSxRYEbrN8kE2o 4+c4QPEYmEjJ0Fg0A01WWFWHidPzQxJTJZmPH1h+f0BXvHHrjkBpuAd81Nw2+rHyYBbl f1kPkXpTKqcKPnILRNF9v67gq4sU8suMVkdMkWecI6Bo2PirK2XzYdZxUHTpPs3+zAeY er6PuS4SzLX6b75WWEoe+D8L7UxtGE/OPp882VBHvxmedEVseghf8Jb23jivQUGrLSqX HBD8yhFVeSjNP8VmLPxuVQJ4DYzUtPJZIqwMLLJEwf159ukyauEm0T2sFS3q25Z08VRl 0XPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=y7dPERgOiqUGwNT7gz6e92I0Nh14hl3qmUVoTidT9mQ=; b=r7/yv6Yh0lRN+HBwnXZvOss92FNuahujfjOplruY9w5eihR8KeTO1Gdhn3JHAL3Gzy NESsoByZMjLimKVLeBllf2Tdu02PxpJfbd9XjMDNSnGW2oYDGV3U4WQs73OIYSJWBOjf qT2JHSZy7zuRQ7NFD+kXdQStc4+UDiIVsgDeRJH+4skTKheb6wQ6puoKpTjGF453rRSX 6t6zSQZ9RTk2fIw3KqfIlgOrMqZbgIjjMx2ZlWXp/9kp2BjWre+XF3jSBG0F1s0tMdPF 2Srz8Gn8YY/vjYyQ5e37Ik3N2X/aED9GNy8Prqq44SovkihP5WOmiVG+up1Jrzu12s5K 1rgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id s65si48452qks.388.2018.02.21.04.06.52; Wed, 21 Feb 2018 04:06:52 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 2307660C5D; Wed, 21 Feb 2018 12:06:52 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 701226172B; Wed, 21 Feb 2018 12:02:23 +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 EBCE660C8F; Wed, 21 Feb 2018 12:01:56 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 325EB608AA for ; Wed, 21 Feb 2018 12:01:13 +0000 (UTC) Received: from mxback5g.mail.yandex.net (mxback5g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:166]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 10111186089 for ; Wed, 21 Feb 2018 15:00:14 +0300 (MSK) Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [2a02:6b8:0:801::ac]) by mxback5g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id IDAsaSdKDx-0EQ8Iq14; Wed, 21 Feb 2018 15:00:14 +0300 Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id a6UlmCoovI-0EvKAcfv; Wed, 21 Feb 2018 15:00:14 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 15:00:04 +0300 Message-Id: <1519214407-28047-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> References: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 492 Subject: [lng-odp] [PATCH v1 7/10] linux-gen: config: increase max burst size X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Burst size can be now increased without overhead as buffer header size is not tied to it. Burst size increase from 16 to 32 improves e.g. l2fwd throughput more than 10%. Signed-off-by: Petri Savolainen --- /** Email created from pull request 492 (psavol:master-sched-optim) ** https://github.com/Linaro/odp/pull/492 ** Patch: https://github.com/Linaro/odp/pull/492.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: 82a6bfe942419330a430b63149220e6b472f419c **/ platform/linux-generic/include/odp_config_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/include/odp_config_internal.h b/platform/linux-generic/include/odp_config_internal.h index 3a852a49c..af8da1f40 100644 --- a/platform/linux-generic/include/odp_config_internal.h +++ b/platform/linux-generic/include/odp_config_internal.h @@ -144,7 +144,7 @@ extern "C" { * This controls the burst size on various enqueue, dequeue, etc calls. Large * burst size improves throughput, but may degrade QoS (increase latency). */ -#define CONFIG_BURST_SIZE 16 +#define CONFIG_BURST_SIZE 32 /* * Maximum number of events in a pool From patchwork Wed Feb 21 12:00:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129047 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp547587ljc; Wed, 21 Feb 2018 04:08:57 -0800 (PST) X-Google-Smtp-Source: AG47ELsKR5QeHbxFFB8RUWKIaFCplx1cj2s7FMp8L3Ztj3cagYbSMOmTV/muyAYpxKw34+WwsD5W X-Received: by 10.55.197.79 with SMTP id p76mr4603758qki.337.1519214937247; Wed, 21 Feb 2018 04:08:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519214937; cv=none; d=google.com; s=arc-20160816; b=XcnCM7tLupUqZABNnAcokzwBaNvlLTU/K3Q4PcX0TejH9fpsYUg09POKo50GFCo2s6 Ej9MK0qxCp5OZlErXpMkjC+drfqgavQbJtq9InVUfif2NEvDm9b4DuRutm32BU2bF6/N exnMLQ62kqCtWcN6NaQTWEglB8TQlQ64afXZOqR1QbTZbOf4HsBWfVtTA2YaRjzdccdT qGbi1xfZwzXR2biNxyDUpKOyrxIALaaIJEs/sLfavVP+H2znXJePRfergj6Xl6ItfKgQ fCM57o5NzE0pzO+T4m8wrf7ydIDwTY/g7XEanvZRZqdIFkmQTl6TJMqhx2k6Qdmb/mTR vhxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=xoilQgV0Ol0LTBaxzA4hakeixDP9lNuHMqxgMhzUOWo=; b=GTUIAkHVYfWoLCg9VF1VZvwgkAip1ciVVEocFJo/drGJzk9mh4BEckgu0Y0MUj0W8k /W8o+nBzcHbyaqAPJd2o0xEabnGDqxy+XaDjyzK3TYyR5Q/BR1BfVoxQLflWvtpl0RaY c6vaHxsPsOLW3yiHc0r/TSrPCk7DIqGRUzy3wfCyQXK18TBB5T+YHYP/Qp0QhmGWrUcY oEbwhh4Z/1BDZDq8kKJQZZZid3BSreae5VeI0qnL9oyVyrL5wwOYmIDDDJ5DGbRVeSV/ szpC5xRE5KngWefh95Jea/YYDbt4dergAP8fNDDUqXfbC2DVn6C0u4Bey4sK1b07WRAE t2hw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id a44si4104183qtb.8.2018.02.21.04.08.56; Wed, 21 Feb 2018 04:08:57 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id DD8BD61747; Wed, 21 Feb 2018 12:08:56 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 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 E7DBC6174E; Wed, 21 Feb 2018 12:02:30 +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 DF1986150D; Wed, 21 Feb 2018 12:02:01 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 206516071D for ; Wed, 21 Feb 2018 12:00:30 +0000 (UTC) Received: from mxback18j.mail.yandex.net (mxback18j.mail.yandex.net [IPv6:2a02:6b8:0:1619::94]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 848075D82DAF for ; Wed, 21 Feb 2018 15:00:15 +0300 (MSK) Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [2a02:6b8:0:801::ac]) by mxback18j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id DcmTtguzaS-0FwKcJRF; Wed, 21 Feb 2018 15:00:15 +0300 Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id a6UlmCoovI-0FvaGaQA; Wed, 21 Feb 2018 15:00:15 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 15:00:05 +0300 Message-Id: <1519214407-28047-9-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> References: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 492 Subject: [lng-odp] [PATCH v1 8/10] linux-gen: queue: simplify lock macro usage X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Use queue entry pointer as macro parameter instead of lock pointer. Signed-off-by: Petri Savolainen --- /** Email created from pull request 492 (psavol:master-sched-optim) ** https://github.com/Linaro/odp/pull/492 ** Patch: https://github.com/Linaro/odp/pull/492.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: 82a6bfe942419330a430b63149220e6b472f419c **/ platform/linux-generic/odp_queue.c | 68 +++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index eda872321..f22b17b03 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -29,9 +29,9 @@ #define NUM_INTERNAL_QUEUES 64 #include -#define LOCK(a) _odp_ticketlock_lock(a) -#define UNLOCK(a) _odp_ticketlock_unlock(a) -#define LOCK_INIT(a) odp_ticketlock_init(a) +#define LOCK(queue_ptr) _odp_ticketlock_lock(&((queue_ptr)->s.lock)) +#define UNLOCK(queue_ptr) _odp_ticketlock_unlock(&((queue_ptr)->s.lock)) +#define LOCK_INIT(queue_ptr) odp_ticketlock_init(&((queue_ptr)->s.lock)) #include #include @@ -88,7 +88,7 @@ static int queue_init_global(void) for (i = 0; i < ODP_CONFIG_QUEUES; i++) { /* init locks */ queue_entry_t *queue = get_qentry(i); - LOCK_INIT(&queue->s.lock); + LOCK_INIT(queue); queue->s.index = i; queue->s.handle = queue_from_index(i); } @@ -123,12 +123,12 @@ static int queue_term_global(void) for (i = 0; i < ODP_CONFIG_QUEUES; i++) { queue = &queue_tbl->queue[i]; - LOCK(&queue->s.lock); + LOCK(queue); if (queue->s.status != QUEUE_STATUS_FREE) { ODP_ERR("Not destroyed queue: %s\n", queue->s.name); rc = -1; } - UNLOCK(&queue->s.lock); + UNLOCK(queue); } ret = odp_shm_free(odp_shm_lookup("odp_queues")); @@ -210,10 +210,10 @@ static odp_queue_t queue_create(const char *name, if (queue->s.status != QUEUE_STATUS_FREE) continue; - LOCK(&queue->s.lock); + LOCK(queue); if (queue->s.status == QUEUE_STATUS_FREE) { if (queue_init(queue, name, param)) { - UNLOCK(&queue->s.lock); + UNLOCK(queue); return handle; } @@ -225,10 +225,10 @@ static odp_queue_t queue_create(const char *name, queue->s.status = QUEUE_STATUS_READY; handle = queue->s.handle; - UNLOCK(&queue->s.lock); + UNLOCK(queue); break; } - UNLOCK(&queue->s.lock); + UNLOCK(queue); } if (handle != ODP_QUEUE_INVALID && type == ODP_QUEUE_TYPE_SCHED) { @@ -247,13 +247,13 @@ void sched_cb_queue_destroy_finalize(uint32_t queue_index) { queue_entry_t *queue = get_qentry(queue_index); - LOCK(&queue->s.lock); + LOCK(queue); if (queue->s.status == QUEUE_STATUS_DESTROYED) { queue->s.status = QUEUE_STATUS_FREE; sched_fn->destroy_queue(queue_index); } - UNLOCK(&queue->s.lock); + UNLOCK(queue); } static int queue_destroy(odp_queue_t handle) @@ -264,19 +264,19 @@ static int queue_destroy(odp_queue_t handle) if (handle == ODP_QUEUE_INVALID) return -1; - LOCK(&queue->s.lock); + LOCK(queue); if (queue->s.status == QUEUE_STATUS_FREE) { - UNLOCK(&queue->s.lock); + UNLOCK(queue); ODP_ERR("queue \"%s\" already free\n", queue->s.name); return -1; } if (queue->s.status == QUEUE_STATUS_DESTROYED) { - UNLOCK(&queue->s.lock); + UNLOCK(queue); ODP_ERR("queue \"%s\" already destroyed\n", queue->s.name); return -1; } if (ring_st_is_empty(&queue->s.ring_st) == 0) { - UNLOCK(&queue->s.lock); + UNLOCK(queue); ODP_ERR("queue \"%s\" not empty\n", queue->s.name); return -1; } @@ -296,7 +296,7 @@ static int queue_destroy(odp_queue_t handle) default: ODP_ABORT("Unexpected queue status\n"); } - UNLOCK(&queue->s.lock); + UNLOCK(queue); return 0; } @@ -326,13 +326,13 @@ static odp_queue_t queue_lookup(const char *name) queue->s.status == QUEUE_STATUS_DESTROYED) continue; - LOCK(&queue->s.lock); + LOCK(queue); if (strcmp(name, queue->s.name) == 0) { /* found it */ - UNLOCK(&queue->s.lock); + UNLOCK(queue); return queue->s.handle; } - UNLOCK(&queue->s.lock); + UNLOCK(queue); } return ODP_QUEUE_INVALID; @@ -376,10 +376,10 @@ static inline int enq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], buffer_index_from_buf(buf_idx, buf_hdr, num); - LOCK(&queue->s.lock); + LOCK(queue); if (odp_unlikely(queue->s.status < QUEUE_STATUS_READY)) { - UNLOCK(&queue->s.lock); + UNLOCK(queue); ODP_ERR("Bad queue status\n"); return -1; } @@ -387,7 +387,7 @@ static inline int enq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], num_enq = ring_st_enq_multi(ring_st, buf_idx, num); if (odp_unlikely(num_enq == 0)) { - UNLOCK(&queue->s.lock); + UNLOCK(queue); return 0; } @@ -396,7 +396,7 @@ static inline int enq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], sched = 1; } - UNLOCK(&queue->s.lock); + UNLOCK(queue); /* Add queue to scheduling */ if (sched && sched_fn->sched_queue(queue->s.index)) @@ -455,12 +455,12 @@ static inline int deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], ring_st = &queue->s.ring_st; - LOCK(&queue->s.lock); + LOCK(queue); if (odp_unlikely(queue->s.status < QUEUE_STATUS_READY)) { /* Bad queue, or queue has been destroyed. * Scheduler finalizes queue destroy after this. */ - UNLOCK(&queue->s.lock); + UNLOCK(queue); return -1; } @@ -475,7 +475,7 @@ static inline int deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], sched_fn->unsched_queue(queue->s.index); } - UNLOCK(&queue->s.lock); + UNLOCK(queue); return 0; } @@ -483,7 +483,7 @@ static inline int deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], if (status_sync && queue->s.type == ODP_QUEUE_TYPE_SCHED) sched_fn->save_context(queue->s.index); - UNLOCK(&queue->s.lock); + UNLOCK(queue); buffer_index_to_buf(buf_hdr, buf_idx, num_deq); @@ -596,12 +596,12 @@ static int queue_info(odp_queue_t handle, odp_queue_info_t *info) queue = get_qentry(queue_id); - LOCK(&queue->s.lock); + LOCK(queue); status = queue->s.status; if (odp_unlikely(status == QUEUE_STATUS_FREE || status == QUEUE_STATUS_DESTROYED)) { - UNLOCK(&queue->s.lock); + UNLOCK(queue); ODP_ERR("Invalid queue status:%d\n", status); return -1; } @@ -609,7 +609,7 @@ static int queue_info(odp_queue_t handle, odp_queue_info_t *info) info->name = queue->s.name; info->param = queue->s.param; - UNLOCK(&queue->s.lock); + UNLOCK(queue); return 0; } @@ -626,11 +626,11 @@ int sched_cb_queue_empty(uint32_t queue_index) queue_entry_t *queue = get_qentry(queue_index); int ret = 0; - LOCK(&queue->s.lock); + LOCK(queue); if (odp_unlikely(queue->s.status < QUEUE_STATUS_READY)) { /* Bad queue, or queue has been destroyed. */ - UNLOCK(&queue->s.lock); + UNLOCK(queue); return -1; } @@ -642,7 +642,7 @@ int sched_cb_queue_empty(uint32_t queue_index) ret = 1; } - UNLOCK(&queue->s.lock); + UNLOCK(queue); return ret; } From patchwork Wed Feb 21 12:00:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129049 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp550681ljc; Wed, 21 Feb 2018 04:12:06 -0800 (PST) X-Google-Smtp-Source: AG47ELvxaIRYP/2ExBBda9kYo528N6JHfjM7KOLGQqidtySw9jkBkKh11M58UjWDjPEuMxWW0nkA X-Received: by 10.55.12.66 with SMTP id 63mr4813262qkm.12.1519215126748; Wed, 21 Feb 2018 04:12:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519215126; cv=none; d=google.com; s=arc-20160816; b=HzBBCbrJLsu6KikM5QEUZSTA3VnlCN4KMUr8TX9sTpDJfte+9dnzUix72SKhv8Ig8D fAsVBzdxy0nUINmrFbd8TcM7luqbutaSGkBPFhnBgStx/JM5prxF0iWLdaciOiPqXEs1 rkNLJiDRC1cEaaycmDBrEvEDZCoWTrvNrcLy9iq/+4PmjlWhQ7tMkXuXdkc9vOjl2ZQD Q2HkZQMTQH33U+igr+PqO06Vy3zK/6v4hrZZygtxo6hB4aF1o8afMJ+foCmfbOvwAyQU H2jEZhWiwU5w6bQKlKO94Mm5Giuy8xCZGkMq1/UQDnnznUHttxFpvlaxSMGsfiNuGNty 6jag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=rOz127wsfQEDZ66rRAEu5ZOEoUsJhvWDx723ToUnn+s=; b=WKSLN+YPZ48vSB5mxhp6QYvsSbmZfWQQ7wnIrmBiZbHi+m9/qv7vRmpG7/zj2WFa4a s5oYqpAmvlXZuQ27pEvSG+GoQMt2taFLs6AxM3ujVwIKa4VeW9wquLcCuRUs8QO7Zg5Q 5wPknfsB7RKTqfZPWrFKiwPDYMoOiYZpo39CN8grJVHXJBmvoGFAql9bkGXtKfsdeYPH xT/yBl3/vuH1BBRSB0qLy0F4SKjquMv/o6hhDE2/oTPW5U3z+JO7dhoLOHYjDjASFuPI Lhf9h5twOl1h/Hn1KJw1HnOmlOAJ7spz4K+9kJPtl8QZk/v6gYRg4WCD5CI575yGFhNy 9deg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id q68si4146366qkq.220.2018.02.21.04.12.06; Wed, 21 Feb 2018 04:12:06 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 699726152B; Wed, 21 Feb 2018 12:12:06 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 58ED56177F; Wed, 21 Feb 2018 12:03:12 +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 4BDF16177F; Wed, 21 Feb 2018 12:03:04 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id 1934260C5D for ; Wed, 21 Feb 2018 12:01:33 +0000 (UTC) Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward103o.mail.yandex.net (Yandex) with ESMTP id 0E3F8588112A for ; Wed, 21 Feb 2018 15:00:16 +0300 (MSK) Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [2a02:6b8:0:801::ac]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 9Bz2FaxrUh-0FbGBjic; Wed, 21 Feb 2018 15:00:15 +0300 Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id a6UlmCoovI-0Fv0qAfF; Wed, 21 Feb 2018 15:00:15 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 15:00:06 +0300 Message-Id: <1519214407-28047-10-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> References: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 492 Subject: [lng-odp] [PATCH v1 9/10] test: l2fwd: remove unnecessary doxygen tags X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Doxygen documentation is not generated from this file. Remove unnecessary and incomplete doxygen taggings. Signed-off-by: Petri Savolainen --- /** Email created from pull request 492 (psavol:master-sched-optim) ** https://github.com/Linaro/odp/pull/492 ** Patch: https://github.com/Linaro/odp/pull/492.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: 82a6bfe942419330a430b63149220e6b472f419c **/ test/performance/odp_l2fwd.c | 190 +++++++++++++++++++------------------------ 1 file changed, 83 insertions(+), 107 deletions(-) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index a2b9a9ca0..0a76d8b67 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -6,13 +6,7 @@ #include "config.h" -/** - * @file - * - * @example odp_l2fwd.c ODP basic forwarding application - */ - -/** enable strtok */ +/* enable strtok */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif @@ -30,38 +24,28 @@ #include #include -/** @def MAX_WORKERS - * @brief Maximum number of worker threads - */ +/* Maximum number of worker threads */ #define MAX_WORKERS 32 -/** @def SHM_PKT_POOL_SIZE - * @brief Size of the shared memory block - */ +/* Size of the shared memory block */ #define SHM_PKT_POOL_SIZE 8192 -/** @def SHM_PKT_POOL_BUF_SIZE - * @brief Buffer size of the packet pool buffer - */ +/* Buffer size of the packet pool buffer */ #define SHM_PKT_POOL_BUF_SIZE 1856 -/** @def MAX_PKT_BURST - * @brief Maximum number of packet in a burst - */ +/* Maximum number of packet in a burst */ #define MAX_PKT_BURST 32 -/** Maximum number of pktio queues per interface */ +/* Maximum number of pktio queues per interface */ #define MAX_QUEUES 32 -/** Maximum number of pktio interfaces */ +/* Maximum number of pktio interfaces */ #define MAX_PKTIOS 8 -/** Maximum pktio index table size */ +/* Maximum pktio index table size */ #define MAX_PKTIO_INDEXES 1024 -/** - * Packet input mode - */ +/* Packet input mode */ typedef enum pktin_mode_t { DIRECT_RECV, PLAIN_QUEUE, @@ -70,9 +54,7 @@ typedef enum pktin_mode_t { SCHED_ORDERED, } pktin_mode_t; -/** - * Packet output modes - */ +/* Packet output modes */ typedef enum pktout_mode_t { PKTOUT_DIRECT, PKTOUT_QUEUE @@ -85,60 +67,56 @@ static inline int sched_mode(pktin_mode_t in_mode) (in_mode == SCHED_ORDERED); } -/** Get rid of path in filename - only for unix-type paths using '/' */ +/* Get rid of path in filename - only for unix-type paths using '/' */ #define NO_PATH(file_name) (strrchr((file_name), '/') ? \ strrchr((file_name), '/') + 1 : (file_name)) -/** +/* * Parsed command line application arguments */ typedef struct { - int extra_check; /**< Some extra checks have been enabled */ + int extra_check; /* Some extra checks have been enabled */ int cpu_count; - int if_count; /**< Number of interfaces to be used */ - int addr_count; /**< Number of dst addresses to be used */ - int num_workers; /**< Number of worker threads */ - char **if_names; /**< Array of pointers to interface names */ - odph_ethaddr_t addrs[MAX_PKTIOS]; /**< Array of dst addresses */ - pktin_mode_t in_mode; /**< Packet input mode */ - pktout_mode_t out_mode; /**< Packet output mode */ - int time; /**< Time in seconds to run. */ - int accuracy; /**< Number of seconds to get and print statistics */ - char *if_str; /**< Storage for interface names */ - int dst_change; /**< Change destination eth addresses */ - int src_change; /**< Change source eth addresses */ - int error_check; /**< Check packet errors */ - int chksum; /**< Checksum offload */ - int sched_mode; /**< Scheduler mode */ - int num_groups; /**< Number of scheduling groups */ - int verbose; /**< Verbose output */ + int if_count; /* Number of interfaces to be used */ + int addr_count; /* Number of dst addresses to be used */ + int num_workers; /* Number of worker threads */ + char **if_names; /* Array of pointers to interface names */ + odph_ethaddr_t addrs[MAX_PKTIOS]; /* Array of dst addresses */ + pktin_mode_t in_mode; /* Packet input mode */ + pktout_mode_t out_mode; /* Packet output mode */ + int time; /* Time in seconds to run. */ + int accuracy; /* Number of seconds to get and print stats */ + char *if_str; /* Storage for interface names */ + int dst_change; /* Change destination eth addresses */ + int src_change; /* Change source eth addresses */ + int error_check; /* Check packet errors */ + int chksum; /* Checksum offload */ + int sched_mode; /* Scheduler mode */ + int num_groups; /* Number of scheduling groups */ + int verbose; /* Verbose output */ } appl_args_t; -static int exit_threads; /**< Break workers loop if set to 1 */ +static int exit_threads; /* Break workers loop if set to 1 */ static void sig_handler(int signo ODP_UNUSED) { exit_threads = 1; } -/** - * Statistics - */ +/* Statistics */ typedef union ODP_ALIGNED_CACHE { struct { - /** Number of forwarded packets */ + /* Number of forwarded packets */ uint64_t packets; - /** Packets dropped due to receive error */ + /* Packets dropped due to receive error */ uint64_t rx_drops; - /** Packets dropped due to transmit error */ + /* Packets dropped due to transmit error */ uint64_t tx_drops; } s; uint8_t padding[ODP_CACHE_LINE_SIZE]; } stats_t; -/** - * Thread specific data - */ +/* Thread specific data */ typedef struct thread_args_t { stats_t stats; @@ -161,24 +139,24 @@ typedef struct thread_args_t { int num_groups; } thread_args_t; -/** +/* * Grouping of all global data */ typedef struct { - /** Thread specific arguments */ + /* Thread specific arguments */ thread_args_t thread[MAX_WORKERS]; - /** Barriers to synchronize main and workers */ + /* Barriers to synchronize main and workers */ odp_barrier_t init_barrier; odp_barrier_t term_barrier; - /** Application (parsed) arguments */ + /* Application (parsed) arguments */ appl_args_t appl; - /** Table of port ethernet addresses */ + /* Table of port ethernet addresses */ odph_ethaddr_t port_eth_addr[MAX_PKTIOS]; - /** Table of dst ethernet addresses */ + /* Table of dst ethernet addresses */ odph_ethaddr_t dst_eth_addr[MAX_PKTIOS]; - /** Table of dst ports. This is used by non-sched modes. */ + /* Table of dst ports. This is used by non-sched modes. */ int dst_port[MAX_PKTIOS]; - /** Table of pktio handles */ + /* Table of pktio handles */ struct { odp_pktio_t pktio; odp_pktin_queue_t pktin[MAX_QUEUES]; @@ -193,26 +171,26 @@ typedef struct { int next_tx_queue; } pktios[MAX_PKTIOS]; - /** Destination port lookup table. - * Table index is pktio_index of the API. This is used by the sched - * mode. */ + /* Destination port lookup table. + * Table index is pktio_index of the API. This is used by the sched + * mode. */ uint8_t dst_port_from_idx[MAX_PKTIO_INDEXES]; } args_t; -/** Global pointer to args */ +/* Global pointer to args */ static args_t *gbl_args; -/** +/* * Drop packets which input parsing marked as containing errors. * * Frees packets with error and modifies pkt_tbl[] to only contain packets with * no detected errors. * - * @param pkt_tbl Array of packets - * @param num Number of packets in pkt_tbl[] + * pkt_tbl Array of packets + * num Number of packets in pkt_tbl[] * - * @return Number of packets dropped + * Returns number of packets dropped */ static inline int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned num) { @@ -234,12 +212,12 @@ static inline int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned num) return dropped; } -/** +/* * Fill packets' eth addresses according to the destination port * - * @param pkt_tbl Array of packets - * @param num Number of packets in the array - * @param dst_port Destination port + * pkt_tbl Array of packets + * num Number of packets in the array + * dst_port Destination port */ static inline void fill_eth_addrs(odp_packet_t pkt_tbl[], unsigned num, int dst_port) @@ -301,10 +279,10 @@ static inline void chksum_insert(odp_packet_t *pkt_tbl, int pkts) } } -/** +/* * Packet IO worker thread using scheduled queues * - * @param arg thread arguments of type 'thread_args_t *' + * arg thread arguments of type 'thread_args_t *' */ static int run_worker_sched_mode(void *arg) { @@ -441,10 +419,10 @@ static int run_worker_sched_mode(void *arg) return 0; } -/** +/* * Packet IO worker thread using plain queues * - * @param arg thread arguments of type 'thread_args_t *' + * arg thread arguments of type 'thread_args_t *' */ static int run_worker_plain_queue_mode(void *arg) { @@ -568,10 +546,10 @@ static int run_worker_plain_queue_mode(void *arg) return 0; } -/** +/* * Packet IO worker thread accessing IO resources directly * - * @param arg thread arguments of type 'thread_args_t *' + * arg thread arguments of type 'thread_args_t *' */ static int run_worker_direct_mode(void *arg) { @@ -670,15 +648,14 @@ static int run_worker_direct_mode(void *arg) return 0; } -/** +/* * Create a pktio handle, optionally associating a default input queue. * - * @param dev Name of device to open - * @param index Pktio index - * @param pool Pool to associate with device for packet RX/TX + * dev Name of device to open + * index Pktio index + * pool Pool to associate with device for packet RX/TX * - * @retval 0 on success - * @retval -1 on failure + * Returns 0 on success, -1 on failure */ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, odp_pool_t pool, odp_schedule_group_t group) @@ -837,14 +814,13 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, return 0; } -/** - * Print statistics - * - * @param num_workers Number of worker threads - * @param thr_stats Pointers to stats storage - * @param duration Number of seconds to loop in - * @param timeout Number of seconds for stats calculation +/* + * Print statistics * + * num_workers Number of worker threads + * thr_stats Pointers to stats storage + * duration Number of seconds to loop in + * timeout Number of seconds for stats calculation */ static int print_speed_stats(int num_workers, stats_t **thr_stats, int duration, int timeout) @@ -926,10 +902,10 @@ static void print_port_mapping(void) printf("\n"); } -/** +/* * Find the destination port for a given input port * - * @param port Input port index + * port Input port index */ static int find_dest_port(int port) { @@ -1117,7 +1093,7 @@ static void init_port_lookup_tbl(void) } } -/** +/* * Prinf usage information */ static void usage(char *progname) @@ -1172,12 +1148,12 @@ static void usage(char *progname) ); } -/** +/* * Parse and store the command line arguments * - * @param argc argument count - * @param argv[] argument vector - * @param appl_args Store application arguments here + * argc argument count + * argv[] argument vector + * appl_args Store application arguments here */ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) { @@ -1377,7 +1353,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) optind = 1; /* reset 'extern optind' from the getopt lib */ } -/** +/* * Print system and application info */ static void print_info(char *progname, appl_args_t *appl_args) @@ -1447,8 +1423,8 @@ static void create_groups(int num, odp_schedule_group_t *group) } } -/** - * ODP L2 forwarding main function +/* + * L2 forwarding main function */ int main(int argc, char *argv[]) { From patchwork Wed Feb 21 12:00:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129044 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp544597ljc; Wed, 21 Feb 2018 04:06:06 -0800 (PST) X-Google-Smtp-Source: AH8x2268sstb8oDq2oGiULLhrlgesaFlxFUNDxDVjXPaEjcSaNfdiIEeNVl47pHqtXVyn4/8QsJZ X-Received: by 10.200.16.19 with SMTP id z19mr5070843qti.10.1519214766616; Wed, 21 Feb 2018 04:06:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519214766; cv=none; d=google.com; s=arc-20160816; b=uglSsX19wC/pRifdHqamm3hVGumboIfrDuHFw5VYpx3f5JoOTORmQhoXuYb4QZBPH3 cLma/Hc4dQhpWdCiPmZ/V2FpgHiQoGqoeBuESPa5RIjNGMuyY6UWfO6GkKP7VDxVftt1 /IJfOyhnKyRZKJLkEgf7pDLTN0tn0ZHffZDLyj4fqUHqe2TcpqDggqqO1rIgwMG0BPdm anEbwryGuqymhMd59UwIN6xO6RelzrTTYCrut1DY4UKqmyCWxuEFLXWxyCMPlB+51hxJ ER1eEV04xK+kELu6NOZtdzFzo4ZBYORr9OTcRMBY4CKYC5qMj7VDFLJg8Ue0iEMf4rpX rTYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=bGacDfb8tn5/+vKtspqggzr1PGuepx8UwvP2kY6+uPY=; b=zFjb8+fwyjMtdh2GxNwAWhH+H/jNke1sSXafzmIEMVKOU5dF8QHxgUIDXB07RA4WRN dmbOAin2pygRJ9U+igDj0A5v3XlPM0sFDxQqOwb3/f2Mmp7ozUR3TLsxPvJ8YzzhJJc+ WoLb992xfRdJB8OFWfKYP+W9rkpR+5xlno19j6aQ91LFUgdE/mFm4QQDJNdLfki//mY8 JE7IL54vmqugImMf5dS6RprBYX/k1CBlXZELz1pw7CoiNFzntCFBsIDywWzV942LKUj9 w49UP+I4AX6Xy2jTIXqhn5LuSCI+p4jQCfKbHdnfwJKhzVb9HrbAe0goxdaPz3ikdjsu geyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id i33si10850042qta.255.2018.02.21.04.06.06; Wed, 21 Feb 2018 04:06:06 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 52CBA607D7; Wed, 21 Feb 2018 12:06:06 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 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 2CF1D6151A; Wed, 21 Feb 2018 12:02:17 +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 78B2A607BE; Wed, 21 Feb 2018 12:01:52 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id B2F0461505 for ; Wed, 21 Feb 2018 12:00:17 +0000 (UTC) Received: from mxback3g.mail.yandex.net (mxback3g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:164]) by forward104j.mail.yandex.net (Yandex) with ESMTP id A57F843CE9 for ; Wed, 21 Feb 2018 15:00:16 +0300 (MSK) Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [2a02:6b8:0:801::ac]) by mxback3g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 5BBhqBWgOx-0Gs4PwOo; Wed, 21 Feb 2018 15:00:16 +0300 Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id a6UlmCoovI-0Gv8sI8m; Wed, 21 Feb 2018 15:00:16 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 15:00:07 +0300 Message-Id: <1519214407-28047-11-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> References: <1519214407-28047-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 492 Subject: [lng-odp] [PATCH v1 10/10] test: l2fwd: increase num pkt and honour pool capability X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Increase number of packets to 16k as 8k packets limit throughput on 40Gbit testing. Also limit packet count and length to pool capability maximums when needed. Signed-off-by: Petri Savolainen --- /** Email created from pull request 492 (psavol:master-sched-optim) ** https://github.com/Linaro/odp/pull/492 ** Patch: https://github.com/Linaro/odp/pull/492.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: 82a6bfe942419330a430b63149220e6b472f419c **/ test/performance/odp_l2fwd.c | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 0a76d8b67..b2d380984 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -28,10 +28,10 @@ #define MAX_WORKERS 32 /* Size of the shared memory block */ -#define SHM_PKT_POOL_SIZE 8192 +#define POOL_PKT_NUM (16 * 1024) /* Buffer size of the packet pool buffer */ -#define SHM_PKT_POOL_BUF_SIZE 1856 +#define POOL_PKT_LEN 1536 /* Maximum number of packet in a burst */ #define MAX_PKT_BURST 32 @@ -663,7 +663,7 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, odp_pktio_t pktio; odp_pktio_param_t pktio_param; odp_schedule_sync_t sync_mode; - odp_pktio_capability_t capa; + odp_pktio_capability_t pktio_capa; odp_pktio_config_t config; odp_pktin_queue_param_t pktin_param; odp_pktout_queue_param_t pktout_param; @@ -699,8 +699,8 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, if (gbl_args->appl.verbose) odp_pktio_print(pktio); - if (odp_pktio_capability(pktio, &capa)) { - LOG_ERR("Error: capability query failed %s\n", dev); + if (odp_pktio_capability(pktio, &pktio_capa)) { + LOG_ERR("Error: pktio capability query failed %s\n", dev); return -1; } @@ -739,17 +739,17 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, pktin_param.queue_param.sched.group = group; } - if (num_rx > (int)capa.max_input_queues) { + if (num_rx > (int)pktio_capa.max_input_queues) { printf("Sharing %i input queues between %i workers\n", - capa.max_input_queues, num_rx); - num_rx = capa.max_input_queues; + pktio_capa.max_input_queues, num_rx); + num_rx = pktio_capa.max_input_queues; mode_rx = ODP_PKTIO_OP_MT; } - if (num_tx > (int)capa.max_output_queues) { + if (num_tx > (int)pktio_capa.max_output_queues) { printf("Sharing %i output queues between %i workers\n", - capa.max_output_queues, num_tx); - num_tx = capa.max_output_queues; + pktio_capa.max_output_queues, num_tx); + num_tx = pktio_capa.max_output_queues; mode_tx = ODP_PKTIO_OP_MT; } @@ -1446,6 +1446,8 @@ int main(int argc, char *argv[]) int num_groups; odp_schedule_group_t group[MAX_PKTIOS]; odp_init_t init; + odp_pool_capability_t pool_capa; + uint32_t pkt_len, pkt_num; odp_init_param_init(&init); @@ -1525,11 +1527,25 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } + if (odp_pool_capability(&pool_capa)) { + LOG_ERR("Error: pool capability failed\n"); + return -1; + } + + pkt_len = POOL_PKT_LEN; + pkt_num = POOL_PKT_NUM; + + if (pool_capa.pkt.max_len && pkt_len > pool_capa.pkt.max_len) + pkt_len = pool_capa.pkt.max_len; + + if (pool_capa.pkt.max_num && pkt_num > pool_capa.pkt.max_num) + pkt_num = pool_capa.pkt.max_num; + /* Create packet pool */ odp_pool_param_init(¶ms); - params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE; - params.pkt.len = SHM_PKT_POOL_BUF_SIZE; - params.pkt.num = SHM_PKT_POOL_SIZE; + params.pkt.seg_len = pkt_len; + params.pkt.len = pkt_len; + params.pkt.num = pkt_num; params.type = ODP_POOL_PACKET; pool = odp_pool_create("packet pool", ¶ms);