| 191 | } |
| 192 | |
| 193 | static int |
| 194 | testsuite_setup(void) |
| 195 | { |
| 196 | struct comp_testsuite_params *ts_params = &testsuite_params; |
| 197 | uint32_t max_buf_size = 0; |
| 198 | unsigned int i; |
| 199 | |
| 200 | if (rte_compressdev_count() == 0) { |
| 201 | RTE_LOG(WARNING, USER1, "Need at least one compress device\n"); |
| 202 | return TEST_SKIPPED; |
| 203 | } |
| 204 | |
| 205 | RTE_LOG(NOTICE, USER1, "Running tests on device %s\n", |
| 206 | rte_compressdev_name_get(0)); |
| 207 | |
| 208 | for (i = 0; i < RTE_DIM(compress_test_bufs); i++) |
| 209 | max_buf_size = RTE_MAX(max_buf_size, |
| 210 | strlen(compress_test_bufs[i]) + 1); |
| 211 | |
| 212 | /* |
| 213 | * Buffers to be used in compression and decompression. |
| 214 | * Since decompressed data might be larger than |
| 215 | * compressed data (due to block header), |
| 216 | * buffers should be big enough for both cases. |
| 217 | */ |
| 218 | max_buf_size *= COMPRESS_BUF_SIZE_RATIO; |
| 219 | ts_params->large_mbuf_pool = rte_pktmbuf_pool_create("large_mbuf_pool", |
| 220 | NUM_LARGE_MBUFS, |
| 221 | CACHE_SIZE, 0, |
| 222 | max_buf_size + RTE_PKTMBUF_HEADROOM, |
| 223 | rte_socket_id()); |
| 224 | if (ts_params->large_mbuf_pool == NULL) { |
| 225 | RTE_LOG(ERR, USER1, "Large mbuf pool could not be created\n"); |
| 226 | return TEST_FAILED; |
| 227 | } |
| 228 | |
| 229 | /* Create mempool with smaller buffers for SGL testing */ |
| 230 | ts_params->small_mbuf_pool = rte_pktmbuf_pool_create("small_mbuf_pool", |
| 231 | NUM_LARGE_MBUFS * MAX_SEGS, |
| 232 | CACHE_SIZE, 0, |
| 233 | SMALL_SEG_SIZE + RTE_PKTMBUF_HEADROOM, |
| 234 | rte_socket_id()); |
| 235 | if (ts_params->small_mbuf_pool == NULL) { |
| 236 | RTE_LOG(ERR, USER1, "Small mbuf pool could not be created\n"); |
| 237 | goto exit; |
| 238 | } |
| 239 | |
| 240 | /* Create mempool with big buffers for SGL testing */ |
| 241 | ts_params->big_mbuf_pool = rte_pktmbuf_pool_create("big_mbuf_pool", |
| 242 | NUM_BIG_MBUFS + 1, |
| 243 | CACHE_SIZE, 0, |
| 244 | MAX_MBUF_SEGMENT_SIZE, |
| 245 | rte_socket_id()); |
| 246 | if (ts_params->big_mbuf_pool == NULL) { |
| 247 | RTE_LOG(ERR, USER1, "Big mbuf pool could not be created\n"); |
| 248 | goto exit; |
| 249 | } |
| 250 |
nothing calls this directly
no test coverage detected