aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@linaro.org>2018-02-20 10:54:46 +0200
committerMaxim Uvarov <maxim.uvarov@linaro.org>2018-02-28 20:40:55 +0300
commit0307f9337d1061bbd9afc415a592fcb3c8c57c21 (patch)
treea5fc2987a9ff0e7d832abf64c25214c7fb448800 /test
parentf13f74ec048ecf2252d6fef68611e813bc294305 (diff)
test: pktio_ordered: honour max queue size
Limit maximum number of events to maximum pool and queue capability when needed. Pool size should not be larger than queue size as test run in validation suite suffers from queue enqueue failures (queue full) and sequence number checking does not pass due to that. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'test')
-rw-r--r--test/performance/odp_pktio_ordered.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c
index af2e95745..5647b1eb5 100644
--- a/test/performance/odp_pktio_ordered.c
+++ b/test/performance/odp_pktio_ordered.c
@@ -75,12 +75,12 @@
#define JHASH_GOLDEN_RATIO 0x9e3779b9
+/* Maximum pool and queue size */
+#define MAX_NUM_PKT (8 * 1024)
+
/** Maximum number of worker threads */
#define MAX_WORKERS 64
-/** Number of packet buffers in the memory pool */
-#define PKT_POOL_SIZE 8192
-
/** Buffer size of the packet pool buffer in bytes*/
#define PKT_POOL_BUF_SIZE 1856
@@ -93,9 +93,6 @@
/** Maximum number of pktio queues per interface */
#define MAX_QUEUES 32
-/** Seems to need at least 8192 elements per queue */
-#define QUEUE_SIZE 8192
-
/** Maximum number of pktio interfaces */
#define MAX_PKTIOS 8
@@ -1074,7 +1071,8 @@ int main(int argc, char *argv[])
odp_pool_t pool;
odp_pool_param_t params;
odp_shm_t shm;
- odp_queue_capability_t capa;
+ odp_queue_capability_t queue_capa;
+ odp_pool_capability_t pool_capa;
odph_ethaddr_t new_addr;
odph_odpthread_t thread_tbl[MAX_WORKERS];
stats_t *stats;
@@ -1085,6 +1083,7 @@ int main(int argc, char *argv[])
int ret;
int num_workers;
int in_mode;
+ uint32_t queue_size, pool_size;
/* Init ODP before calling anything else */
if (odp_init_global(&instance, NULL, NULL)) {
@@ -1098,6 +1097,16 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
+ if (odp_queue_capability(&queue_capa)) {
+ LOG_ERR("Error: Queue capa failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (odp_pool_capability(&pool_capa)) {
+ LOG_ERR("Error: Pool capa failed\n");
+ exit(EXIT_FAILURE);
+ }
+
/* Reserve memory for args from shared mem */
shm = odp_shm_reserve("shm_args", sizeof(args_t),
ODP_CACHE_LINE_SIZE, 0);
@@ -1121,8 +1130,7 @@ int main(int argc, char *argv[])
if (gbl_args->appl.in_mode == SCHED_ORDERED) {
/* At least one ordered lock required */
- odp_queue_capability(&capa);
- if (capa.max_ordered_locks < 1) {
+ if (queue_capa.max_ordered_locks < 1) {
LOG_ERR("Error: Ordered locks not available.\n");
exit(EXIT_FAILURE);
}
@@ -1145,11 +1153,25 @@ int main(int argc, char *argv[])
printf("First CPU: %i\n", odp_cpumask_first(&cpumask));
printf("CPU mask: %s\n\n", cpumaskstr);
+ pool_size = MAX_NUM_PKT;
+ if (pool_capa.pkt.max_num && pool_capa.pkt.max_num < MAX_NUM_PKT)
+ pool_size = pool_capa.pkt.max_num;
+
+ queue_size = MAX_NUM_PKT;
+ if (queue_capa.sched.max_size &&
+ queue_capa.sched.max_size < MAX_NUM_PKT)
+ queue_size = queue_capa.sched.max_size;
+
+ /* Pool should not be larger than queue, otherwise queue enqueues at
+ * packet input may fail. */
+ if (pool_size > queue_size)
+ pool_size = queue_size;
+
/* Create packet pool */
odp_pool_param_init(&params);
params.pkt.seg_len = PKT_POOL_BUF_SIZE;
params.pkt.len = PKT_POOL_BUF_SIZE;
- params.pkt.num = PKT_POOL_SIZE;
+ params.pkt.num = pool_size;
params.pkt.uarea_size = PKT_UAREA_SIZE;
params.type = ODP_POOL_PACKET;
@@ -1225,7 +1247,7 @@ int main(int argc, char *argv[])
qparam.sched.prio = ODP_SCHED_PRIO_DEFAULT;
qparam.sched.sync = ODP_SCHED_SYNC_ATOMIC;
qparam.sched.group = ODP_SCHED_GROUP_ALL;
- qparam.size = QUEUE_SIZE;
+ qparam.size = queue_size;
gbl_args->flow_qcontext[i][j].idx = i;
gbl_args->flow_qcontext[i][j].input_queue = 0;