test/crypto: add Chacha Poly cases
[dpdk.git] / app / test / test_hash_readwrite_lf.c
index c7fad58..97c3040 100644 (file)
@@ -48,7 +48,7 @@
 #define WRITE_EXT_BKT 2
 
 #define NUM_TEST 3
-unsigned int rwc_core_cnt[NUM_TEST] = {1, 2, 4};
+static unsigned int rwc_core_cnt[NUM_TEST] = {1, 2, 4};
 
 struct rwc_perf {
        uint32_t w_no_ks_r_hit[2][NUM_TEST];
@@ -62,7 +62,7 @@ struct rwc_perf {
 
 static struct rwc_perf rwc_lf_results, rwc_non_lf_results;
 
-struct {
+static struct {
        uint32_t *keys;
        uint32_t *keys_no_ks;
        uint32_t *keys_ks;
@@ -87,9 +87,9 @@ static rte_atomic64_t greads;
 
 static volatile uint8_t writer_done;
 
-uint16_t enabled_core_ids[RTE_MAX_LCORE];
+static uint16_t enabled_core_ids[RTE_MAX_LCORE];
 
-uint8_t *scanned_bkts;
+static uint8_t *scanned_bkts;
 
 static inline uint16_t
 get_short_sig(const hash_sig_t hash)
@@ -535,6 +535,7 @@ generate_keys(void)
               tbl_rwc_test_param.count_keys_ks_extbkt);
 
        rte_free(found);
+       rte_free(scanned_bkts);
        rte_hash_free(tbl_rwc_test_param.h);
        return 0;
 
@@ -545,9 +546,11 @@ err:
        rte_free(keys_absent);
        rte_free(found);
        rte_free(tbl_rwc_test_param.keys_shift_path);
+       rte_free(keys_non_shift_path);
        rte_free(keys_ext_bkt);
        rte_free(keys_ks_extbkt);
        rte_free(scanned_bkts);
+       rte_hash_free(tbl_rwc_test_param.h);
        return -1;
 }
 
@@ -562,16 +565,9 @@ test_rwc_reader(__attribute__((unused)) void *arg)
        uint32_t read_cnt;
        uint32_t *keys;
        uint32_t extra_keys;
-       int32_t *pos;
+       int32_t pos[BULK_LOOKUP_SIZE];
        void *temp_a[BULK_LOOKUP_SIZE];
 
-       /* Used to identify keys not inserted in the hash table */
-       pos = rte_malloc(NULL, sizeof(uint32_t) * BULK_LOOKUP_SIZE, 0);
-       if (pos == NULL) {
-               printf("RTE_MALLOC failed\n");
-               return -1;
-       }
-
        if (read_type & READ_FAIL) {
                keys = tbl_rwc_test_param.keys_absent;
                read_cnt = tbl_rwc_test_param.count_keys_absent;
@@ -1429,7 +1425,9 @@ results:
        rte_free(tbl_rwc_test_param.keys_ks);
        rte_free(tbl_rwc_test_param.keys_absent);
        rte_free(tbl_rwc_test_param.keys_shift_path);
-       rte_free(scanned_bkts);
+       rte_free(tbl_rwc_test_param.keys_non_shift_path);
+       rte_free(tbl_rwc_test_param.keys_ext_bkt);
+       rte_free(tbl_rwc_test_param.keys_ks_extbkt);
        return 0;
 }