From patchwork Mon Mar 20 10:08:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hunt, David" X-Patchwork-Id: 22014 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id B6E71D040; Mon, 20 Mar 2017 18:08:40 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 7C7F347CD for ; Mon, 20 Mar 2017 18:08:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490029689; x=1521565689; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=BWwy9mfd6wMpM3T9VGeBzzJ/UzE1C85gPkOhq4tf+CI=; b=IGx+LZ0s/56hULHtT3V/t9hRlKyi64TCzMsHPpxRbp/IOML+ocec+Ty0 A/CC9eja//SdzDiYbFw4tNIZBGaMhQ==; Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2017 10:08:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,195,1486454400"; d="scan'208";a="69068976" Received: from silpixa00397515.ir.intel.com (HELO silpixa00397515.ger.corp.intel.com) ([10.237.223.14]) by orsmga004.jf.intel.com with ESMTP; 20 Mar 2017 10:08:07 -0700 From: David Hunt To: dev@dpdk.org Cc: bruce.richardson@intel.com, David Hunt Date: Mon, 20 Mar 2017 10:08:33 +0000 Message-Id: <1490004522-183515-10-git-send-email-david.hunt@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490004522-183515-1-git-send-email-david.hunt@intel.com> References: <1489558767-56329-2-git-send-email-david.hunt@intel.com> <1490004522-183515-1-git-send-email-david.hunt@intel.com> Subject: [dpdk-dev] [PATCH v11 09/18] test: test single and burst distributor API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: David Hunt Acked-by: Bruce Richardson --- test/test/test_distributor.c | 116 ++++++++++++++++++++++++++++++------------- 1 file changed, 82 insertions(+), 34 deletions(-) diff --git a/test/test/test_distributor.c b/test/test/test_distributor.c index 7a30513..890a852 100644 --- a/test/test/test_distributor.c +++ b/test/test/test_distributor.c @@ -538,17 +538,25 @@ static int test_error_distributor_create_name(void) { struct rte_distributor *d = NULL; + struct rte_distributor *db = NULL; char *name = NULL; d = rte_distributor_create(name, rte_socket_id(), rte_lcore_count() - 1, - RTE_DIST_ALG_BURST); - + RTE_DIST_ALG_SINGLE); if (d != NULL || rte_errno != EINVAL) { printf("ERROR: No error on create() with NULL name param\n"); return -1; } + db = rte_distributor_create(name, rte_socket_id(), + rte_lcore_count() - 1, + RTE_DIST_ALG_BURST); + if (db != NULL || rte_errno != EINVAL) { + printf("ERROR: No error on create() with NULL param\n"); + return -1; + } + return 0; } @@ -556,15 +564,25 @@ int test_error_distributor_create_name(void) static int test_error_distributor_create_numworkers(void) { - struct rte_distributor *d = NULL; + struct rte_distributor *ds = NULL; + struct rte_distributor *db = NULL; - d = rte_distributor_create("test_numworkers", rte_socket_id(), + ds = rte_distributor_create("test_numworkers", rte_socket_id(), RTE_MAX_LCORE + 10, - RTE_DIST_ALG_BURST); - if (d != NULL || rte_errno != EINVAL) { + RTE_DIST_ALG_SINGLE); + if (ds != NULL || rte_errno != EINVAL) { printf("ERROR: No error on create() with num_workers > MAX\n"); return -1; } + + db = rte_distributor_create("test_numworkers", rte_socket_id(), + RTE_MAX_LCORE + 10, + RTE_DIST_ALG_BURST); + if (db != NULL || rte_errno != EINVAL) { + printf("ERROR: No error on create() num_workers > MAX\n"); + return -1; + } + return 0; } @@ -597,25 +615,42 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p) static int test_distributor(void) { - static struct rte_distributor *d; + static struct rte_distributor *ds; + static struct rte_distributor *db; + static struct rte_distributor *dist[2]; static struct rte_mempool *p; + int i; if (rte_lcore_count() < 2) { printf("ERROR: not enough cores to test distributor\n"); return -1; } - if (d == NULL) { - d = rte_distributor_create("Test_dist_burst", rte_socket_id(), + if (db == NULL) { + db = rte_distributor_create("Test_dist_burst", rte_socket_id(), rte_lcore_count() - 1, RTE_DIST_ALG_BURST); - if (d == NULL) { + if (db == NULL) { printf("Error creating burst distributor\n"); return -1; } } else { - rte_distributor_flush(d); - rte_distributor_clear_returns(d); + rte_distributor_flush(db); + rte_distributor_clear_returns(db); + } + + if (ds == NULL) { + ds = rte_distributor_create("Test_dist_single", + rte_socket_id(), + rte_lcore_count() - 1, + RTE_DIST_ALG_SINGLE); + if (ds == NULL) { + printf("Error creating single distributor\n"); + return -1; + } + } else { + rte_distributor_flush(ds); + rte_distributor_clear_returns(ds); } const unsigned nb_bufs = (511 * rte_lcore_count()) < BIG_BATCH ? @@ -629,37 +664,50 @@ test_distributor(void) } } - worker_params.dist = d; - sprintf(worker_params.name, "burst"); + dist[0] = ds; + dist[1] = db; - rte_eal_mp_remote_launch(handle_work, &worker_params, SKIP_MASTER); - if (sanity_test(&worker_params, p) < 0) - goto err; - quit_workers(&worker_params, p); + for (i = 0; i < 2; i++) { - rte_eal_mp_remote_launch(handle_work_with_free_mbufs, &worker_params, - SKIP_MASTER); - if (sanity_test_with_mbuf_alloc(&worker_params, p) < 0) - goto err; - quit_workers(&worker_params, p); + worker_params.dist = dist[i]; + if (i) + sprintf(worker_params.name, "burst"); + else + sprintf(worker_params.name, "single"); - if (rte_lcore_count() > 2) { - rte_eal_mp_remote_launch(handle_work_for_shutdown_test, - &worker_params, - SKIP_MASTER); - if (sanity_test_with_worker_shutdown(&worker_params, p) < 0) + rte_eal_mp_remote_launch(handle_work, + &worker_params, SKIP_MASTER); + if (sanity_test(&worker_params, p) < 0) goto err; quit_workers(&worker_params, p); - rte_eal_mp_remote_launch(handle_work_for_shutdown_test, - &worker_params, - SKIP_MASTER); - if (test_flush_with_worker_shutdown(&worker_params, p) < 0) + rte_eal_mp_remote_launch(handle_work_with_free_mbufs, + &worker_params, SKIP_MASTER); + if (sanity_test_with_mbuf_alloc(&worker_params, p) < 0) goto err; quit_workers(&worker_params, p); - } else { - printf("Not enough cores to run tests for worker shutdown\n"); + if (rte_lcore_count() > 2) { + rte_eal_mp_remote_launch(handle_work_for_shutdown_test, + &worker_params, + SKIP_MASTER); + if (sanity_test_with_worker_shutdown(&worker_params, + p) < 0) + goto err; + quit_workers(&worker_params, p); + + rte_eal_mp_remote_launch(handle_work_for_shutdown_test, + &worker_params, + SKIP_MASTER); + if (test_flush_with_worker_shutdown(&worker_params, + p) < 0) + goto err; + quit_workers(&worker_params, p); + + } else { + printf("Too few cores to run worker shutdown test\n"); + } + } if (test_error_distributor_create_numworkers() == -1 ||