Extend the existing flow_director_filter to add support for packet filter flow. Also shows how to pass the extra behavior arguments to rewrite fields in matched filter rules.
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy at chelsio.com> Signed-off-by: Kumar Sanghvi <kumaras at chelsio.com> --- app/test-pmd/cmdline.c | 435 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 427 insertions(+), 8 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 73298c9..488eddc 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -641,7 +641,7 @@ static void cmd_help_long_parsed(void *parsed_result, " flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)" " src (src_ip_address) dst (dst_ip_address)" " vlan (vlan_value) flexbytes (flexbytes_value)" - " (drop|fwd) pf|vf(vf_id) queue (queue_id)" + " (drop|fwd|switch) pf|vf(vf_id) queue (queue_id)" " fd_id (fd_id_value)\n" " Add/Del an IP type flow director filter.\n\n" @@ -650,7 +650,7 @@ static void cmd_help_long_parsed(void *parsed_result, " src (src_ip_address) (src_port)" " dst (dst_ip_address) (dst_port)" " vlan (vlan_value) flexbytes (flexbytes_value)" - " (drop|fwd) pf|vf(vf_id) queue (queue_id)" + " (drop|fwd|switch) pf|vf(vf_id) queue (queue_id)" " fd_id (fd_id_value)\n" " Add/Del an UDP/TCP type flow director filter.\n\n" @@ -659,16 +659,37 @@ static void cmd_help_long_parsed(void *parsed_result, " src (src_ip_address) (src_port)" " dst (dst_ip_address) (dst_port)" " tag (verification_tag) vlan (vlan_value)" - " flexbytes (flexbytes_value) (drop|fwd)" + " flexbytes (flexbytes_value) (drop|fwd|switch)" " pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n" " Add/Del a SCTP type flow director filter.\n\n" "flow_director_filter (port_id) mode IP (add|del|update)" " flow l2_payload ether (ethertype)" - " flexbytes (flexbytes_value) (drop|fwd)" + " flexbytes (flexbytes_value) (drop|fwd|switch)" " pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n" " Add/Del a l2 payload type flow director filter.\n\n" + "flow_director_filter (port_id) mode IP (add|del|update)" + " flow (ipv4-tcp-pkt-filter|ipv4-udp-pkt-filter|" + " ipv6-tcp-pkt-filter|ipv6-udp-pkt-filter)" + " ingress-port (port_id) (port_id_mask)" + " ether (ethertype) (ethertype_mask)" + " inner-vlan (inner_vlan_value) (inner_vlan_mask)" + " outer-vlan (outer_vlan_value) (outer_vlan_mask)" + " tos (tos_value) (tos_mask)" + " proto (proto_value) (proto_mask)" + " src (src_ip) (src_ip_mask) (src_port) (src_port_mask)" + " dst (dst_ip) (dst_ip_mask) (dst_port) (dst_port_mask)" + " flexbytes (flexbytes_value) (drop|fwd|switch)" + " pf|vf(vf_id) queue (queue_id)" + " port-arg none|port-redirect (dst-port-id)" + " mac-arg none|mac-rewrite (src-mac) (dst-mac)" + " vlan-arg none|vlan-rewrite|vlan-del (vlan_value)" + " nat-arg none|nat-rewrite" + " src (src_ip) (src_port) dst (dst_ip) (dst_port)" + " fd_id (fd_id_value)\n" + " Add/Del a packet filter type flow director filter.\n\n" + "flow_director_filter (port_id) mode MAC-VLAN (add|del|update)" " mac (mac_address) vlan (vlan_value)" " flexbytes (flexbytes_value) (drop|fwd)" @@ -7973,14 +7994,34 @@ struct cmd_flow_director_result { cmdline_fixed_string_t ops; cmdline_fixed_string_t flow; cmdline_fixed_string_t flow_type; + cmdline_fixed_string_t iport; + uint8_t iport_id; + uint8_t iport_id_mask; cmdline_fixed_string_t ether; uint16_t ether_type; + uint16_t ether_type_mask; + cmdline_fixed_string_t ivlan; + uint16_t ivlan_value; + uint16_t ivlan_mask; + cmdline_fixed_string_t ovlan; + uint16_t ovlan_value; + uint16_t ovlan_mask; + cmdline_fixed_string_t tos; + uint8_t tos_value; + uint8_t tos_mask; + cmdline_fixed_string_t proto; + uint8_t proto_value; + uint8_t proto_mask; cmdline_fixed_string_t src; cmdline_ipaddr_t ip_src; + cmdline_ipaddr_t ip_src_mask; uint16_t port_src; + uint16_t port_src_mask; cmdline_fixed_string_t dst; cmdline_ipaddr_t ip_dst; + cmdline_ipaddr_t ip_dst_mask; uint16_t port_dst; + uint16_t port_dst_mask; cmdline_fixed_string_t verify_tag; uint32_t verify_tag_value; cmdline_fixed_string_t vlan; @@ -7999,6 +8040,26 @@ struct cmd_flow_director_result { cmdline_fixed_string_t tunnel_type; cmdline_fixed_string_t tunnel_id; uint32_t tunnel_id_value; + + /* Extra arguments for behavior taken */ + cmdline_fixed_string_t port_arg; + cmdline_fixed_string_t port_arg_op; + uint8_t port_arg_port_id; + cmdline_fixed_string_t mac_arg; + cmdline_fixed_string_t mac_arg_op; + struct ether_addr mac_arg_src_mac; + struct ether_addr mac_arg_dst_mac; + cmdline_fixed_string_t vlan_arg; + cmdline_fixed_string_t vlan_arg_op; + uint16_t vlan_arg_vlan; + cmdline_fixed_string_t nat_arg; + cmdline_fixed_string_t nat_arg_op; + cmdline_fixed_string_t nat_arg_src; + cmdline_ipaddr_t nat_arg_ip_src; + uint16_t nat_arg_port_src; + cmdline_fixed_string_t nat_arg_dst; + cmdline_ipaddr_t nat_arg_ip_dst; + uint16_t nat_arg_port_dst; }; static inline int @@ -8061,6 +8122,10 @@ str2flowtype(char *string) {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP}, {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER}, {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD}, + {"ipv4-tcp-pkt-filter", RTE_ETH_FLOW_PKT_FILTER_IPV4_TCP}, + {"ipv4-udp-pkt-filter", RTE_ETH_FLOW_PKT_FILTER_IPV4_UDP}, + {"ipv6-tcp-pkt-filter", RTE_ETH_FLOW_PKT_FILTER_IPV6_TCP}, + {"ipv6-udp-pkt-filter", RTE_ETH_FLOW_PKT_FILTER_IPV6_UDP}, }; for (i = 0; i < RTE_DIM(flowtype_str); i++) { @@ -8090,6 +8155,30 @@ str2fdir_tunneltype(char *string) return RTE_FDIR_TUNNEL_TYPE_UNKNOWN; } +static uint16_t +str2fdir_behavior_sub_op(char *string) +{ + uint16_t i = 0; + + static const struct { + char str[32]; + enum rte_eth_fdir_behavior_sub_op op; + } behavior_sub_op_str[] = { + {"port-redirect", RTE_FDIR_BEHAVIOR_SUB_OP_INSERT}, + {"mac-rewrite", RTE_FDIR_BEHAVIOR_SUB_OP_INSERT}, + {"vlan-rewrite", RTE_FDIR_BEHAVIOR_SUB_OP_INSERT}, + {"vlan-del", RTE_FDIR_BEHAVIOR_SUB_OP_DELETE}, + {"nat-rewrite", RTE_FDIR_BEHAVIOR_SUB_OP_INSERT}, + }; + + for (i = 0; i < RTE_DIM(behavior_sub_op_str); i++) { + if (!strcmp(behavior_sub_op_str[i].str, string)) + return behavior_sub_op_str[i].op; + } + + return RTE_FDIR_BEHAVIOR_SUB_OP_UNKNOWN; +} + #define IPV4_ADDR_TO_UINT(ip_addr, ip) \ do { \ if ((ip_addr).family == AF_INET) \ @@ -8119,6 +8208,7 @@ cmd_flow_director_filter_parsed(void *parsed_result, { struct cmd_flow_director_result *res = parsed_result; struct rte_eth_fdir_filter entry; + struct rte_eth_pkt_filter_flow *pflow; uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN]; char *end; unsigned long vf_id; @@ -8218,6 +8308,89 @@ cmd_flow_director_filter_parsed(void *parsed_result, entry.input.flow.l2_flow.ether_type = rte_cpu_to_be_16(res->ether_type); break; + case RTE_ETH_FLOW_PKT_FILTER_IPV4_TCP: + case RTE_ETH_FLOW_PKT_FILTER_IPV4_UDP: + pflow = &entry.input.flow.pkt_filter_flow; + + pflow->pkt.port_id = res->iport_id; + pflow->mask.port_id = res->iport_id_mask; + + pflow->pkt.l2_flow.ether_type = + rte_cpu_to_be_16(res->ether_type); + pflow->mask.l2_flow.ether_type = + rte_cpu_to_be_16(res->ether_type_mask); + + pflow->pkt.vlan_flow.inner_vlan = + rte_cpu_to_be_16(res->ivlan_value); + pflow->pkt.vlan_flow.outer_vlan = res->ovlan_value; + rte_cpu_to_be_16(res->ovlan_value); + pflow->mask.vlan_flow.inner_vlan = res->ivlan_mask; + rte_cpu_to_be_16(res->ivlan_mask); + pflow->mask.vlan_flow.outer_vlan = res->ovlan_mask; + rte_cpu_to_be_16(res->ovlan_mask); + + pflow->pkt.ntuple_flow.tcp4.ip.tos = res->tos_value; + pflow->pkt.ntuple_flow.tcp4.ip.proto = res->proto_value; + pflow->mask.ntuple_flow.tcp4.ip.tos = res->tos_mask; + pflow->mask.ntuple_flow.tcp4.ip.proto = res->proto_mask; + + IPV4_ADDR_TO_UINT(res->ip_src, + pflow->pkt.ntuple_flow.tcp4.ip.src_ip); + IPV4_ADDR_TO_UINT(res->ip_dst, + pflow->pkt.ntuple_flow.tcp4.ip.dst_ip); + IPV4_ADDR_TO_UINT(res->ip_src_mask, + pflow->mask.ntuple_flow.tcp4.ip.src_ip); + IPV4_ADDR_TO_UINT(res->ip_dst_mask, + pflow->mask.ntuple_flow.tcp4.ip.dst_ip); + + pflow->pkt.ntuple_flow.tcp4.src_port = + rte_cpu_to_be_16(res->port_src); + pflow->pkt.ntuple_flow.tcp4.dst_port = + rte_cpu_to_be_16(res->port_dst); + pflow->mask.ntuple_flow.tcp4.src_port = + rte_cpu_to_be_16(res->port_src_mask); + pflow->mask.ntuple_flow.tcp4.dst_port = + rte_cpu_to_be_16(res->port_dst_mask); + break; + case RTE_ETH_FLOW_PKT_FILTER_IPV6_TCP: + case RTE_ETH_FLOW_PKT_FILTER_IPV6_UDP: + pflow = &entry.input.flow.pkt_filter_flow; + + pflow->pkt.port_id = res->iport_id; + pflow->mask.port_id = res->iport_id_mask; + + pflow->pkt.l2_flow.ether_type = + rte_cpu_to_be_16(res->ether_type); + pflow->mask.l2_flow.ether_type = + rte_cpu_to_be_16(res->ether_type_mask); + + pflow->pkt.vlan_flow.inner_vlan = + rte_cpu_to_be_16(res->ivlan_value); + pflow->pkt.vlan_flow.outer_vlan = res->ovlan_value; + rte_cpu_to_be_16(res->ovlan_value); + pflow->mask.vlan_flow.inner_vlan = res->ivlan_mask; + rte_cpu_to_be_16(res->ivlan_mask); + pflow->mask.vlan_flow.outer_vlan = res->ovlan_mask; + rte_cpu_to_be_16(res->ovlan_mask); + + IPV6_ADDR_TO_ARRAY(res->ip_src, + pflow->pkt.ntuple_flow.tcp6.ip.src_ip); + IPV6_ADDR_TO_ARRAY(res->ip_dst, + pflow->pkt.ntuple_flow.tcp6.ip.dst_ip); + IPV6_ADDR_TO_ARRAY(res->ip_src_mask, + pflow->mask.ntuple_flow.tcp6.ip.src_ip); + IPV6_ADDR_TO_ARRAY(res->ip_dst_mask, + pflow->mask.ntuple_flow.tcp6.ip.dst_ip); + + pflow->pkt.ntuple_flow.tcp6.src_port = + rte_cpu_to_be_16(res->port_src); + pflow->pkt.ntuple_flow.tcp6.dst_port = + rte_cpu_to_be_16(res->port_dst); + pflow->mask.ntuple_flow.tcp6.src_port = + rte_cpu_to_be_16(res->port_src_mask); + pflow->mask.ntuple_flow.tcp6.dst_port = + rte_cpu_to_be_16(res->port_dst_mask); + break; default: break; } @@ -8244,10 +8417,68 @@ cmd_flow_director_filter_parsed(void *parsed_result, entry.input.flow_ext.vlan_tci = rte_cpu_to_be_16(res->vlan_value); entry.action.flex_off = 0; /*use 0 by default */ - if (!strcmp(res->drop, "drop")) + if (!strcmp(res->drop, "switch")) { + struct rte_eth_behavior_arg_nat *nat_arg; + + entry.action.behavior = RTE_ETH_FDIR_SWITCH; + + /* Extra port arguments */ + entry.action.behavior_arg.port_arg.op = + str2fdir_behavior_sub_op(res->port_arg_op); + entry.action.behavior_arg.port_arg.port_id = + res->port_arg_port_id; + + /* Extra mac arguments */ + entry.action.behavior_arg.mac_arg.op = + str2fdir_behavior_sub_op(res->mac_arg_op); + (void)rte_memcpy(&entry.action.behavior_arg.mac_arg.src_mac, + &res->mac_arg_src_mac, + sizeof(struct ether_addr)); + (void)rte_memcpy(&entry.action.behavior_arg.mac_arg.dst_mac, + &res->mac_arg_dst_mac, + sizeof(struct ether_addr)); + + /* Extra vlan arguments */ + entry.action.behavior_arg.vlan_arg.op = + str2fdir_behavior_sub_op(res->vlan_arg_op); + entry.action.behavior_arg.vlan_arg.vlan_tci = + rte_cpu_to_be_16(res->vlan_arg_vlan); + + /* Extra nat arguments */ + nat_arg = &entry.action.behavior_arg.nat_arg; + + nat_arg->op = str2fdir_behavior_sub_op(res->nat_arg_op); + switch (entry.input.flow_type) { + case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: + case RTE_ETH_FLOW_PKT_FILTER_IPV4_TCP: + IPV4_ADDR_TO_UINT(res->nat_arg_ip_src, + nat_arg->nat.tcp4.ip.src_ip); + IPV4_ADDR_TO_UINT(res->nat_arg_ip_dst, + nat_arg->nat.tcp4.ip.dst_ip); + nat_arg->nat.tcp4.src_port = + rte_cpu_to_be_16(res->nat_arg_port_src); + nat_arg->nat.tcp4.dst_port = + rte_cpu_to_be_16(res->nat_arg_port_dst); + break; + case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: + case RTE_ETH_FLOW_PKT_FILTER_IPV6_TCP: + IPV6_ADDR_TO_ARRAY(res->nat_arg_ip_src, + nat_arg->nat.tcp6.ip.src_ip); + IPV6_ADDR_TO_ARRAY(res->nat_arg_ip_dst, + nat_arg->nat.tcp6.ip.dst_ip); + nat_arg->nat.tcp6.src_port = + rte_cpu_to_be_16(res->nat_arg_port_src); + nat_arg->nat.tcp6.dst_port = + rte_cpu_to_be_16(res->nat_arg_port_dst); + break; + default: + break; + } + } else if (!strcmp(res->drop, "drop")) { entry.action.behavior = RTE_ETH_FDIR_REJECT; - else + } else { entry.action.behavior = RTE_ETH_FDIR_ACCEPT; + } if (!strcmp(res->pf_vf, "pf")) entry.input.flow_ext.is_vf = 0; @@ -8302,31 +8533,93 @@ cmdline_parse_token_string_t cmd_flow_director_flow = cmdline_parse_token_string_t cmd_flow_director_flow_type = TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, flow_type, "ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#" - "ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#l2_payload"); + "ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#l2_payload#" + "ipv4-tcp-pkt-filter#ipv4-udp-pkt-filter#ipv6-tcp-pkt-filter#" + "ipv6-udp-pkt-filter"); +cmdline_parse_token_string_t cmd_flow_director_iport = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + iport, "ingress-port"); +cmdline_parse_token_num_t cmd_flow_director_iport_id = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + iport_id, UINT8); +cmdline_parse_token_num_t cmd_flow_director_iport_id_mask = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + iport_id_mask, UINT8); cmdline_parse_token_string_t cmd_flow_director_ether = TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, ether, "ether"); cmdline_parse_token_num_t cmd_flow_director_ether_type = TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, ether_type, UINT16); +cmdline_parse_token_num_t cmd_flow_director_ether_type_mask = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + ether_type_mask, UINT16); +cmdline_parse_token_string_t cmd_flow_director_ivlan = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + ivlan, "inner-vlan"); +cmdline_parse_token_num_t cmd_flow_director_ivlan_value = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + ivlan_value, UINT16); +cmdline_parse_token_num_t cmd_flow_director_ivlan_mask = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + ivlan_mask, UINT16); +cmdline_parse_token_string_t cmd_flow_director_ovlan = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + ovlan, "outer-vlan"); +cmdline_parse_token_num_t cmd_flow_director_ovlan_value = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + ovlan_value, UINT16); +cmdline_parse_token_num_t cmd_flow_director_ovlan_mask = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + ovlan_mask, UINT16); +cmdline_parse_token_string_t cmd_flow_director_tos = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + tos, "tos"); +cmdline_parse_token_num_t cmd_flow_director_tos_value = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + tos_value, UINT8); +cmdline_parse_token_num_t cmd_flow_director_tos_mask = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + tos_mask, UINT8); +cmdline_parse_token_string_t cmd_flow_director_proto = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + proto, "proto"); +cmdline_parse_token_num_t cmd_flow_director_proto_value = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + proto_value, UINT8); +cmdline_parse_token_num_t cmd_flow_director_proto_mask = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + proto_mask, UINT8); cmdline_parse_token_string_t cmd_flow_director_src = TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, src, "src"); cmdline_parse_token_ipaddr_t cmd_flow_director_ip_src = TOKEN_IPADDR_INITIALIZER(struct cmd_flow_director_result, ip_src); +cmdline_parse_token_ipaddr_t cmd_flow_director_ip_src_mask = + TOKEN_IPADDR_INITIALIZER(struct cmd_flow_director_result, + ip_src_mask); cmdline_parse_token_num_t cmd_flow_director_port_src = TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, port_src, UINT16); +cmdline_parse_token_num_t cmd_flow_director_port_src_mask = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + port_src_mask, UINT16); cmdline_parse_token_string_t cmd_flow_director_dst = TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, dst, "dst"); cmdline_parse_token_ipaddr_t cmd_flow_director_ip_dst = TOKEN_IPADDR_INITIALIZER(struct cmd_flow_director_result, ip_dst); +cmdline_parse_token_ipaddr_t cmd_flow_director_ip_dst_mask = + TOKEN_IPADDR_INITIALIZER(struct cmd_flow_director_result, + ip_dst_mask); cmdline_parse_token_num_t cmd_flow_director_port_dst = TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, port_dst, UINT16); +cmdline_parse_token_num_t cmd_flow_director_port_dst_mask = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + port_dst_mask, UINT16); cmdline_parse_token_string_t cmd_flow_director_verify_tag = TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, verify_tag, "verify_tag"); @@ -8347,7 +8640,7 @@ cmdline_parse_token_string_t cmd_flow_director_flexbytes_value = flexbytes_value, NULL); cmdline_parse_token_string_t cmd_flow_director_drop = TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, - drop, "drop#fwd"); + drop, "drop#fwd#switch"); cmdline_parse_token_string_t cmd_flow_director_pf_vf = TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, pf_vf, NULL); @@ -8395,6 +8688,61 @@ cmdline_parse_token_num_t cmd_flow_director_tunnel_id_value = TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, tunnel_id_value, UINT32); +cmdline_parse_token_string_t cmd_flow_director_port_arg = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + port_arg, "port-arg"); +cmdline_parse_token_string_t cmd_flow_director_port_arg_op = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + port_arg_op, "none#port-redirect"); +cmdline_parse_token_num_t cmd_flow_director_port_arg_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + port_arg_port_id, UINT8); +cmdline_parse_token_string_t cmd_flow_director_mac_arg = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + mac_arg, "mac-arg"); +cmdline_parse_token_string_t cmd_flow_director_mac_arg_op = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + mac_arg_op, "none#mac-rewrite"); +cmdline_parse_token_etheraddr_t cmd_flow_director_mac_arg_src_mac = + TOKEN_ETHERADDR_INITIALIZER(struct cmd_flow_director_result, + mac_arg_src_mac); +cmdline_parse_token_etheraddr_t cmd_flow_director_mac_arg_dst_mac = + TOKEN_ETHERADDR_INITIALIZER(struct cmd_flow_director_result, + mac_arg_dst_mac); +cmdline_parse_token_string_t cmd_flow_director_vlan_arg = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + vlan_arg, "vlan-arg"); +cmdline_parse_token_string_t cmd_flow_director_vlan_arg_op = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + vlan_arg_op, "none#vlan-rewrite#vlan-del"); +cmdline_parse_token_num_t cmd_flow_director_vlan_arg_vlan = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + vlan_arg_vlan, UINT16); +cmdline_parse_token_string_t cmd_flow_director_nat_arg = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + nat_arg, "nat-arg"); +cmdline_parse_token_string_t cmd_flow_director_nat_arg_op = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + nat_arg_op, "none#nat-rewrite"); +cmdline_parse_token_string_t cmd_flow_director_nat_arg_src = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + nat_arg_src, "src"); +cmdline_parse_token_ipaddr_t cmd_flow_director_nat_arg_ip_src = + TOKEN_IPADDR_INITIALIZER(struct cmd_flow_director_result, + nat_arg_ip_src); +cmdline_parse_token_num_t cmd_flow_director_nat_arg_port_src = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + nat_arg_port_src, UINT16); +cmdline_parse_token_string_t cmd_flow_director_nat_arg_dst = + TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result, + nat_arg_dst, "dst"); +cmdline_parse_token_ipaddr_t cmd_flow_director_nat_arg_ip_dst = + TOKEN_IPADDR_INITIALIZER(struct cmd_flow_director_result, + nat_arg_ip_dst); +cmdline_parse_token_num_t cmd_flow_director_nat_arg_port_dst = + TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result, + nat_arg_port_dst, UINT16); + cmdline_parse_inst_t cmd_add_del_ip_flow_director = { .f = cmd_flow_director_filter_parsed, .data = NULL, @@ -8517,6 +8865,76 @@ cmdline_parse_inst_t cmd_add_del_l2_flow_director = { }, }; +cmdline_parse_inst_t cmd_add_del_pkt_filter_flow_director = { + .f = cmd_flow_director_filter_parsed, + .data = NULL, + .help_str = "add or delete a packet filter flow director entry on NIC", + .tokens = { + (void *)&cmd_flow_director_filter, + (void *)&cmd_flow_director_port_id, + (void *)&cmd_flow_director_mode, + (void *)&cmd_flow_director_mode_ip, + (void *)&cmd_flow_director_ops, + (void *)&cmd_flow_director_flow, + (void *)&cmd_flow_director_flow_type, + (void *)&cmd_flow_director_iport, + (void *)&cmd_flow_director_iport_id, + (void *)&cmd_flow_director_iport_id_mask, + (void *)&cmd_flow_director_ether, + (void *)&cmd_flow_director_ether_type, + (void *)&cmd_flow_director_ether_type_mask, + (void *)&cmd_flow_director_ivlan, + (void *)&cmd_flow_director_ivlan_value, + (void *)&cmd_flow_director_ivlan_mask, + (void *)&cmd_flow_director_ovlan, + (void *)&cmd_flow_director_ovlan_value, + (void *)&cmd_flow_director_ovlan_mask, + (void *)&cmd_flow_director_tos, + (void *)&cmd_flow_director_tos_value, + (void *)&cmd_flow_director_tos_mask, + (void *)&cmd_flow_director_proto, + (void *)&cmd_flow_director_proto_value, + (void *)&cmd_flow_director_proto_mask, + (void *)&cmd_flow_director_src, + (void *)&cmd_flow_director_ip_src, + (void *)&cmd_flow_director_ip_src_mask, + (void *)&cmd_flow_director_port_src, + (void *)&cmd_flow_director_port_src_mask, + (void *)&cmd_flow_director_dst, + (void *)&cmd_flow_director_ip_dst, + (void *)&cmd_flow_director_ip_dst_mask, + (void *)&cmd_flow_director_port_dst, + (void *)&cmd_flow_director_port_dst_mask, + (void *)&cmd_flow_director_flexbytes, + (void *)&cmd_flow_director_flexbytes_value, + (void *)&cmd_flow_director_drop, + (void *)&cmd_flow_director_pf_vf, + (void *)&cmd_flow_director_queue, + (void *)&cmd_flow_director_queue_id, + (void *)&cmd_flow_director_port_arg, + (void *)&cmd_flow_director_port_arg_op, + (void *)&cmd_flow_director_port_arg_port_id, + (void *)&cmd_flow_director_mac_arg, + (void *)&cmd_flow_director_mac_arg_op, + (void *)&cmd_flow_director_mac_arg_src_mac, + (void *)&cmd_flow_director_mac_arg_dst_mac, + (void *)&cmd_flow_director_vlan_arg, + (void *)&cmd_flow_director_vlan_arg_op, + (void *)&cmd_flow_director_vlan_arg_vlan, + (void *)&cmd_flow_director_nat_arg, + (void *)&cmd_flow_director_nat_arg_op, + (void *)&cmd_flow_director_nat_arg_src, + (void *)&cmd_flow_director_nat_arg_ip_src, + (void *)&cmd_flow_director_nat_arg_port_src, + (void *)&cmd_flow_director_nat_arg_dst, + (void *)&cmd_flow_director_nat_arg_ip_dst, + (void *)&cmd_flow_director_nat_arg_port_dst, + (void *)&cmd_flow_director_fd_id, + (void *)&cmd_flow_director_fd_id_value, + NULL, + }, +}; + cmdline_parse_inst_t cmd_add_del_mac_vlan_flow_director = { .f = cmd_flow_director_filter_parsed, .data = NULL, @@ -9756,6 +10174,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director, (cmdline_parse_inst_t *)&cmd_add_del_sctp_flow_director, (cmdline_parse_inst_t *)&cmd_add_del_l2_flow_director, + (cmdline_parse_inst_t *)&cmd_add_del_pkt_filter_flow_director, (cmdline_parse_inst_t *)&cmd_add_del_mac_vlan_flow_director, (cmdline_parse_inst_t *)&cmd_add_del_tunnel_flow_director, (cmdline_parse_inst_t *)&cmd_flush_flow_director, -- 2.5.3