diff options
author | Tuomas Taipale <tuomas.taipale@nokia.com> | 2022-11-22 07:35:49 +0000 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2022-11-25 09:19:15 +0200 |
commit | 94ca3d0a68583ab7ef1bcc712349cae3f7186e93 (patch) | |
tree | 9435c5bae73ff0f263dab986602a2df92c025bab /test | |
parent | bd02f4345ce2f4c5e98a1f88ff6c3d3f28e22bef (diff) |
test: dma_perf: retry DMA transfers if resources temporarily unavailable
DMA transfers can occasionally not start in both synchronous and
asynchronous cases due to resources being temporarily unavailable.
Take this into account in tester logic and retry as long as this is the
case.
Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/performance/odp_dma_perf.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/test/performance/odp_dma_perf.c b/test/performance/odp_dma_perf.c index 0decdac08..3b0c01e73 100644 --- a/test/performance/odp_dma_perf.c +++ b/test/performance/odp_dma_perf.c @@ -723,6 +723,7 @@ static int run_dma_sync(test_config_t *config) uint32_t trs_lengths[config->dma_rounds]; odp_time_t start, end; uint32_t num_rounds = config->num_rounds, offset; + int done = 0; config->test_case_api.trs_base_fn(config, trs_params, trs_lengths); start = odp_time_local_strict(); @@ -733,8 +734,16 @@ static int run_dma_sync(test_config_t *config) for (int i = 0; i < config->dma_rounds; ++i) { config->test_case_api.trs_dyn_fn(config, offset, trs_lengths[i]); - if (odp_dma_transfer(config->dma_config.handle, &trs_params[i], NULL) - <= 0) { + while (1) { + done = odp_dma_transfer(config->dma_config.handle, &trs_params[i], + NULL); + + if (done > 0) + break; + + if (done == 0) + continue; + ODPH_ERR("Error starting a sync DMA transfer.\n"); return -1; } @@ -916,7 +925,7 @@ static int run_dma_async_transfer(test_config_t *config) odp_dma_transfer_param_t trs_params[config->dma_rounds]; uint32_t trs_lengths[config->dma_rounds]; odp_dma_compl_param_t compl_params[config->dma_rounds]; - int ret = 0; + int ret = 0, started; compl_wait_entry_t compl_wait_list[config->dma_rounds]; odp_time_t start, end; uint32_t num_rounds = config->num_rounds, offset; @@ -937,8 +946,16 @@ static int run_dma_async_transfer(test_config_t *config) for (int i = 0; i < config->dma_rounds; ++i) { config->test_case_api.trs_dyn_fn(config, offset, trs_lengths[i]); - if (odp_dma_transfer_start(config->dma_config.handle, &trs_params[i], - &compl_params[i]) <= 0) { + while (1) { + started = odp_dma_transfer_start(config->dma_config.handle, + &trs_params[i], &compl_params[i]); + + if (started > 0) + break; + + if (started == 0) + continue; + ODPH_ERR("Error starting an async DMA transfer.\n"); ret = -1; goto out_trs_ids; |