From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3415C9E7 for ; Mon, 17 Aug 2015 18:58:37 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 17 Aug 2015 09:58:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,696,1432623600"; d="scan'208";a="785420611" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 17 Aug 2015 09:58:35 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t7HGwYma001335; Mon, 17 Aug 2015 17:58:34 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t7HGwYVL027397; Mon, 17 Aug 2015 17:58:34 +0100 Received: (from pdelarax@localhost) by sivswdev02.ir.intel.com with id t7HGwY51027393; Mon, 17 Aug 2015 17:58:34 +0100 From: Pablo de Lara To: dev@dpdk.org Date: Mon, 17 Aug 2015 17:58:32 +0100 Message-Id: <1439830712-27362-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] test_table: initialize table parameteres X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2015 16:58:38 -0000 In table_autotest, the structures containing the parameters to create the tables were not initialized, and therefore, some checks could fail and so the unit test. Also, due to this initialization, one of the tests that was checking if the table was improperly initialized has been removed, as it is not needed anymore (duplicated) Signed-off-by: Pablo de Lara --- app/test/test_table_tables.c | 91 ++++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 36 deletions(-) diff --git a/app/test/test_table_tables.c b/app/test/test_table_tables.c index 88bebf8..566964b 100644 --- a/app/test/test_table_tables.c +++ b/app/test/test_table_tables.c @@ -203,8 +203,11 @@ test_table_array(void) void *entry_ptr; int key_found; - /* Create */ - struct rte_table_array_params array_params; + /* Initialize params and create tables */ + struct rte_table_array_params array_params = { + .n_entries = 7, + .offset = 1 + }; table = rte_table_array_ops.f_create(NULL, 0, 1); if (table != NULL) @@ -317,8 +320,12 @@ test_table_lpm(void) int key_found; uint32_t entry_size = 1; - /* Create */ - struct rte_table_lpm_params lpm_params; + /* Initialize params and create tables */ + struct rte_table_lpm_params lpm_params = { + .n_rules = 1 << 24, + .entry_unique_size = entry_size, + .offset = 1 + }; table = rte_table_lpm_ops.f_create(NULL, 0, entry_size); if (table != NULL) @@ -331,39 +338,33 @@ test_table_lpm(void) return -2; lpm_params.n_rules = 1 << 24; - lpm_params.offset = 1; - - table = rte_table_lpm_ops.f_create(&lpm_params, 0, entry_size); - if (table != NULL) - return -3; - lpm_params.offset = 32; lpm_params.entry_unique_size = 0; table = rte_table_lpm_ops.f_create(&lpm_params, 0, entry_size); if (table != NULL) - return -4; + return -3; lpm_params.entry_unique_size = entry_size + 1; table = rte_table_lpm_ops.f_create(&lpm_params, 0, entry_size); if (table != NULL) - return -5; + return -4; lpm_params.entry_unique_size = entry_size; table = rte_table_lpm_ops.f_create(&lpm_params, 0, entry_size); if (table == NULL) - return -6; + return -5; /* Free */ status = rte_table_lpm_ops.f_free(table); if (status < 0) - return -7; + return -6; status = rte_table_lpm_ops.f_free(NULL); if (status == 0) - return -8; + return -7; /* Add */ struct rte_table_lpm_key lpm_key; @@ -371,75 +372,75 @@ test_table_lpm(void) table = rte_table_lpm_ops.f_create(&lpm_params, 0, 1); if (table == NULL) - return -9; + return -8; status = rte_table_lpm_ops.f_add(NULL, &lpm_key, &entry, &key_found, &entry_ptr); if (status == 0) - return -10; + return -9; status = rte_table_lpm_ops.f_add(table, NULL, &entry, &key_found, &entry_ptr); if (status == 0) - return -11; + return -10; status = rte_table_lpm_ops.f_add(table, &lpm_key, NULL, &key_found, &entry_ptr); if (status == 0) - return -12; + return -11; lpm_key.depth = 0; status = rte_table_lpm_ops.f_add(table, &lpm_key, &entry, &key_found, &entry_ptr); if (status == 0) - return -13; + return -12; lpm_key.depth = 33; status = rte_table_lpm_ops.f_add(table, &lpm_key, &entry, &key_found, &entry_ptr); if (status == 0) - return -14; + return -13; lpm_key.depth = 16; status = rte_table_lpm_ops.f_add(table, &lpm_key, &entry, &key_found, &entry_ptr); if (status != 0) - return -15; + return -14; /* Delete */ status = rte_table_lpm_ops.f_delete(NULL, &lpm_key, &key_found, NULL); if (status == 0) - return -16; + return -15; status = rte_table_lpm_ops.f_delete(table, NULL, &key_found, NULL); if (status == 0) - return -17; + return -16; lpm_key.depth = 0; status = rte_table_lpm_ops.f_delete(table, &lpm_key, &key_found, NULL); if (status == 0) - return -18; + return -17; lpm_key.depth = 33; status = rte_table_lpm_ops.f_delete(table, &lpm_key, &key_found, NULL); if (status == 0) - return -19; + return -18; lpm_key.depth = 16; status = rte_table_lpm_ops.f_delete(table, &lpm_key, &key_found, NULL); if (status != 0) - return -20; + return -19; status = rte_table_lpm_ops.f_delete(table, &lpm_key, &key_found, NULL); if (status != 0) - return -21; + return -20; /* Traffic flow */ entry = 'A'; status = rte_table_lpm_ops.f_add(table, &lpm_key, &entry, &key_found, &entry_ptr); if (status < 0) - return -22; + return -21; for (i = 0; i < RTE_PORT_IN_BURST_SIZE_MAX; i++) if (i % 2 == 0) { @@ -451,7 +452,7 @@ test_table_lpm(void) rte_table_lpm_ops.f_lookup(table, mbufs, -1, &result_mask, (void **)entries); if (result_mask != expected_mask) - return -21; + return -22; /* Free resources */ for (i = 0; i < RTE_PORT_IN_BURST_SIZE_MAX; i++) @@ -475,8 +476,13 @@ test_table_lpm_ipv6(void) int key_found; uint32_t entry_size = 1; - /* Create */ - struct rte_table_lpm_ipv6_params lpm_params; + /* Initialize params and create tables */ + struct rte_table_lpm_ipv6_params lpm_params = { + .n_rules = 1 << 24, + .number_tbl8s = 1 << 21, + .entry_unique_size = entry_size, + .offset = 32 + }; table = rte_table_lpm_ipv6_ops.f_create(NULL, 0, entry_size); if (table != NULL) @@ -639,8 +645,14 @@ test_table_hash_lru_generic(struct rte_table_ops *ops) void *entry_ptr; int key_found; - /* Create */ - struct rte_table_hash_key8_lru_params hash_params; + /* Initialize params and create tables */ + struct rte_table_hash_key8_lru_params hash_params = { + .n_entries = 1 << 10, + .f_hash = pipeline_test_hash, + .seed = 0, + .signature_offset = 1, + .key_offset = 32 + }; hash_params.n_entries = 0; @@ -747,8 +759,15 @@ test_table_hash_ext_generic(struct rte_table_ops *ops) int key_found; void *entry_ptr; - /* Create */ - struct rte_table_hash_key8_ext_params hash_params; + /* Initialize params and create tables */ + struct rte_table_hash_key8_ext_params hash_params = { + .n_entries = 1 << 10, + .n_entries_ext = 1 << 4, + .f_hash = pipeline_test_hash, + .seed = 0, + .signature_offset = 1, + .key_offset = 32 + }; hash_params.n_entries = 0; -- 2.4.2