test: reduce test duration for efd autotest

Message ID 1537971540-31443-1-git-send-email-jananeex.m.parthasarathy@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series test: reduce test duration for efd autotest |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Jananee Parthasarathy Sept. 26, 2018, 2:19 p.m. UTC
  Reduced test time for efd_autotest.
Key length is updated, invoke times of random function is reduced.

Signed-off-by: Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com>
---
 test/test/test_efd.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
  

Comments

Pattan, Reshma Oct. 17, 2018, 1:33 p.m. UTC | #1
> -----Original Message-----
> From: Parthasarathy, JananeeX M
> Sent: Wednesday, September 26, 2018 3:19 PM
> To: dev@dpdk.org
> 
>  	struct rte_efd_table *handle = NULL;
>  	uint32_t num_rules_in = TABLE_SIZE;
> -	uint8_t simple_key[EFD_TEST_KEY_LEN];

You need to remove EFD_TEST_KEY_LEN macro from the code now, as it is not is not used now.

Also seems like they want to use the key of length 8 bytes as per this test.
But after your changes we are going to have one byte key , so is the test behaving same before and after this key change?
 

> +		val = mrand48() & VALUE_BITMASK;

Can we use rte_rand() here instead of mrand48()? 
What was the reason for using mrand8()?

Thanks,
Reshma
  
Pattan, Reshma Oct. 17, 2018, 2:34 p.m. UTC | #2
> -----Original Message-----
> From: Parthasarathy, JananeeX M
> Sent: Wednesday, September 26, 2018 3:19 PM
> To: dev@dpdk.org
> Cc: Marohn, Byron <byron.marohn@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>; Parthasarathy, JananeeX M
> <jananeex.m.parthasarathy@intel.com>
> Subject: [PATCH] test: reduce test duration for efd autotest
> 
> +	uint8_t simple_key;

Following to my comments in my earlier mail,
Can this be uint64_t simple-key; ? so that we can retain simple_key to be of 64 bits as per original test case.

> efd_get_all_sockets_bitmask(),
> +				sizeof(uint8_t),

sizeof(simple_key);

> +		val = mrand48() & VALUE_BITMASK;

Having value here can make all has key entries to have same value.
But as per original test case, they want to have different value for each
hash key entry. So better move val update inside for loop itself.

>  		/* Add random entries until key cannot be added */
>  		for (added_keys = 0; added_keys < num_rules_in;
> added_keys++) {
> 
> -			for (i = 0; i < EFD_TEST_KEY_LEN; i++)
> -				simple_key[i] = rte_rand() & 0xFF;
> +			simple_key = rte_rand() & 0xFF;

If we agree to change simple_key to be of type unit64_t then masking with 0xFF will not be required here.

Instead of having val = mrand48() & VALUE_BITMASK;  as above. Now you can do val = simple_key & 0xFF;  

So for each key that is going to be updated we will have different value as per original test.

> 
> -			efd_value_t val = simple_key[0];
> -
> -			if (rte_efd_update(handle, test_socket_id,
> simple_key,
> +			if (rte_efd_update(handle, test_socket_id,
> &simple_key,

Thanks,
Reshma
  

Patch

diff --git a/test/test/test_efd.c b/test/test/test_efd.c
index ced091aab..893a09c03 100644
--- a/test/test/test_efd.c
+++ b/test/test/test_efd.c
@@ -331,8 +331,9 @@  static int test_average_table_utilization(void)
 {
 	struct rte_efd_table *handle = NULL;
 	uint32_t num_rules_in = TABLE_SIZE;
-	uint8_t simple_key[EFD_TEST_KEY_LEN];
-	unsigned int i, j;
+	uint8_t simple_key;
+	unsigned int j;
+	efd_value_t val;
 	unsigned int added_keys, average_keys_added = 0;
 
 	printf("Evaluating table utilization and correctness, please wait\n");
@@ -340,7 +341,7 @@  static int test_average_table_utilization(void)
 
 	for (j = 0; j < ITERATIONS; j++) {
 		handle = rte_efd_create("test_efd", num_rules_in,
-				EFD_TEST_KEY_LEN, efd_get_all_sockets_bitmask(),
+				sizeof(uint8_t), efd_get_all_sockets_bitmask(),
 				test_socket_id);
 		if (handle == NULL) {
 			printf("efd table creation failed\n");
@@ -350,18 +351,16 @@  static int test_average_table_utilization(void)
 		unsigned int succeeded = 0;
 		unsigned int lost_keys = 0;
 
+		val = mrand48() & VALUE_BITMASK;
 		/* Add random entries until key cannot be added */
 		for (added_keys = 0; added_keys < num_rules_in; added_keys++) {
 
-			for (i = 0; i < EFD_TEST_KEY_LEN; i++)
-				simple_key[i] = rte_rand() & 0xFF;
+			simple_key = rte_rand() & 0xFF;
 
-			efd_value_t val = simple_key[0];
-
-			if (rte_efd_update(handle, test_socket_id, simple_key,
+			if (rte_efd_update(handle, test_socket_id, &simple_key,
 						val))
 				break; /* continue;*/
-			if (rte_efd_lookup(handle, test_socket_id, simple_key)
+			if (rte_efd_lookup(handle, test_socket_id, &simple_key)
 					!= val)
 				lost_keys++;
 			else