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

Function comp_perf_initialize_compressdev

dpdk/app/test-compress-perf/main.c:145–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145static int
146comp_perf_initialize_compressdev(struct comp_test_data *test_data,
147 uint8_t *enabled_cdevs)
148{
149 uint8_t enabled_cdev_count, nb_lcores, cdev_id;
150 unsigned int i, j;
151 int ret;
152
153 enabled_cdev_count = rte_compressdev_devices_get(test_data->driver_name,
154 enabled_cdevs, RTE_COMPRESS_MAX_DEVS);
155 if (enabled_cdev_count == 0) {
156 RTE_LOG(ERR, USER1, "No compress devices type %s available,"
157 " please check the list of specified devices in EAL section\n",
158 test_data->driver_name);
159 return -EINVAL;
160 }
161
162 nb_lcores = rte_lcore_count() - 1;
163 /*
164 * Use fewer devices,
165 * if there are more available than cores.
166 */
167 if (enabled_cdev_count > nb_lcores) {
168 if (nb_lcores == 0) {
169 RTE_LOG(ERR, USER1, "Cannot run with 0 cores! Increase the number of cores\n");
170 return -EINVAL;
171 }
172 enabled_cdev_count = nb_lcores;
173 RTE_LOG(INFO, USER1,
174 "There's more available devices than cores!"
175 " The number of devices has been aligned to %d cores\n",
176 nb_lcores);
177 }
178
179 /*
180 * Calculate number of needed queue pairs, based on the amount
181 * of available number of logical cores and compression devices.
182 * For instance, if there are 4 cores and 2 compression devices,
183 * 2 queue pairs will be set up per device.
184 * One queue pair per one core.
185 * if e.g.: there're 3 cores and 2 compression devices,
186 * 2 queue pairs will be set up per device but one queue pair
187 * will left unused in the last one device
188 */
189 test_data->nb_qps = (nb_lcores % enabled_cdev_count) ?
190 (nb_lcores / enabled_cdev_count) + 1 :
191 nb_lcores / enabled_cdev_count;
192
193 for (i = 0; i < enabled_cdev_count &&
194 i < RTE_COMPRESS_MAX_DEVS; i++,
195 nb_lcores -= test_data->nb_qps) {
196 cdev_id = enabled_cdevs[i];
197
198 struct rte_compressdev_info cdev_info;
199 int socket_id = rte_compressdev_socket_id(cdev_id);
200
201 rte_compressdev_info_get(cdev_id, &cdev_info);
202 if (cdev_info.max_nb_queue_pairs &&

Callers 1

mainFunction · 0.85

Calls 8

rte_lcore_countFunction · 0.85
rte_compressdev_info_getFunction · 0.85
rte_compressdev_startFunction · 0.85

Tested by

no test coverage detected