31 #include <cmdline_parse.h>
32 #include <cmdline_parse_num.h>
33 #include <cmdline_parse_string.h>
34 #include <cmdline_socket.h>
35 #include <rte_byteorder.h>
44 #define MAX_CMDLINE_INPUT_LEN 512
45 #define MAC_ADDR_LEN 6
47 #define MAX_FIELD_INPUT_LEN 128
48 #define NAME_STR_LEN 5
50 #define MISS_FWD_STR_LEN 9
51 #define MATCH_MASK_STR_LEN 11
52 #define MONITOR_STR_LEN 8
53 #define ROOT_ENABLE_STR_LEN 12
54 #define PORT_ID_STR_LEN 8
55 #define PIPE_ID_STR_LEN 8
56 #define ENTRY_ID_STR_LEN 9
57 #define PIPE_QUEUE_STR_LEN 11
58 #define PRIORITY_STR_LEN 9
59 #define FILE_STR_LEN 5
60 #define TYPE_STR_LEN 5
61 #define HEXADECIMAL_BASE 1
62 #define UINT32_CHANGEABLE_FIELD "0xffffffff"
64 #define BE_IPV4_ADDR(a, b, c, d) (RTE_BE32((a << 24) + (b << 16) + (c << 8) + d))
67 #define SET_L4_PORT(layer, port, value) \
69 if (match->layer.l4_type_ext == DOCA_FLOW_L4_TYPE_EXT_TCP) \
70 match->layer.tcp.l4_port.port = (value); \
71 else if (match->layer.l4_type_ext == DOCA_FLOW_L4_TYPE_EXT_UDP) \
72 match->layer.udp.l4_port.port = (value); \
125 cmdline_fixed_string_t
add;
132 cmdline_fixed_string_t
add;
147 cmdline_fixed_string_t
rm;
264 memset(&
fwd, 0,
sizeof(
fwd));
275 *ipv4_addr = UINT32_MAX;
278 for (i = 0; i < 3; i++) {
279 ips[i] = atoi(str_ip);
280 ptr = strchr(str_ip,
'.');
288 *ipv4_addr =
BE_IPV4_ADDR(ips[0], ips[1], ips[2], ips[3]);
294 if (strcmp(protocol_str,
"tcp") == 0)
296 else if (strcmp(protocol_str,
"udp") == 0)
299 DOCA_LOG_ERR(
"Protocol type %s is not supported", protocol_str);
315 DOCA_LOG_ERR(
"Wrong format of pipe id string: \'pipe_id=<pipe_id>\'");
319 *pipe_id = strtoull(pipe_id_str,
NULL, 0);
333 DOCA_LOG_ERR(
"Wrong format of port id string: \'port_id=<port_id>\'");
337 *port_id = strtol(port_id_str,
NULL, 0);
350 if (strcmp(tun_type_str,
"vxlan") == 0)
352 else if (strcmp(tun_type_str,
"gtpu") == 0)
354 else if (strcmp(tun_type_str,
"gre") == 0)
357 DOCA_LOG_ERR(
"Tunnel type %s is not supported", tun_type_str);
372 if (strcmp(fwd_str,
"rss") == 0)
374 else if (strcmp(fwd_str,
"port") == 0)
376 else if (strcmp(fwd_str,
"pipe") == 0)
378 else if (strcmp(fwd_str,
"drop") == 0)
396 if (strcmp(rss_type_str,
"shared") == 0)
398 else if (strcmp(rss_type_str,
"immediate") == 0)
401 DOCA_LOG_ERR(
"FWD rss type %s is not supported", rss_type_str);
416 struct doca_flow_pipe_cfg *
cfg,
421 if (strcmp(pipe_type,
"basic") == 0) {
428 }
else if (strcmp(pipe_type,
"control") == 0) {
436 DOCA_LOG_ERR(
"Pipe type %s is not supported", pipe_type);
451 if (strcmp(ip_type_str,
"ipv4") == 0)
453 else if (strcmp(ip_type_str,
"ipv6") == 0)
456 DOCA_LOG_ERR(
"IP type %s is not supported", ip_type_str);
471 if (strcmp(l3_type_str,
"ipv4") == 0)
473 else if (strcmp(l3_type_str,
"ipv6") == 0)
476 DOCA_LOG_ERR(
"IP type %s is not supported", l3_type_str);
491 if (strcmp(tcp_flag_str,
"FIN") == 0)
493 else if (strcmp(tcp_flag_str,
"SYN") == 0)
495 else if (strcmp(tcp_flag_str,
"RST") == 0)
497 else if (strcmp(tcp_flag_str,
"PSH") == 0)
499 else if (strcmp(tcp_flag_str,
"ACK") == 0)
501 else if (strcmp(tcp_flag_str,
"URG") == 0)
503 else if (strcmp(tcp_flag_str,
"ECE") == 0)
505 else if (strcmp(tcp_flag_str,
"CWR") == 0)
508 DOCA_LOG_ERR(
"TCP flag %s is not supported", tcp_flag_str);
528 ptr = strchr(mac_addr_str,
':');
530 mac_addr_str = ++ptr;
556 for (j = 0; j < 2; j++) {
565 ipv6_addr[i] = RTE_BE32((ips[0] << 16) + ips[1]);
583 rss_queues = malloc(
sizeof(uint16_t) * num_of_queues);
589 for (i = 0; i < num_of_queues - 1; i++) {
591 rss_queues_str = rss_queues_str + 2;
610 if (strcmp(field_name,
"flags") == 0) {
616 }
else if (strcmp(field_name,
"cir") == 0) {
618 }
else if (strcmp(field_name,
"cbs") == 0) {
620 }
else if (strcmp(field_name,
"aging_sec") == 0) {
623 DOCA_LOG_ERR(
"The %s is not supported field in monitor", field_name);
642 if (strcmp(field_name,
"type") == 0) {
646 }
else if (strcmp(field_name,
"rss_type") == 0) {
650 }
else if (strcmp(field_name,
"rss_outer_flags") == 0)
652 else if (strcmp(field_name,
"rss_inner_flags") == 0)
655 else if (strcmp(field_name,
"rss_queues") == 0) {
660 }
else if (strcmp(field_name,
"num_of_queues") == 0)
663 else if (strcmp(field_name,
"port_id") == 0)
666 else if (strcmp(field_name,
"next_pipe_id") == 0)
670 DOCA_LOG_ERR(
"The %s is not supported field in fwd", field_name);
689 if (strcmp(field_name,
"type") == 0) {
693 }
else if (strcmp(field_name,
"rss_type") == 0) {
697 }
else if (strcmp(field_name,
"rss_outer_flags") == 0)
699 else if (strcmp(field_name,
"rss_inner_flags") == 0)
702 else if (strcmp(field_name,
"rss_queues") == 0) {
707 }
else if (strcmp(field_name,
"num_of_queues") == 0)
710 else if (strcmp(field_name,
"port_id") == 0)
713 else if (strcmp(field_name,
"next_pipe_id") == 0)
717 DOCA_LOG_ERR(
"The %s is not supported field in fwd_miss", field_name);
736 if (strcmp(field_name,
"outer.eth.src_mac") == 0) {
740 }
else if (strcmp(field_name,
"outer.eth.dst_mac") == 0) {
744 }
else if (strcmp(field_name,
"outer.l3_type") == 0) {
748 }
else if (strcmp(field_name,
"outer.src_ip_addr") == 0) {
758 DOCA_LOG_ERR(
"Source IP type is not set, need to set IP type before address");
761 }
else if (strcmp(field_name,
"outer.dst_ip_addr") == 0) {
771 DOCA_LOG_ERR(
"Destination IP type is not set, need to set IP type before address");
774 }
else if (strcmp(field_name,
"outer.l4_type_ext") == 0) {
778 }
else if (strcmp(field_name,
"outer.tcp_src_port") == 0)
781 else if (strcmp(field_name,
"outer.tcp_dst_port") == 0)
784 else if (strcmp(field_name,
"outer.udp_src_port") == 0)
787 else if (strcmp(field_name,
"outer.udp_dst_port") == 0)
790 else if (strcmp(field_name,
"outer.ip4.ttl") == 0)
793 else if (strcmp(field_name,
"encap_src_mac") == 0) {
797 }
else if (strcmp(field_name,
"encap_dst_mac") == 0) {
801 }
else if (strcmp(field_name,
"encap_src_ip_type") == 0) {
805 }
else if (strcmp(field_name,
"encap_src_ip_addr") == 0) {
815 DOCA_LOG_ERR(
"Encap source IP type is not set, need to set IP type before address");
818 }
else if (strcmp(field_name,
"encap_dst_ip_type") == 0) {
822 }
else if (strcmp(field_name,
"encap_dst_ip_addr") == 0) {
832 DOCA_LOG_ERR(
"Encap destination IP type is not set, need to set IP type before address");
835 }
else if (strcmp(field_name,
"encap_tun_type") == 0) {
839 }
else if (strcmp(field_name,
"encap_vxlan_tun_id") == 0)
842 else if (strcmp(field_name,
"encap_gre_key") == 0)
845 else if (strcmp(field_name,
"encap_gtp_teid") == 0)
849 DOCA_LOG_ERR(
"The %s is not supported field in actions", field_name);
868 if (strcmp(field_name,
"flags") == 0)
871 else if (strcmp(field_name,
"port_meta") == 0)
874 else if (strcmp(field_name,
"outer.eth.src_mac") == 0) {
878 }
else if (strcmp(field_name,
"outer.eth.dst_mac") == 0) {
882 }
else if (strcmp(field_name,
"outer.eth.type") == 0)
885 else if (strcmp(field_name,
"outer.eth_vlan[0].tci") == 0)
888 else if (strcmp(field_name,
"outer.eth_vlan[1].tci") == 0)
891 else if (strcmp(field_name,
"outer.l3_type") == 0) {
895 }
else if (strcmp(field_name,
"outer.src_ip_addr") == 0) {
905 DOCA_LOG_ERR(
"Source IP type is not set, need to set IP type before address");
908 }
else if (strcmp(field_name,
"outer.dst_ip_addr") == 0) {
918 DOCA_LOG_ERR(
"Destination IP type is not set, need to set IP type before address");
921 }
else if (strcmp(field_name,
"outer.l4_type_ext") == 0) {
925 }
else if (strcmp(field_name,
"outer.tcp.flags") == 0) {
929 }
else if (strcmp(field_name,
"outer.tcp_src_port") == 0) {
931 }
else if (strcmp(field_name,
"outer.tcp_dst_port") == 0) {
933 }
else if (strcmp(field_name,
"outer.udp_src_port") == 0) {
935 }
else if (strcmp(field_name,
"outer.udp_dst_port") == 0) {
937 }
else if (strcmp(field_name,
"tun_type") == 0) {
941 }
else if (strcmp(field_name,
"vxlan_tun_id") == 0)
944 else if (strcmp(field_name,
"gre_key") == 0)
947 else if (strcmp(field_name,
"gtp_teid") == 0)
950 else if (strcmp(field_name,
"inner.eth.src_mac") == 0) {
954 }
else if (strcmp(field_name,
"inner.eth.dst_mac") == 0) {
958 }
else if (strcmp(field_name,
"inner.eth.type") == 0)
961 else if (strcmp(field_name,
"inner.eth_vlan[0].tci") == 0)
964 else if (strcmp(field_name,
"inner.eth_vlan[1].tci") == 0)
967 else if (strcmp(field_name,
"inner.l3_type") == 0) {
971 }
else if (strcmp(field_name,
"inner.src_ip_addr") == 0) {
981 DOCA_LOG_ERR(
"Inner source IP type is not set, need to set IP type before address");
984 }
else if (strcmp(field_name,
"inner.dst_ip_addr") == 0) {
994 DOCA_LOG_ERR(
"Inner destination IP type is not set, need to set IP type before address");
997 }
else if (strcmp(field_name,
"inner.l4_type_ext") == 0) {
1001 }
else if (strcmp(field_name,
"inner.tcp.flags") == 0) {
1005 }
else if (strcmp(field_name,
"inner.tcp_src_port") == 0) {
1007 }
else if (strcmp(field_name,
"inner.tcp_dst_port") == 0) {
1009 }
else if (strcmp(field_name,
"inner.udp_src_port") == 0) {
1011 }
else if (strcmp(field_name,
"inner.udp_dst_port") == 0) {
1014 DOCA_LOG_ERR(
"The %s is not supported field in match", field_name);
1034 if (strcmp(field_name,
"outer.src_ip_addr") == 0) {
1038 }
else if (strcmp(field_name,
"outer.dst_ip_addr") == 0) {
1042 }
else if (strcmp(field_name,
"outer.l4_type_ext") == 0) {
1046 }
else if (strcmp(field_name,
"outer.tcp_src_port") == 0) {
1048 }
else if (strcmp(field_name,
"outer.tcp_dst_port") == 0) {
1050 }
else if (strcmp(field_name,
"outer.udp_src_port") == 0) {
1052 }
else if (strcmp(field_name,
"outer.udp_dst_port") == 0) {
1055 DOCA_LOG_ERR(
"The %s is not supported field in match", field_name);
1082 tmp = strtok(ptr,
"=");
1084 DOCA_LOG_ERR(
"Invalid format for create struct command");
1088 struct_str += strlen(field_name) + 1;
1091 tmp = strtok(ptr,
",");
1093 DOCA_LOG_ERR(
"Invalid format for create struct command");
1098 DOCA_LOG_DBG(
"The parsing result are field_name: %s, value: %s", field_name,
value);
1100 struct_str += strlen(
value);
1101 tmp_char = struct_str[0];
1103 result = (*fill_struct)(field_name,
value, struct_ptr);
1107 }
while (tmp_char ==
',');
1125 *params_str += param_str_len;
1127 value = strtol(*params_str, &ptr, 0);
1128 if (ptr == *params_str)
1131 *take_action =
true;
1132 else if (
value != 0)
1152 struct doca_flow_pipe_cfg *
cfg,
1154 bool *fwd_miss_action,
1155 bool *is_match_mask,
1160 char *param_str_value;
1165 bool has_port_id =
false;
1166 bool take_action =
false;
1172 value = strtol(ptr, &end, 0);
1177 param_str_value = strtok(ptr,
",");
1178 params_str += strlen(param_str_value);
1181 }
else if (strncmp(params_str,
"name=",
NAME_STR_LEN) == 0) {
1184 param_str_value = strtok(ptr,
",");
1185 params_str += strlen(param_str_value);
1194 DOCA_LOG_ERR(
"The param root_enable must be 1 for using or 0 for not");
1200 DOCA_LOG_ERR(
"Failed to set doca_flow_pipe_cfg is_root: %s",
1205 take_action =
false;
1209 DOCA_LOG_ERR(
"Monitor must be 1 for using or 0 for not");
1215 DOCA_LOG_ERR(
"Failed to set doca_flow_pipe_cfg monitor: %s",
1220 take_action =
false;
1224 DOCA_LOG_ERR(
"The param match_mask value must be 1 for using or 0 for not");
1228 *is_match_mask =
true;
1229 take_action =
false;
1233 DOCA_LOG_ERR(
"The param fwd_miss value must be 1 for using or 0 for not");
1236 }
else if (strncmp(params_str,
"fwd=",
FWD_STR_LEN) == 0) {
1239 DOCA_LOG_ERR(
"FWD value must be 1 for using or 0 for not");
1242 }
else if (strncmp(params_str,
"type=",
TYPE_STR_LEN) == 0) {
1245 type_str = strtok(ptr,
",");
1249 params_str += strlen(type_str);
1252 param_str_value = strtok(ptr,
"=");
1253 DOCA_LOG_ERR(
"The %s is not a valid parameter for create pipe command", param_str_value);
1256 tmp_char = params_str[0];
1258 }
while (tmp_char ==
',');
1261 DOCA_LOG_ERR(
"The param port_id is a mandatory input and was not given");
1279 bool *monitor_action,
1287 char *param_str_name;
1288 bool has_pipe_id =
false;
1289 bool has_pipe_queue =
false;
1294 *pipe_id = strtoull(tmp, ¶ms_str, 0);
1299 *pipe_queue = strtol(tmp, ¶ms_str, 0);
1300 has_pipe_queue =
true;
1304 DOCA_LOG_ERR(
"FWD value must be 1 for using or 0 for not");
1307 }
else if (strncmp(params_str,
"fwd=",
FWD_STR_LEN) == 0) {
1310 DOCA_LOG_ERR(
"FWD value must be 1 for using or 0 for not");
1315 param_str_name = strtok(ptr,
"=");
1316 DOCA_LOG_ERR(
"The %s is not a valid parameter for pipe add entry command", param_str_name);
1319 tmp_char = params_str[0];
1321 }
while (tmp_char ==
',');
1324 DOCA_LOG_ERR(
"The param pipe_id is a mandatory input and was not given");
1328 if (!has_pipe_queue) {
1329 DOCA_LOG_ERR(
"The param pipe_queue is a mandatory input and was not given");
1345 char *param_str_name;
1346 bool has_port_id =
false;
1352 *port_id = strtoull(tmp, ¶ms_str, 0);
1355 param_str_name = strtok(params_str,
"=");
1356 DOCA_LOG_ERR(
"The %s is not a valid parameter for pipe add entry command", param_str_name);
1361 DOCA_LOG_ERR(
"The param port_id is a mandatory input and was not given");
1381 bool *match_mask_action,
1383 uint16_t *pipe_queue,
1388 char *param_str_name;
1390 bool has_pipe_id =
false;
1391 bool has_pipe_queue =
false;
1392 bool has_priority =
false;
1398 *pipe_id = strtoull(tmp, ¶ms_str, 0);
1403 *pipe_queue = strtol(tmp, ¶ms_str, 0);
1404 has_pipe_queue =
true;
1408 *priority = strtol(tmp, ¶ms_str, 0);
1409 has_priority =
true;
1413 DOCA_LOG_ERR(
"The param match_mask value must be 1 for using or 0 for not");
1416 }
else if (strncmp(params_str,
"fwd=",
FWD_STR_LEN) == 0) {
1419 DOCA_LOG_ERR(
"The param fwd value must be 1 for using or 0 for not");
1423 param_str_name = strtok(params_str,
"=");
1424 DOCA_LOG_ERR(
"The param %s is not a valid parameter for control pipe add entry command",
1428 tmp_char = params_str[0];
1430 }
while (tmp_char ==
',');
1433 DOCA_LOG_ERR(
"The param pipe_id is a mandatory input and was not given");
1437 if (!has_pipe_queue) {
1438 DOCA_LOG_ERR(
"The param pipe_queue is a mandatory input and was not given");
1442 if (!has_priority) {
1443 DOCA_LOG_ERR(
"Priority is a mandatory input and was not given");
1461 char *param_str_name;
1463 bool has_pipe_queue =
false;
1464 bool has_entry_id =
false;
1470 if (pipe_queue !=
NULL)
1471 *pipe_queue = strtol(tmp, ¶ms, 0);
1472 has_pipe_queue =
true;
1476 *entry_id = strtoull(tmp, ¶ms, 0);
1477 has_entry_id =
true;
1479 param_str_name = strtok(params,
"=");
1480 DOCA_LOG_ERR(
"The param %s is not a valid parameter for rm/query entry command",
1484 tmp_char = params[0];
1486 }
while (tmp_char ==
',');
1488 if (pipe_queue_mandatory && !has_pipe_queue) {
1489 DOCA_LOG_ERR(
"The param pipe_queue is a mandatory input and was not given");
1493 if (!has_entry_id) {
1494 DOCA_LOG_ERR(
"The param entry_id is a mandatory input and was not given");
1509 char *param_str_name;
1511 bool has_entry_id =
false;
1516 *entry_id = strtoull(tmp, ¶ms, 0);
1517 has_entry_id =
true;
1519 param_str_name = strtok(params,
"=");
1520 DOCA_LOG_ERR(
"The param %s is not a valid parameter for rm entry command", param_str_name);
1524 if (!has_entry_id) {
1525 DOCA_LOG_ERR(
"The param entry_id is a mandatory input and was not given");
1544 char *param_str_name;
1546 bool has_port_id =
false;
1547 bool has_file =
false;
1553 *port_id = strtol(tmp, ¶ms, 0);
1555 }
else if (strncmp(params,
"file=",
FILE_STR_LEN) == 0) {
1564 name = strtok(ptr,
",");
1565 params += strlen(name);
1566 *file = fopen(name,
"w");
1567 if (*file ==
NULL) {
1573 param_str_name = strtok(params,
"=");
1574 DOCA_LOG_ERR(
"The param %s is not a valid parameter for port pipes dump command",
1578 tmp_char = params[0];
1580 }
while (tmp_char ==
',');
1583 DOCA_LOG_ERR(
"The param port_id is a mandatory input and was not given");
1588 DOCA_LOG_DBG(
"The param file name was not given, default name is port_info.txt");
1589 *file = fopen(
"port_info.txt",
"w");
1590 if (*file ==
NULL) {
1608 struct doca_flow_pipe_cfg *pipe_cfg;
1610 bool is_fwd =
false;
1611 bool is_fwd_miss =
false;
1612 bool is_match_mask =
false;
1676 .help_str =
"create pipe port_id=[port_id],[optional params]",
1697 bool is_fwd =
false;
1698 bool is_monitor =
false;
1699 uint64_t pipe_id = 0;
1704 DOCA_LOG_ERR(
"Entry creation action was not inserted");
1718 (*add_entry_func)(pipe_queue,
1736 uint16_t port_id = 0;
1740 DOCA_LOG_ERR(
"Entry creation action was not inserted");
1767 .help_str =
"add entry pipe_id=[pipe_id],pipe_queue=[pipe_queue],[optional fields]",
1782 .help_str =
"add entry port_id=[port_id]",
1799 __rte_unused
struct cmdline *cl,
1800 __rte_unused
void *data)
1806 bool is_fwd =
false;
1807 bool is_match_mask =
false;
1808 uint64_t pipe_id = 0;
1809 uint16_t pipe_queue = 0;
1810 uint8_t priority = 0;
1814 DOCA_LOG_ERR(
"Control pipe entry creation action was not inserted");
1832 (*add_control_pipe_entry_func)(pipe_queue,
1862 "add control_pipe entry priority=[priority],port_id=[port_id],pipe_id=[pipe_id],pipe_queue=[pipe_queue],[optional fields]",
1886 DOCA_LOG_ERR(
"Pipe destruction action was not inserted");
1894 (*destroy_pipe_func)(pipe_id);
1913 .help_str =
"destroy pipe pipe_id=[pipe_id]",
1929 static void cmd_rm_entry_parsed(
void *parsed_result, __rte_unused
struct cmdline *cl, __rte_unused
void *data)
1932 uint64_t entry_id = 0;
1933 uint16_t pipe_queue = 0;
1937 DOCA_LOG_ERR(
"Entry destruction action was not inserted");
1956 uint64_t entry_id = 0;
1960 DOCA_LOG_ERR(
"Entry destruction action was not inserted");
1968 (*remove_fw_entry_func)(entry_id);
1987 .help_str =
"rm entry pipe_queue=[pipe_queue],entry_id=[entry_id]",
2002 .help_str =
"rm entry entry_id=[entry_id]",
2025 DOCA_LOG_ERR(
"Pipes flushing action was not inserted");
2033 (*port_pipes_flush_func)(
port_id);
2056 .help_str =
"port pipes flush port_id=[port_id]",
2073 static void cmd_query_parsed(
void *parsed_result, __rte_unused
struct cmdline *cl, __rte_unused
void *data)
2077 uint64_t entry_id = 0;
2089 (*query_func)(entry_id, &query_stats);
2107 .help_str =
"query entry_id=[entry_id]",
2125 uint16_t port_id = 0;
2141 (*port_pipes_dump_func)(port_id, fd);
2166 .help_str =
"port pipes dump port_id=[port_id],file=[file name]",
2187 if (strcmp(struct_data->
flow_struct,
"pipe_match") == 0) {
2190 }
else if (strcmp(struct_data->
flow_struct,
"entry_match") == 0) {
2193 }
else if (strcmp(struct_data->
flow_struct,
"match_mask") == 0) {
2196 }
else if (strcmp(struct_data->
flow_struct,
"actions") == 0) {
2199 }
else if (strcmp(struct_data->
flow_struct,
"monitor") == 0) {
2202 }
else if (strcmp(struct_data->
flow_struct,
"fwd") == 0) {
2203 memset(&
fwd, 0,
sizeof(
fwd));
2205 }
else if (strcmp(struct_data->
flow_struct,
"fwd_miss") == 0) {
2219 "pipe_match#entry_match#match_mask#actions#monitor#fwd#fwd_miss");
2229 "create pipe_match|entry_match|match_mask|actions|monitor|fwd|fwd_miss <struct fields>",
2265 "create entry_match <struct fields>",
2281 static void cmd_quit_parsed(__rte_unused
void *parsed_result,
struct cmdline *cl, __rte_unused
void *data)
2293 .help_str =
"Exit application",
2330 struct cmdline *cl =
NULL;
2335 cl = cmdline_stdin_new(
main_ctx, shell_prompt);
2341 cmdline_interact(cl);
2342 cmdline_stdin_exit(cl);
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
#define MAX_FIELD_INPUT_LEN
static doca_error_t parse_tun_type_string(const char *tun_type_str, enum doca_flow_tun_type *tun_type)
static cmdline_parse_token_string_t cmd_port_pipes_dump_port_tok
static cmdline_parse_token_string_t cmd_rm_entry_entry_tok
static doca_error_t parse_monitor_field(char *field_name, char *value, void *struct_ptr)
#define ROOT_ENABLE_STR_LEN
static doca_error_t parse_fw_match_field(char *field_name, char *value, void *struct_ptr)
static void cmd_fw_rm_entry_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
static struct doca_flow_fwd fwd_miss
static cmdline_parse_inst_t cmd_quit
static doca_error_t parse_fwd_field(char *field_name, char *value, void *struct_ptr)
static void(* port_pipes_flush_func)(uint16_t)
static cmdline_parse_inst_t cmd_add_entry
static cmdline_parse_token_string_t cmd_fw_create_struct_input_tok
static void cmd_query_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
static doca_error_t parse_mac_address(char *mac_addr_str, uint8_t *mac_addr)
static void cmd_create_pipe_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
static doca_error_t parse_entry_params(char *params, bool pipe_queue_mandatory, uint16_t *pipe_queue, uint64_t *entry_id)
static cmdline_parse_token_string_t cmd_destroy_pipe_params_tok
static struct doca_flow_match pipe_match
static void(* remove_entry_func)(uint16_t, uint64_t, uint32_t)
static cmdline_parse_token_string_t cmd_destroy_pipe_pipe_tok
static void cmd_add_entry_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
static cmdline_parse_token_string_t cmd_dump_pipe_params_tok
void set_pipe_control_add_entry(void(*action)(uint16_t, uint8_t, uint64_t, struct doca_flow_match *, struct doca_flow_match *, struct doca_flow_fwd *, uint64_t))
static doca_error_t parse_ipv6_str(const char *str_ip, doca_be32_t *ipv6_addr)
static doca_error_t parse_fwd_rss_type(const char *rss_type_str, enum doca_flow_resource_type *type)
static void cmd_rm_entry_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
static doca_error_t parse_add_control_pipe_entry_params(char *params_str, bool *fwd_action, bool *match_mask_action, uint64_t *pipe_id, uint16_t *pipe_queue, uint8_t *priority)
static doca_error_t parse_dump_pipe_params(char *params, uint16_t *port_id, FILE **file)
static doca_error_t parse_add_entry_params(char *params_str, bool *fwd_action, bool *monitor_action, uint64_t *pipe_id, int *pipe_queue)
doca_error_t parse_protocol_string(const char *protocol_str, enum doca_flow_l4_type_ext *protocol)
static cmdline_parse_inst_t cmd_fw_add_entry
static void cmd_create_struct_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
static uint16_t * rss_queues
static cmdline_parse_token_string_t cmd_add_entry_optional_fields_tok
static cmdline_parse_inst_t cmd_update_struct
static void cmd_quit_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unused void *data)
void set_pipe_destroy(void(*action)(uint64_t))
#define MAX_CMDLINE_INPUT_LEN
static uint64_t fwd_miss_next_pipe_id
doca_error_t parse_ipv4_str(const char *str_ip, doca_be32_t *ipv4_addr)
static cmdline_parse_inst_t cmd_create_pipe
static void cmd_flush_pipes_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
static doca_error_t parse_fw_add_entry_params(char *params_str, uint16_t *port_id)
static doca_error_t parse_pipe_id_input(char *pipe_id_str, uint64_t *pipe_id)
static cmdline_parse_inst_t cmd_fw_rm_entry
static cmdline_parse_token_string_t cmd_flush_pipes_pipes_tok
void set_query(void(*action)(uint64_t, struct doca_flow_resource_query *))
static void(* add_fw_entry_func)(uint16_t, struct doca_flow_match *)
void set_pipe_fw_add_entry(void(*action)(uint16_t, struct doca_flow_match *))
static cmdline_parse_token_string_t cmd_create_pipe_optional_fields_tok
static doca_error_t parse_fw_entry_params(char *params, uint64_t *entry_id)
static void(* port_pipes_dump_func)(uint16_t, FILE *)
static cmdline_parse_token_string_t cmd_rm_entry_rm_tok
static doca_error_t parse_actions_field(char *field_name, char *value, void *struct_ptr)
void set_pipe_add_entry(void(*action)(uint16_t, uint64_t, struct doca_flow_match *, struct doca_flow_actions *, struct doca_flow_monitor *, struct doca_flow_fwd *, uint64_t, uint32_t))
static void(* create_pipe_func)(struct doca_flow_pipe_cfg *, uint16_t, struct doca_flow_fwd *, uint64_t, struct doca_flow_fwd *, uint64_t)
static cmdline_parse_inst_t cmd_query
#define UINT32_CHANGEABLE_FIELD
static struct doca_flow_actions actions
static cmdline_parse_token_string_t cmd_flush_pipes_flush_tok
static cmdline_parse_token_string_t cmd_create_struct_update_tok
static cmdline_parse_inst_t cmd_rm_entry
static cmdline_parse_token_string_t cmd_create_struct_struct_tok
static cmdline_parse_token_string_t cmd_add_control_pipe_entry_entry_tok
static cmdline_parse_inst_t cmd_destroy_pipe
void set_pipe_fw_rm_entry(void(*action)(uint64_t))
static cmdline_parse_token_string_t cmd_fw_create_struct_struct_tok
static cmdline_parse_token_string_t cmd_add_entry_add_tok
doca_error_t flow_parser_init(char *shell_prompt, bool fw_subset)
static void(* remove_fw_entry_func)(uint64_t)
static void cmd_fw_create_struct_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
void set_port_pipes_flush(void(*action)(uint16_t))
void set_pipe_rm_entry(void(*action)(uint16_t, uint64_t, uint32_t))
static cmdline_parse_token_string_t cmd_flush_pipes_port_tok
static cmdline_parse_token_string_t cmd_port_pipes_dump_dump_tok
void set_port_pipes_dump(void(*action)(uint16_t, FILE *))
static cmdline_parse_token_string_t cmd_quit_tok
static cmdline_parse_token_string_t cmd_add_control_pipe_entry_optional_fields_tok
static void(* add_entry_func)(uint16_t, uint64_t, struct doca_flow_match *, struct doca_flow_actions *, struct doca_flow_monitor *, struct doca_flow_fwd *, uint64_t, uint32_t)
static cmdline_parse_inst_t cmd_dump_pipe
static cmdline_parse_token_string_t cmd_create_struct_input_tok
static cmdline_parse_token_string_t cmd_query_params_tok
static cmdline_parse_token_string_t cmd_create_pipe_create_tok
static doca_error_t parse_match_field(char *field_name, char *value, void *struct_ptr)
#define PIPE_QUEUE_STR_LEN
static cmdline_parse_token_string_t cmd_port_pipes_dump_pipes_tok
static cmdline_parse_token_string_t cmd_add_entry_entry_tok
static cmdline_parse_token_string_t cmd_create_pipe_pipe_tok
#define BE_IPV4_ADDR(a, b, c, d)
static struct doca_flow_match entry_match
static doca_error_t parse_create_pipe_params(char *params_str, struct doca_flow_pipe_cfg *cfg, bool *fwd_action, bool *fwd_miss_action, bool *is_match_mask, enum doca_flow_pipe_type *type)
static void cmd_destroy_pipe_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
static cmdline_parse_token_string_t cmd_flush_pipes_port_id_tok
void set_pipe_create(void(*action)(struct doca_flow_pipe_cfg *, uint16_t, struct doca_flow_fwd *, uint64_t, struct doca_flow_fwd *, uint64_t))
static struct doca_flow_monitor monitor
static void(* add_control_pipe_entry_func)(uint16_t, uint8_t, uint64_t, struct doca_flow_match *, struct doca_flow_match *, struct doca_flow_fwd *, uint64_t)
static struct doca_flow_fwd fwd
static void cmd_dump_pipe_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
static doca_error_t parse_bool_params_input(char **params_str, int param_str_len, bool *take_action)
static cmdline_parse_inst_t cmd_add_control_pipe_entry
static void(* destroy_pipe_func)(uint64_t)
static void cmd_fw_add_entry_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
void flow_parser_cleanup(void)
static doca_error_t parse_rss_queues(char *rss_queues_str, int num_of_queues)
static doca_error_t parse_ip_type(const char *ip_type_str, enum doca_flow_l3_type *ip_type)
static doca_error_t parse_port_id_input(const char *port_id_str, int *port_id)
static cmdline_parse_token_string_t cmd_add_control_pipe_entry_add_tok
static cmdline_parse_token_string_t cmd_rm_entry_params_tok
DOCA_LOG_REGISTER(FLOW_PARSER)
static doca_error_t parse_struct(char *struct_str, doca_error_t(*fill_struct)(char *, char *, void *), void *struct_ptr)
static cmdline_parse_token_string_t cmd_query_query_tok
static doca_error_t parse_l3_type(const char *l3_type_str, enum doca_flow_l3_type *l3_type)
static cmdline_parse_ctx_t main_ctx[]
static void cmd_add_control_pipe_entry_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
static doca_error_t parse_tcp_flag_string(const char *tcp_flag_str, uint8_t *tcp_flag)
#define MATCH_MASK_STR_LEN
static doca_error_t parse_fwd_type(const char *fwd_str, enum doca_flow_fwd_type *fwd)
static cmdline_parse_ctx_t fw_subset_ctx[]
static uint16_t pipe_port_id
static doca_error_t parse_fwd_miss_field(char *field_name, char *value, void *struct_ptr)
static doca_error_t parse_pipe_type(const char *pipe_type, struct doca_flow_pipe_cfg *cfg, enum doca_flow_pipe_type *type)
static void(* query_func)(uint64_t, struct doca_flow_resource_query *)
static cmdline_parse_token_string_t cmd_destroy_pipe_destroy_tok
static cmdline_parse_token_string_t cmd_add_control_pipe_entry_control_pipe_tok
static uint64_t fwd_next_pipe_id
static cmdline_parse_inst_t cmd_fw_create_match_struct
static struct doca_flow_match match_mask
static void reset_doca_flow_structs(void)
static cmdline_parse_inst_t cmd_flush_pipe
static struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
@ DOCA_ERROR_INVALID_VALUE
doca_flow_l4_type_ext
doca flow layer 4 packet extend type
doca_flow_l3_type
doca flow layer 3 packet type
doca_flow_tun_type
doca flow tunnel type
@ DOCA_FLOW_L4_TYPE_EXT_TCP
@ DOCA_FLOW_L4_TYPE_EXT_UDP
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_destroy(struct doca_flow_pipe_cfg *cfg)
Destroy DOCA Flow pipe configuration struct.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_create(struct doca_flow_pipe_cfg **cfg, struct doca_flow_port *port)
Create DOCA Flow pipe configuration struct.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_name(struct doca_flow_pipe_cfg *cfg, const char *name)
Set pipe's name.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_match(struct doca_flow_pipe_cfg *cfg, const struct doca_flow_match *match, const struct doca_flow_match *match_mask)
Set pipe's match and match mask.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_is_root(struct doca_flow_pipe_cfg *cfg, bool is_root)
Set if pipe is root or not.
doca_flow_pipe_type
doca flow pipe type
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_type(struct doca_flow_pipe_cfg *cfg, enum doca_flow_pipe_type type)
Set pipe's type.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_actions(struct doca_flow_pipe_cfg *cfg, struct doca_flow_actions *const *actions, struct doca_flow_actions *const *actions_masks, struct doca_flow_action_descs *const *action_descs, size_t nr_actions)
Set pipe's actions, actions mask and actions descriptor.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_monitor(struct doca_flow_pipe_cfg *cfg, const struct doca_flow_monitor *monitor)
Set pipe's monitor.
doca_flow_resource_type
doca flow resource type
doca_flow_fwd_type
forwarding action type
DOCA_STABLE struct doca_flow_port * doca_flow_port_switch_get(const struct doca_flow_port *port)
Get doca flow switch port.
@ DOCA_FLOW_MATCH_TCP_FLAG_URG
@ DOCA_FLOW_MATCH_TCP_FLAG_FIN
@ DOCA_FLOW_MATCH_TCP_FLAG_ECE
@ DOCA_FLOW_MATCH_TCP_FLAG_CWR
@ DOCA_FLOW_MATCH_TCP_FLAG_RST
@ DOCA_FLOW_MATCH_TCP_FLAG_PSH
@ DOCA_FLOW_MATCH_TCP_FLAG_SYN
@ DOCA_FLOW_MATCH_TCP_FLAG_ACK
@ DOCA_FLOW_RESOURCE_TYPE_SHARED
@ DOCA_FLOW_RESOURCE_TYPE_NON_SHARED
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
#define DOCA_LOG_DBG(format,...)
Generates a DEBUG application log message.
const struct ip_frag_config * cfg
cmdline_fixed_string_t add
cmdline_fixed_string_t entry
cmdline_fixed_string_t control_pipe
cmdline_fixed_string_t params
cmdline_fixed_string_t params
cmdline_fixed_string_t add
cmdline_fixed_string_t entry
cmdline_fixed_string_t params
cmdline_fixed_string_t create
cmdline_fixed_string_t pipe
cmdline_fixed_string_t flow_struct
cmdline_fixed_string_t create
cmdline_multi_string_t flow_struct_input
cmdline_fixed_string_t params
cmdline_fixed_string_t pipe
cmdline_fixed_string_t destroy
cmdline_fixed_string_t params
cmdline_fixed_string_t pipes
cmdline_fixed_string_t dump
cmdline_fixed_string_t port
cmdline_fixed_string_t pipes
cmdline_fixed_string_t flush
cmdline_fixed_string_t port
cmdline_fixed_string_t port_id
cmdline_fixed_string_t params
cmdline_fixed_string_t query
cmdline_fixed_string_t quit
cmdline_fixed_string_t entry
cmdline_fixed_string_t rm
cmdline_fixed_string_t params
doca flow actions information
struct doca_flow_resource_encap_cfg encap_cfg
struct doca_flow_header_format outer
struct doca_flow_header_format outer
enum doca_flow_fwd_type type
enum doca_flow_resource_type rss_type
struct doca_flow_resource_rss_cfg rss
doca flow matcher information
struct doca_flow_header_format inner
struct doca_flow_parser_meta parser_meta
struct doca_flow_header_format outer
doca monitor action configuration
struct doca_flow_monitor::@101::@105 non_shared_meter
enum doca_flow_resource_type counter_type
enum doca_flow_resource_type meter_type
struct doca_flow_encap_action encap
struct doca_flow_resource_query::@115::@117 counter
enum doca_flow_tun_type type
size_t strlcpy(char *dst, const char *src, size_t size)