1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2022 Intel Corporation.
5 #include <rte_pmd_ice.h>
7 #include <cmdline_parse_num.h>
8 #include <cmdline_parse_string.h>
12 /* Fixed size for ICE ddp runtime configure */
13 #define ICE_BUFF_SIZE 0x000c9000
15 /* Dump device ddp package, only for ice PF */
16 struct cmd_ddp_dump_result {
17 cmdline_fixed_string_t ddp;
18 cmdline_fixed_string_t add;
23 cmdline_parse_token_string_t cmd_ddp_dump_ddp =
24 TOKEN_STRING_INITIALIZER(struct cmd_ddp_dump_result, ddp, "ddp");
25 cmdline_parse_token_string_t cmd_ddp_dump_dump =
26 TOKEN_STRING_INITIALIZER(struct cmd_ddp_dump_result, add, "dump");
27 cmdline_parse_token_num_t cmd_ddp_dump_port_id =
28 TOKEN_NUM_INITIALIZER(struct cmd_ddp_dump_result, port_id, RTE_UINT16);
29 cmdline_parse_token_string_t cmd_ddp_dump_filepath =
30 TOKEN_STRING_INITIALIZER(struct cmd_ddp_dump_result, filepath, NULL);
33 cmd_ddp_dump_parsed(void *parsed_result,
34 __rte_unused struct cmdline *cl,
35 __rte_unused void *data)
37 struct cmd_ddp_dump_result *res = parsed_result;
43 buff = (uint8_t *)malloc(ICE_BUFF_SIZE);
45 ret = rte_pmd_ice_dump_package(res->port_id, &buff, &size);
48 save_file(res->filepath, buff, size);
51 fprintf(stderr, "Invalid buffer size\n");
55 "Device doesn't support "
56 "dump DDP runtime configure.\n");
60 "Failed to dump DDP runtime configure,"
61 " error: (%s)\n", strerror(-ret));
67 cmdline_parse_inst_t cmd_ddp_dump = {
68 .f = cmd_ddp_dump_parsed,
70 .help_str = "ddp dump <port_id> <config_path>",
72 (void *)&cmd_ddp_dump_ddp,
73 (void *)&cmd_ddp_dump_dump,
74 (void *)&cmd_ddp_dump_port_id,
75 (void *)&cmd_ddp_dump_filepath,
80 static struct testpmd_driver_commands ice_cmds = {
84 "ddp dump (port_id) (config_path)\n"
85 " Dump a runtime configure on a port\n\n",
91 TESTPMD_ADD_DRIVER_COMMANDS(ice_cmds)