Skip to content

Commit

Permalink
test: dmafwd: add return value for unsupported features
Browse files Browse the repository at this point in the history
Add new return value for tester to indicate that program exit was due to
implementation not supporting certain features. This is useful e.g. in
CI context where test runs can be skipped in case of lacking feature
set.

Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com>
  • Loading branch information
TuomasTaipale committed Aug 25, 2023
1 parent 2c6aafa commit 6aa73d4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/performance/odp_dmafwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <odp_api.h>
#include <odp/helper/odph_api.h>

#define EXIT_NOT_SUP 2
#define PROG_NAME "odp_dmafwd"
#define DELIMITER ","

Expand Down Expand Up @@ -60,7 +61,8 @@ typedef struct {
typedef enum {
PRS_OK,
PRS_NOK,
PRS_TERM
PRS_TERM,
PRS_NOT_SUP
} parse_result_t;

typedef struct prog_config_s prog_config_t;
Expand Down Expand Up @@ -287,7 +289,7 @@ static parse_result_t check_options(prog_config_t *config)
if ((uint32_t)config->num_thrs > dma_capa.max_sessions) {
ODPH_ERR("Not enough DMA sessions supported: %d (max: %u)\n", config->num_thrs,
dma_capa.max_sessions);
return PRS_NOK;
return PRS_NOT_SUP;
}

burst_size = MIN(dma_capa.max_src_segs, dma_capa.max_dst_segs);
Expand All @@ -308,7 +310,7 @@ static parse_result_t check_options(prog_config_t *config)
if ((dma_capa.compl_mode_mask & ODP_DMA_COMPL_EVENT) == 0U || !dma_capa.queue_type_sched) {
ODPH_ERR("Unsupported completion mode (mode support: %x, scheduled queue "
"support: %u\n", dma_capa.compl_mode_mask, dma_capa.queue_type_sched);
return PRS_NOK;
return PRS_NOT_SUP;
}

if ((uint32_t)config->num_thrs > dma_capa.pool.max_pools) {
Expand Down Expand Up @@ -1090,6 +1092,11 @@ int main(int argc, char **argv)
goto out_test;
}

if (parse_res == PRS_NOT_SUP) {
ret = EXIT_NOT_SUP;
goto out_test;
}

if (odp_schedule_config(NULL) < 0) {
ODPH_ERR("Error configuring scheduler\n");
ret = EXIT_FAILURE;
Expand Down

0 comments on commit 6aa73d4

Please sign in to comment.