Use odp_pool_param_init() to initialize pool parameters. Also pktio test must use capability to determine maximum packet segment length.
Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com> --- example/generator/odp_generator.c | 2 +- test/common_plat/validation/api/crypto/crypto.c | 2 +- test/common_plat/validation/api/pktio/pktio.c | 21 +++++++++++++++------ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 48d7f5f..23dbd55 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -732,7 +732,7 @@ int main(int argc, char *argv[]) odp_timer_pool_start(); /* Create timeout pool */ - memset(¶ms, 0, sizeof(params)); + odp_pool_param_init(¶ms); params.tmo.num = tparams.num_timers; /* One timeout per timer */ params.type = ODP_POOL_TIMEOUT; diff --git a/test/common_plat/validation/api/crypto/crypto.c b/test/common_plat/validation/api/crypto/crypto.c index 8946cde..9c9a00d 100644 --- a/test/common_plat/validation/api/crypto/crypto.c +++ b/test/common_plat/validation/api/crypto/crypto.c @@ -43,7 +43,7 @@ int crypto_init(odp_instance_t *inst) return -1; } - memset(¶ms, 0, sizeof(params)); + odp_pool_param_init(¶ms); params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE; params.pkt.len = SHM_PKT_POOL_BUF_SIZE; params.pkt.num = SHM_PKT_POOL_SIZE / SHM_PKT_POOL_BUF_SIZE; diff --git a/test/common_plat/validation/api/pktio/pktio.c b/test/common_plat/validation/api/pktio/pktio.c index a6a18c3..befaa7e 100644 --- a/test/common_plat/validation/api/pktio/pktio.c +++ b/test/common_plat/validation/api/pktio/pktio.c @@ -310,7 +310,7 @@ static int default_pool_create(void) if (default_pkt_pool != ODP_POOL_INVALID) return -1; - memset(¶ms, 0, sizeof(params)); + odp_pool_param_init(¶ms); set_pool_len(¶ms); params.pkt.num = PKT_BUF_NUM; params.type = ODP_POOL_PACKET; @@ -1669,10 +1669,11 @@ int pktio_check_send_failure(void) odp_pktio_close(pktio_tx); - if (mtu <= pool_capa.pkt.max_len - 32) - return ODP_TEST_ACTIVE; + /* Failure test supports only single segment */ + if (pool_capa.pkt.max_seg_len < mtu + 32) + return ODP_TEST_INACTIVE; - return ODP_TEST_INACTIVE; + return ODP_TEST_ACTIVE; } void pktio_test_send_failure(void) @@ -1687,6 +1688,7 @@ void pktio_test_send_failure(void) int long_pkt_idx = TX_BATCH_LEN / 2; pktio_info_t info_rx; odp_pktout_queue_t pktout; + odp_pool_capability_t pool_capa; pktio_tx = create_pktio(0, ODP_PKTIN_MODE_DIRECT, ODP_PKTOUT_MODE_DIRECT); @@ -1705,9 +1707,16 @@ void pktio_test_send_failure(void) _pktio_wait_linkup(pktio_tx); + CU_ASSERT_FATAL(odp_pool_capability(&pool_capa) == 0); + + if (pool_capa.pkt.max_seg_len < mtu + 32) { + CU_FAIL("Max packet seg length is too small."); + return; + } + /* configure the pool so that we can generate test packets larger * than the interface MTU */ - memset(&pool_params, 0, sizeof(pool_params)); + odp_pool_param_init(&pool_params); pool_params.pkt.len = mtu + 32; pool_params.pkt.seg_len = pool_params.pkt.len; pool_params.pkt.num = TX_BATCH_LEN + 1; @@ -1996,7 +2005,7 @@ static int create_pool(const char *iface, int num) char pool_name[ODP_POOL_NAME_LEN]; odp_pool_param_t params; - memset(¶ms, 0, sizeof(params)); + odp_pool_param_init(¶ms); set_pool_len(¶ms); params.pkt.num = PKT_BUF_NUM; params.type = ODP_POOL_PACKET; -- 2.8.1