MCPcopy Create free account
hub / github.com/F-Stack/f-stack / init_params

Function init_params

dpdk/app/test/test_hash_readwrite.c:123–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123static int
124init_params(int use_ext, int use_htm, int rw_lf, int use_jhash)
125{
126 unsigned int i;
127
128 uint32_t *keys = NULL;
129 uint8_t *found = NULL;
130 struct rte_hash *handle;
131
132 struct rte_hash_parameters hash_params = {
133 .entries = TOTAL_ENTRY,
134 .key_len = sizeof(uint32_t),
135 .hash_func_init_val = 0,
136 .socket_id = rte_socket_id(),
137 };
138 if (use_jhash)
139 hash_params.hash_func = rte_jhash;
140 else
141 hash_params.hash_func = rte_hash_crc;
142
143 hash_params.extra_flag = RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD;
144 if (use_htm)
145 hash_params.extra_flag |=
146 RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT;
147 if (rw_lf)
148 hash_params.extra_flag |=
149 RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF;
150 else
151 hash_params.extra_flag |=
152 RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY;
153
154 if (use_ext)
155 hash_params.extra_flag |=
156 RTE_HASH_EXTRA_FLAGS_EXT_TABLE;
157 else
158 hash_params.extra_flag &=
159 ~RTE_HASH_EXTRA_FLAGS_EXT_TABLE;
160
161 hash_params.name = "tests";
162
163 handle = rte_hash_create(&hash_params);
164 if (handle == NULL) {
165 printf("hash creation failed\n");
166 return -1;
167 }
168
169 tbl_rw_test_param.h = handle;
170 keys = rte_malloc(NULL, sizeof(uint32_t) * TOTAL_ENTRY, 0);
171
172 if (keys == NULL) {
173 printf("RTE_MALLOC failed\n");
174 goto err;
175 }
176
177 found = rte_zmalloc(NULL, sizeof(uint8_t) * TOTAL_ENTRY, 0);
178 if (found == NULL) {
179 printf("RTE_ZMALLOC failed\n");
180 goto err;

Callers 2

test_hash_readwrite_perfFunction · 0.70

Calls 7

rte_socket_idFunction · 0.85
rte_hash_createFunction · 0.85
rte_mallocFunction · 0.85
rte_zmallocFunction · 0.85
rte_freeFunction · 0.85
rte_hash_freeFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected