From patchwork Thu Feb 22 10:00:17 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: 129190 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp435638lja; Thu, 22 Feb 2018 02:22:27 -0800 (PST) X-Google-Smtp-Source: AH8x225b03hPIE7xuKXRWDfGT55zqSniZNzpycUM3vLsNa35y2c8xKEWqHKrAN0fFZuGhw+6EEM/ X-Received: by 10.200.26.131 with SMTP id x3mr10520182qtj.288.1519294947219; Thu, 22 Feb 2018 02:22:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519294947; cv=none; d=google.com; s=arc-20160816; b=S08mFnd6yWIPePbuLTyCTApipxmn0SSRJ218d/BJEabIfIhOuwwFbl0B6Ph1n1p5iE Pjx6CKaxRDMjEqCsiS+RgfBgwhSfMuF2tRjY77mWuo/q2CxDQh1HwI655fzm9GHCAigz SE/XPB55LeO74OrRnYUnbNaasRHmltE+ZObGweV3/plV9QMmytBn23tGAcUMzUltCVHa YJp8V27ztSP94tkpH0UX3mbNCd/MeRRE34SiPyod03qIKi6p8VG0vwdiVXIliXL3SVDk prfhGsqTKpVh0iY5yDhhbc0FRefPQzmQL+mtkmSppKxyt7g2/IkIfpWBD5PAPSW1i1vW RnTA== 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=H2FcqBA0/4W11gGmg8TcBHnG9ubC2xyaqGkcEcRbCx0=; b=FGat1I10n+u7CGsfqhDT/dyJlPxlvkcyR7BGh5t1nlLSGKj3fB+hLoEsHlmBHJDAk9 IKngHfC7/+VNwTE4YIoyKx8isG/+RFThUr7smrC+U1Sf6WkEHW+fXt5fm1T4cJuHJ3Ij cWqYhhHuQDnm0+b/Hr2HAgfvAbPwTHewJFONRcMJe1ubX2GAyi47oJaysZmw+LR9PSUg LzN4Gruz+Fmnn8cKiMtKgLlDMzDFCoPQ9nzgMWVCXZctCIPRFpr4Hu17+GmuvRua5yb5 uwZpUfvo5NVdiQ93aafZWhAVLdBye8TjOKiIhtZCbBNr0DUstPh7dBErA8Y2cKtxy5t/ 5qYg== 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 a9si1041563qtg.478.2018.02.22.02.22.26; Thu, 22 Feb 2018 02:22:27 -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 D1B2060B52; Thu, 22 Feb 2018 10:22:26 +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 3CB1A62774; Thu, 22 Feb 2018 10:07:10 +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 B04F16173F; Thu, 22 Feb 2018 10:07:04 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id C93916173F for ; Thu, 22 Feb 2018 10:01:40 +0000 (UTC) Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward105j.mail.yandex.net (Yandex) with ESMTP id A0C4218331C for ; Thu, 22 Feb 2018 13:00:26 +0300 (MSK) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id WTJVEHxNz1-0Q48L11x; Thu, 22 Feb 2018 13:00:26 +0300 Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id azPEnBhLoH-0Pvm46Q8; Thu, 22 Feb 2018 13:00:26 +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: Thu, 22 Feb 2018 13:00:17 +0300 Message-Id: <1519293622-14665-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519293622-14665-1-git-send-email-odpbot@yandex.ru> References: <1519293622-14665-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 492 Subject: [lng-odp] [PATCH v2 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: b29563293c1bca56419d2dc355a8e64d961e024a **/ 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;