Skip to content

Commit

Permalink
app/tests: add dhcp option (#282)
Browse files Browse the repository at this point in the history
Signed-off-by: Ric Li <ming3.li@intel.com>
  • Loading branch information
ricmli committed May 22, 2023
1 parent cea105f commit e1936dc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ enum st_args_cmd {
ST_ARG_AUDIO_BUILD_PACING,
ST_ARG_AUDIO_FIFO_SIZE,
ST_ARG_TX_NO_BURST_CHECK,
ST_ARG_DHCP,
ST_ARG_MAX,
};

Expand Down Expand Up @@ -199,6 +200,7 @@ static struct option st_app_args_options[] = {
{"audio_build_pacing", no_argument, 0, ST_ARG_AUDIO_BUILD_PACING},
{"audio_fifo_size", required_argument, 0, ST_ARG_AUDIO_FIFO_SIZE},
{"tx_no_burst_check", no_argument, 0, ST_ARG_TX_NO_BURST_CHECK},
{"dhcp", no_argument, 0, ST_ARG_DHCP},

{0, 0, 0, 0}};

Expand Down Expand Up @@ -605,6 +607,10 @@ int st_app_parse_args(struct st_app_context* ctx, struct mtl_init_params* p, int
case ST_ARG_AUDIO_FIFO_SIZE:
ctx->tx_audio_fifo_size = atoi(optarg);
break;
case ST_ARG_DHCP:
for (int port = 0; port < MTL_PORT_MAX; ++port)
p->net_proto[port] = MTL_PROTO_DHCP;
break;
case '?':
break;
default:
Expand Down
1 change: 1 addition & 0 deletions doc/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ For the supported parameters in the json, please refer to [JSON configuration gu
--tx_no_chain : debug option, use memcopy rather than mbuf chain for tx payload.
--multi_src_port : debug option, use multiple src port for st20 tx stream.
--audio_fifo_size <count> : debug option, the audio fifo size between packet builder and pacing.
--dhcp : debug option, enable DHCP for all ports.
```
## 4. Tests
Expand Down
6 changes: 6 additions & 0 deletions tests/src/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ enum test_args_cmd {
TEST_ARG_TX_NO_CHAIN,
TEST_ARG_IOVA_MODE,
TEST_ARG_MULTI_SRC_PORT,
TEST_ARG_DHCP,
};

static struct option test_args_options[] = {
Expand Down Expand Up @@ -78,6 +79,7 @@ static struct option test_args_options[] = {
{"tx_no_chain", no_argument, 0, TEST_ARG_TX_NO_CHAIN},
{"iova_mode", required_argument, 0, TEST_ARG_IOVA_MODE},
{"multi_src_port", no_argument, 0, TEST_ARG_MULTI_SRC_PORT},
{"dhcp", no_argument, 0, TEST_ARG_DHCP},

{0, 0, 0, 0}};

Expand Down Expand Up @@ -264,6 +266,10 @@ static int test_parse_args(struct st_tests_context* ctx, struct mtl_init_params*
case TEST_ARG_MULTI_SRC_PORT:
p->flags |= MTL_FLAG_MULTI_SRC_PORT;
break;
case TEST_ARG_DHCP:
for (int port = 0; port < MTL_PORT_MAX; ++port)
p->net_proto[port] = MTL_PROTO_DHCP;
break;
default:
break;
}
Expand Down

0 comments on commit e1936dc

Please sign in to comment.