diff options
author | Petri Savolainen <petri.savolainen@linaro.org> | 2018-02-20 09:53:24 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2018-02-28 20:40:54 +0300 |
commit | f294fd186fa42b9c5dfa33820c3992230708a2ea (patch) | |
tree | d9e2ca97e2cd2de6fcdd095d8f8c228bf68fa445 /helper/cuckootable.c | |
parent | e0934ef22cb60d1b27766c1dfea61afc93109e8b (diff) |
helper: cuckoo: check pool and queue limits
Use capability to check if pool and queue can hold enough events.
Also lower test case resource requirement.
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 'helper/cuckootable.c')
-rw-r--r-- | helper/cuckootable.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/helper/cuckootable.c b/helper/cuckootable.c index 1dc43b57b..febfa28ed 100644 --- a/helper/cuckootable.c +++ b/helper/cuckootable.c @@ -184,6 +184,8 @@ odph_cuckoo_table_create( odp_queue_t queue; odp_queue_param_t qparam; + odp_queue_capability_t qcapa; + odp_pool_capability_t pcapa; char pool_name[ODPH_TABLE_NAME_LEN + 3], queue_name[ODPH_TABLE_NAME_LEN + 3]; @@ -191,6 +193,26 @@ odph_cuckoo_table_create( uint32_t impl_size, kv_entry_size, bucket_num, bucket_size; + if (odp_queue_capability(&qcapa)) { + ODPH_DBG("queue capa failed\n"); + return NULL; + } + + if (qcapa.plain.max_size && qcapa.plain.max_size < capacity) { + ODPH_DBG("queue max_size too small\n"); + return NULL; + } + + if (odp_pool_capability(&pcapa)) { + ODPH_DBG("pool capa failed\n"); + return NULL; + } + + if (pcapa.buf.max_num && pcapa.buf.max_num < capacity) { + ODPH_DBG("pool max_num too small\n"); + return NULL; + } + /* Check for valid parameters */ if ( (capacity > HASH_ENTRIES_MAX) || |