Previously packet_test_concatsplit() could fail on some pool
implementations as the pool ran out of buffers. Increase default pools size
and use capability to make sure the value is valid.

Signed-off-by: Matias Elo <matias....@nokia.com>
---
V2:
- Add define PACKET_POOL_NUM for test packet pool size (Bala)

 test/common_plat/validation/api/packet/packet.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/common_plat/validation/api/packet/packet.c 
b/test/common_plat/validation/api/packet/packet.c
index 900c426..6ebc1fe 100644
--- a/test/common_plat/validation/api/packet/packet.c
+++ b/test/common_plat/validation/api/packet/packet.c
@@ -13,6 +13,8 @@
 #define PACKET_BUF_LEN ODP_CONFIG_PACKET_SEG_LEN_MIN
 /* Reserve some tailroom for tests */
 #define PACKET_TAILROOM_RESERVE  4
+/* Number of packets in the test packet pool */
+#define PACKET_POOL_NUM 200
 
 static odp_pool_t packet_pool, packet_pool_no_uarea, packet_pool_double_uarea;
 static uint32_t packet_len;
@@ -109,6 +111,7 @@ int packet_suite_init(void)
        uint32_t udat_size;
        uint8_t data = 0;
        uint32_t i;
+       uint32_t num = PACKET_POOL_NUM;
 
        if (odp_pool_capability(&capa) < 0) {
                printf("pool_capability failed\n");
@@ -128,13 +131,15 @@ int packet_suite_init(void)
                segmented_packet_len = capa.pkt.min_seg_len *
                                       capa.pkt.max_segs_per_pkt;
        }
+       if (capa.pkt.max_num != 0 && capa.pkt.max_num < num)
+               num = capa.pkt.max_num;
 
        odp_pool_param_init(&params);
 
        params.type           = ODP_POOL_PACKET;
        params.pkt.seg_len    = capa.pkt.min_seg_len;
        params.pkt.len        = capa.pkt.min_seg_len;
-       params.pkt.num        = 100;
+       params.pkt.num        = num;
        params.pkt.uarea_size = sizeof(struct udata_struct);
 
        packet_pool = odp_pool_create("packet_pool", &params);
-- 
2.7.4

Reply via email to