-/* this test is a bit tricky, and thus warrants explanation.
- *
- * first, we find two smallest memsegs to conduct our experiments on.
- *
- * then, we bring them within alignment from each other: if second segment is
- * twice+ as big as the first, reserve memory from that segment; if second
- * segment is comparable in length to the first, then cut the first segment
- * down until it becomes less than half of second segment, and then cut down
- * the second segment to be within alignment of the first.
- *
- * then, we have to pass the following test: if segments are within alignment
- * of each other (that is, the difference is less than 256 bytes, which is what
- * our alignment will be), segment with smallest offset should be picked.
- *
- * we know that min_ms will be our smallest segment, so we need to make sure
- * that we adjust the alignments so that the bigger segment has smallest
- * alignment (in our case, smallest segment will have 64-byte alignment, while
- * bigger segment will have 128-byte alignment).
- */
-static int
-test_memzone_reserve_memory_with_smallest_offset(void)
-{
- const struct rte_memseg *ms, *min_ms, *prev_min_ms;
- size_t len, min_len, prev_min_len;
- const struct rte_config *config;
- int i, align;
-
- config = rte_eal_get_configuration();
-
- min_ms = NULL; /*< smallest segment */
- prev_min_ms = NULL; /*< second smallest segment */
- align = RTE_CACHE_LINE_SIZE * 4;
-
- /* find two smallest segments */
- for (i = 0; i < RTE_MAX_MEMSEG; i++) {
- ms = &config->mem_config->free_memseg[i];
-
- if (ms->addr == NULL)
- break;
- if (ms->len == 0)
- continue;
-
- if (min_ms == NULL)
- min_ms = ms;
- else if (min_ms->len > ms->len) {
- /* set last smallest to second last */
- prev_min_ms = min_ms;
-
- /* set new smallest */
- min_ms = ms;
- } else if ((prev_min_ms == NULL)
- || (prev_min_ms->len > ms->len)) {
- prev_min_ms = ms;
- }