tailq: remove unneeded inclusions
[dpdk.git] / app / test-pmd / cmdline.c
index bf5e5f9..a15cbf2 100644 (file)
@@ -61,7 +61,6 @@
 #include <rte_memzone.h>
 #include <rte_malloc.h>
 #include <rte_launch.h>
-#include <rte_tailq.h>
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
@@ -292,11 +291,11 @@ static void cmd_help_long_parsed(void *parsed_result,
                        " a port\n\n"
 
                        "tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) "
-                       "(inner_vlan) (tunnel_type) (filter_type) (tenant_id) (queue_id)\n"
+                       "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n"
                        "   add a tunnel filter of a port.\n\n"
 
                        "tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) "
-                       "(inner_vlan) (tunnel_type) (filter_type) (tenant_id) (queue_id)\n"
+                       "(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n"
                        "   remove a tunnel filter of a port.\n\n"
 
                        "rx_vxlan_port add (udp_port) (port_id)\n"
@@ -513,6 +512,12 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "port close (port_id|all)\n"
                        "    Close all ports or port_id.\n\n"
 
+                       "port attach (ident)\n"
+                       "    Attach physical or virtual dev by pci address or virtual device name\n\n"
+
+                       "port detach (port_id)\n"
+                       "    Detach physical or virtual dev by port_id\n\n"
+
                        "port config (port_id|all)"
                        " speed (10|100|1000|10000|40000|auto)"
                        " duplex (half|full|auto)\n"
@@ -524,12 +529,13 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "port config all max-pkt-len (value)\n"
                        "    Set the max packet length.\n\n"
 
-                       "port config all (crc-strip|rx-cksum|hw-vlan|drop-en)"
+                       "port config all (crc-strip|rx-cksum|hw-vlan|hw-vlan-filter|"
+                       "hw-vlan-strip|hw-vlan-extend|drop-en)"
                        " (on|off)\n"
                        "    Set crc-strip/rx-checksum/hardware-vlan/drop_en"
                        " for ports.\n\n"
 
-                       "port config all rss (ip|udp|none)\n"
+                       "port config all rss (all|ip|tcp|udp|sctp|ether|none)\n"
                        "    Set the RSS mode.\n\n"
 
                        "port config port-id rss reta (hash,queue)[,(hash,queue)]\n"
@@ -600,37 +606,22 @@ static void cmd_help_long_parsed(void *parsed_result,
                        " (ether_type) (drop|fwd) queue (queue_id)\n"
                        "    Add/Del an ethertype filter.\n\n"
 
-                       "add_2tuple_filter (port_id) protocol (pro_value) (pro_mask)"
-                       " dst_port (port_value) (port_mask) flags (flg_value) priority (prio_value)"
-                       " queue (queue_id) index (idx)\n"
-                       "    add a 2tuple filter.\n\n"
-
-                       "remove_2tuple_filter (port_id) index (idx)\n"
-                       "    remove a 2tuple filter.\n\n"
-
-                       "get_2tuple_filter (port_id) index (idx)\n"
-                       "    get info of a 2tuple filter.\n\n"
-
-                       "add_5tuple_filter (port_id) dst_ip (dst_address) src_ip (src_address)"
-                       " dst_port (dst_port_value) src_port (src_port_value) protocol (protocol_value)"
-                       " mask (mask_value) flags (flags_value) priority (prio_value)"
-                       " queue (queue_id) index (idx)\n"
-                       "    add a 5tuple filter.\n\n"
-
-                       "remove_5tuple_filter (port_id) index (idx)\n"
-                       "    remove a 5tuple filter.\n\n"
-
-                       "get_5tuple_filter (port_id) index (idx)\n"
-                       "    get info of a 5tuple filter.\n\n"
-
-                       "add_syn_filter (port_id) priority (high|low) queue (queue_id)"
-                       "    add syn filter.\n\n"
+                       "2tuple_filter (port_id) (add|del)"
+                       " dst_port (dst_port_value) protocol (protocol_value)"
+                       " mask (mask_value) tcp_flags (tcp_flags_value)"
+                       " priority (prio_value) queue (queue_id)\n"
+                       "    Add/Del a 2tuple filter.\n\n"
 
-                       "remove_syn_filter (port_id)"
-                       "    remove syn filter.\n\n"
+                       "5tuple_filter (port_id) (add|del)"
+                       " dst_ip (dst_address) src_ip (src_address)"
+                       " dst_port (dst_port_value) src_port (src_port_value)"
+                       " protocol (protocol_value)"
+                       " mask (mask_value) tcp_flags (tcp_flags_value)"
+                       " priority (prio_value) queue (queue_id)\n"
+                       "    Add/Del a 5tuple filter.\n\n"
 
-                       "get_syn_filter (port_id) "
-                       "    get syn filter info.\n\n"
+                       "syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)"
+                       "    Add/Del syn filter.\n\n"
 
                        "flex_filter (port_id) (add|del) len (len_value)"
                        " bytes (bytes_value) mask (mask_value)"
@@ -638,14 +629,14 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "    Add/Del a flex filter.\n\n"
 
                        "flow_director_filter (port_id) (add|del|update)"
-                       " flow (ip4|ip4-frag|ip6|ip6-frag)"
+                       " 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) queue (queue_id) fd_id (fd_id_value)\n"
                        "    Add/Del an IP type flow director filter.\n\n"
 
                        "flow_director_filter (port_id) (add|del|update)"
-                       " flow (udp4|tcp4|udp6|tcp6)"
+                       " flow (ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp)"
                        " src (src_ip_address) (src_port)"
                        " dst (dst_ip_address) (dst_port)"
                        " vlan (vlan_value) flexbytes (flexbytes_value)"
@@ -653,7 +644,7 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "    Add/Del an UDP/TCP type flow director filter.\n\n"
 
                        "flow_director_filter (port_id) (add|del|update)"
-                       " flow (sctp4|sctp6)"
+                       " flow (ipv4-sctp|ipv6-sctp)"
                        " src (src_ip_address) (src_port)"
                        " dst (dst_ip_address) (dst_port)"
                        " tag (verification_tag) vlan (vlan_value)"
@@ -671,6 +662,8 @@ static void cmd_help_long_parsed(void *parsed_result,
 
                        "flow_director_flex_mask (port_id)"
                        " flow (raw|ip4|ip4-frag|tcp4|udp4|sctp4|ip6|ip6-frag|tcp6|udp6|sctp6|all)"
+                       " flow (raw|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|"
+                       "ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|all)"
                        " (mask)\n"
                        "    Configure mask of flex payload.\n\n"
 
@@ -689,7 +682,8 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "    Get the global configurations of hash filters.\n\n"
 
                        "set_hash_global_config (port_id) (toeplitz|simple_xor|default)"
-                       " (ip4|ip4-frag|tcp4|udp4|#sctp4|ip6|ip6-frag|tcp6|udp6|sctp6)"
+                       " (ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|"
+                       "ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload)"
                        " (enable|disable)\n"
                        "    Set the global configurations of hash filters.\n\n"
                );
@@ -805,6 +799,89 @@ cmdline_parse_inst_t cmd_operate_specific_port = {
        },
 };
 
+/* *** attach a specified port *** */
+struct cmd_operate_attach_port_result {
+       cmdline_fixed_string_t port;
+       cmdline_fixed_string_t keyword;
+       cmdline_fixed_string_t identifier;
+};
+
+static void cmd_operate_attach_port_parsed(void *parsed_result,
+                               __attribute__((unused)) struct cmdline *cl,
+                               __attribute__((unused)) void *data)
+{
+       struct cmd_operate_attach_port_result *res = parsed_result;
+
+       if (!strcmp(res->keyword, "attach"))
+               attach_port(res->identifier);
+       else
+               printf("Unknown parameter\n");
+}
+
+cmdline_parse_token_string_t cmd_operate_attach_port_port =
+       TOKEN_STRING_INITIALIZER(struct cmd_operate_attach_port_result,
+                       port, "port");
+cmdline_parse_token_string_t cmd_operate_attach_port_keyword =
+       TOKEN_STRING_INITIALIZER(struct cmd_operate_attach_port_result,
+                       keyword, "attach");
+cmdline_parse_token_string_t cmd_operate_attach_port_identifier =
+       TOKEN_STRING_INITIALIZER(struct cmd_operate_attach_port_result,
+                       identifier, NULL);
+
+cmdline_parse_inst_t cmd_operate_attach_port = {
+       .f = cmd_operate_attach_port_parsed,
+       .data = NULL,
+       .help_str = "port attach identifier, "
+               "identifier: pci address or virtual dev name",
+       .tokens = {
+               (void *)&cmd_operate_attach_port_port,
+               (void *)&cmd_operate_attach_port_keyword,
+               (void *)&cmd_operate_attach_port_identifier,
+               NULL,
+       },
+};
+
+/* *** detach a specified port *** */
+struct cmd_operate_detach_port_result {
+       cmdline_fixed_string_t port;
+       cmdline_fixed_string_t keyword;
+       uint8_t port_id;
+};
+
+static void cmd_operate_detach_port_parsed(void *parsed_result,
+                               __attribute__((unused)) struct cmdline *cl,
+                               __attribute__((unused)) void *data)
+{
+       struct cmd_operate_detach_port_result *res = parsed_result;
+
+       if (!strcmp(res->keyword, "detach"))
+               detach_port(res->port_id);
+       else
+               printf("Unknown parameter\n");
+}
+
+cmdline_parse_token_string_t cmd_operate_detach_port_port =
+       TOKEN_STRING_INITIALIZER(struct cmd_operate_detach_port_result,
+                       port, "port");
+cmdline_parse_token_string_t cmd_operate_detach_port_keyword =
+       TOKEN_STRING_INITIALIZER(struct cmd_operate_detach_port_result,
+                       keyword, "detach");
+cmdline_parse_token_num_t cmd_operate_detach_port_port_id =
+       TOKEN_NUM_INITIALIZER(struct cmd_operate_detach_port_result,
+                       port_id, UINT8);
+
+cmdline_parse_inst_t cmd_operate_detach_port = {
+       .f = cmd_operate_detach_port_parsed,
+       .data = NULL,
+       .help_str = "port detach port_id",
+       .tokens = {
+               (void *)&cmd_operate_detach_port_port,
+               (void *)&cmd_operate_detach_port_keyword,
+               (void *)&cmd_operate_detach_port_port_id,
+               NULL,
+       },
+};
+
 /* *** configure speed for all ports *** */
 struct cmd_config_speed_all {
        cmdline_fixed_string_t port;
@@ -859,7 +936,7 @@ cmd_config_speed_all_parsed(void *parsed_result,
                return;
        }
 
-       for (pid = 0; pid < nb_ports; pid++) {
+       FOREACH_PORT(pid, ports) {
                ports[pid].dev_conf.link_speed = link_speed;
                ports[pid].dev_conf.link_duplex = link_duplex;
        }
@@ -927,10 +1004,8 @@ cmd_config_speed_specific_parsed(void *parsed_result,
                return;
        }
 
-       if (res->id >= nb_ports) {
-               printf("Port id %d must be less than %d\n", res->id, nb_ports);
+       if (port_id_is_invalid(res->id, ENABLED_WARN))
                return;
-       }
 
        if (!strcmp(res->value1, "10"))
                link_speed = ETH_LINK_SPEED_10;
@@ -1268,6 +1343,33 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result,
                        printf("Unknown parameter\n");
                        return;
                }
+       } else if (!strcmp(res->name, "hw-vlan-filter")) {
+               if (!strcmp(res->value, "on"))
+                       rx_mode.hw_vlan_filter = 1;
+               else if (!strcmp(res->value, "off"))
+                       rx_mode.hw_vlan_filter = 0;
+               else {
+                       printf("Unknown parameter\n");
+                       return;
+               }
+       } else if (!strcmp(res->name, "hw-vlan-strip")) {
+               if (!strcmp(res->value, "on"))
+                       rx_mode.hw_vlan_strip  = 1;
+               else if (!strcmp(res->value, "off"))
+                       rx_mode.hw_vlan_strip  = 0;
+               else {
+                       printf("Unknown parameter\n");
+                       return;
+               }
+       } else if (!strcmp(res->name, "hw-vlan-extend")) {
+               if (!strcmp(res->value, "on"))
+                       rx_mode.hw_vlan_extend = 1;
+               else if (!strcmp(res->value, "off"))
+                       rx_mode.hw_vlan_extend = 0;
+               else {
+                       printf("Unknown parameter\n");
+                       return;
+               }
        } else if (!strcmp(res->name, "drop-en")) {
                if (!strcmp(res->value, "on"))
                        rx_drop_en = 1;
@@ -1296,7 +1398,8 @@ cmdline_parse_token_string_t cmd_config_rx_mode_flag_all =
        TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, all, "all");
 cmdline_parse_token_string_t cmd_config_rx_mode_flag_name =
        TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, name,
-                                       "crc-strip#rx-cksum#hw-vlan");
+                                       "crc-strip#rx-cksum#hw-vlan#"
+                                       "hw-vlan-filter#hw-vlan-strip#hw-vlan-extend");
 cmdline_parse_token_string_t cmd_config_rx_mode_flag_value =
        TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, value,
                                                        "on#off");
@@ -1304,7 +1407,8 @@ cmdline_parse_token_string_t cmd_config_rx_mode_flag_value =
 cmdline_parse_inst_t cmd_config_rx_mode_flag = {
        .f = cmd_config_rx_mode_flag_parsed,
        .data = NULL,
-       .help_str = "port config all crc-strip|rx-cksum|hw-vlan on|off",
+       .help_str = "port config all crc-strip|rx-cksum|hw-vlan|"
+               "hw-vlan-filter|hw-vlan-strip|hw-vlan-extend on|off",
        .tokens = {
                (void *)&cmd_config_rx_mode_flag_port,
                (void *)&cmd_config_rx_mode_flag_keyword,
@@ -1333,10 +1437,20 @@ cmd_config_rss_parsed(void *parsed_result,
        struct rte_eth_rss_conf rss_conf;
        uint8_t i;
 
-       if (!strcmp(res->value, "ip"))
+       if (!strcmp(res->value, "all"))
+               rss_conf.rss_hf = ETH_RSS_IP | ETH_RSS_TCP |
+                               ETH_RSS_UDP | ETH_RSS_SCTP |
+                                       ETH_RSS_L2_PAYLOAD;
+       else if (!strcmp(res->value, "ip"))
                rss_conf.rss_hf = ETH_RSS_IP;
        else if (!strcmp(res->value, "udp"))
                rss_conf.rss_hf = ETH_RSS_UDP;
+       else if (!strcmp(res->value, "tcp"))
+               rss_conf.rss_hf = ETH_RSS_TCP;
+       else if (!strcmp(res->value, "sctp"))
+               rss_conf.rss_hf = ETH_RSS_SCTP;
+       else if (!strcmp(res->value, "ether"))
+               rss_conf.rss_hf = ETH_RSS_L2_PAYLOAD;
        else if (!strcmp(res->value, "none"))
                rss_conf.rss_hf = 0;
        else {
@@ -1357,12 +1471,13 @@ cmdline_parse_token_string_t cmd_config_rss_all =
 cmdline_parse_token_string_t cmd_config_rss_name =
        TOKEN_STRING_INITIALIZER(struct cmd_config_rss, name, "rss");
 cmdline_parse_token_string_t cmd_config_rss_value =
-       TOKEN_STRING_INITIALIZER(struct cmd_config_rss, value, "ip#udp#none");
+       TOKEN_STRING_INITIALIZER(struct cmd_config_rss, value,
+               "all#ip#tcp#udp#sctp#ether#none");
 
 cmdline_parse_inst_t cmd_config_rss = {
        .f = cmd_config_rss_parsed,
        .data = NULL,
-       .help_str = "port config all rss ip|udp|none",
+       .help_str = "port config all rss all|ip|tcp|udp|sctp|ether|none",
        .tokens = {
                (void *)&cmd_config_rss_port,
                (void *)&cmd_config_rss_keyword,
@@ -1490,7 +1605,7 @@ cmd_config_rxtx_queue_parsed(void *parsed_result,
                return;
        }
 
-       if (port_id_is_invalid(res->portid))
+       if (port_id_is_invalid(res->portid, ENABLED_WARN))
                return;
 
        if (port_is_started(res->portid) != 1) {
@@ -2890,7 +3005,7 @@ cmd_csum_parsed(void *parsed_result,
        int hw = 0;
        uint16_t mask = 0;
 
-       if (port_id_is_invalid(res->port_id)) {
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN)) {
                printf("invalid port %d\n", res->port_id);
                return;
        }
@@ -2982,10 +3097,8 @@ cmd_csum_tunnel_parsed(void *parsed_result,
 {
        struct cmd_csum_tunnel_result *res = parsed_result;
 
-       if (port_id_is_invalid(res->port_id)) {
-               printf("invalid port %d\n", res->port_id);
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
                return;
-       }
 
        if (!strcmp(res->onoff, "on"))
                ports[res->port_id].tx_ol_flags |=
@@ -3040,7 +3153,7 @@ cmd_tso_set_parsed(void *parsed_result,
        struct cmd_tso_set_result *res = parsed_result;
        struct rte_eth_dev_info dev_info;
 
-       if (port_id_is_invalid(res->port_id))
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
                return;
 
        if (!strcmp(res->mode, "set"))
@@ -3966,6 +4079,7 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
                nb_ports = rte_eth_dev_count();
                reconfig(port_id, res->socket);
                rte_eth_promiscuous_enable(port_id);
+               ports[port_id].enabled = 1;
        }
 
 }
@@ -4016,10 +4130,8 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result,
        struct cmd_set_bond_mac_addr_result *res = parsed_result;
        int ret;
 
-       if (res->port_num >= nb_ports) {
-               printf("Port id %d must be less than %d\n", res->port_num, nb_ports);
+       if (port_id_is_invalid(res->port_num, ENABLED_WARN))
                return;
-       }
 
        ret = rte_eth_bond_mac_address_set(res->port_num, &res->address);
 
@@ -4256,7 +4368,7 @@ static void cmd_set_promisc_mode_parsed(void *parsed_result,
 
        /* all ports */
        if (allports) {
-               for (i = 0; i < nb_ports; i++) {
+               FOREACH_PORT(i, ports) {
                        if (enable)
                                rte_eth_promiscuous_enable(i);
                        else
@@ -4336,7 +4448,7 @@ static void cmd_set_allmulti_mode_parsed(void *parsed_result,
 
        /* all ports */
        if (allports) {
-               for (i = 0; i < nb_ports; i++) {
+               FOREACH_PORT(i, ports) {
                        if (enable)
                                rte_eth_allmulticast_enable(i);
                        else
@@ -5024,25 +5136,25 @@ static void cmd_showportall_parsed(void *parsed_result,
        struct cmd_showportall_result *res = parsed_result;
        if (!strcmp(res->show, "clear")) {
                if (!strcmp(res->what, "stats"))
-                       for (i = 0; i < nb_ports; i++)
+                       FOREACH_PORT(i, ports)
                                nic_stats_clear(i);
                else if (!strcmp(res->what, "xstats"))
-                       for (i = 0; i < nb_ports; i++)
+                       FOREACH_PORT(i, ports)
                                nic_xstats_clear(i);
        } else if (!strcmp(res->what, "info"))
-               for (i = 0; i < nb_ports; i++)
+               FOREACH_PORT(i, ports)
                        port_infos_display(i);
        else if (!strcmp(res->what, "stats"))
-               for (i = 0; i < nb_ports; i++)
+               FOREACH_PORT(i, ports)
                        nic_stats_display(i);
        else if (!strcmp(res->what, "xstats"))
-               for (i = 0; i < nb_ports; i++)
+               FOREACH_PORT(i, ports)
                        nic_xstats_display(i);
        else if (!strcmp(res->what, "fdir"))
-               for (i = 0; i < nb_ports; i++)
+               FOREACH_PORT(i, ports)
                        fdir_get_infos(i);
        else if (!strcmp(res->what, "stat_qmap"))
-               for (i = 0; i < nb_ports; i++)
+               FOREACH_PORT(i, ports)
                        nic_stats_mapping_display(i);
 }
 
@@ -6298,8 +6410,10 @@ cmd_tunnel_filter_parsed(void *parsed_result,
 
        if (!strcmp(res->tunnel_type, "vxlan"))
                tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN;
+       else if (!strcmp(res->tunnel_type, "nvgre"))
+               tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_NVGRE;
        else {
-               printf("Only VXLAN is supported now.\n");
+               printf("The tunnel type %s not supported.\n", res->tunnel_type);
                return;
        }
 
@@ -6343,7 +6457,7 @@ cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value =
        ip_value);
 cmdline_parse_token_string_t cmd_tunnel_filter_tunnel_type =
        TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result,
-       tunnel_type, "vxlan");
+       tunnel_type, "vxlan#nvgre");
 
 cmdline_parse_token_string_t cmd_tunnel_filter_filter_type =
        TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result,
@@ -6361,7 +6475,7 @@ cmdline_parse_inst_t cmd_tunnel_filter = {
        .data = (void *)0,
        .help_str = "add/rm tunnel filter of a port: "
                        "tunnel_filter add port_id outer_mac inner_mac ip "
-                       "inner_vlan tunnel_type(vxlan) filter_type "
+                       "inner_vlan tunnel_type(vxlan|nvgre) filter_type "
                        "(imac-ivlan|imac-ivlan-tenid|imac-tenid|"
                        "imac|omac-imac-tenid) "
                        "tenant_id queue_num",
@@ -6799,119 +6913,113 @@ cmdline_parse_inst_t cmd_dump_one = {
        },
 };
 
-/* *** set SYN filter *** */
-struct cmd_set_syn_filter_result {
+/* *** Add/Del syn filter *** */
+struct cmd_syn_filter_result {
        cmdline_fixed_string_t filter;
        uint8_t port_id;
+       cmdline_fixed_string_t ops;
        cmdline_fixed_string_t priority;
        cmdline_fixed_string_t high;
        cmdline_fixed_string_t queue;
-       uint16_t  queue_id;
+       uint16_t queue_id;
 };
 
 static void
-cmd_set_syn_filter_parsed(void *parsed_result,
+cmd_syn_filter_parsed(void *parsed_result,
                        __attribute__((unused)) struct cmdline *cl,
                        __attribute__((unused)) void *data)
 {
+       struct cmd_syn_filter_result *res = parsed_result;
+       struct rte_eth_syn_filter syn_filter;
        int ret = 0;
-       struct cmd_set_syn_filter_result *res = parsed_result;
-       struct rte_syn_filter filter;
 
-       if (!strcmp(res->filter, "add_syn_filter")) {
+       ret = rte_eth_dev_filter_supported(res->port_id,
+                                       RTE_ETH_FILTER_SYN);
+       if (ret < 0) {
+               printf("syn filter is not supported on port %u.\n",
+                               res->port_id);
+               return;
+       }
+
+       memset(&syn_filter, 0, sizeof(syn_filter));
+
+       if (!strcmp(res->ops, "add")) {
                if (!strcmp(res->high, "high"))
-                       filter.hig_pri = 1;
+                       syn_filter.hig_pri = 1;
                else
-                       filter.hig_pri = 0;
-               ret = rte_eth_dev_add_syn_filter(res->port_id,
-                               &filter, res->queue_id);
-       } else if (!strcmp(res->filter, "remove_syn_filter"))
-               ret = rte_eth_dev_remove_syn_filter(res->port_id);
-       else if (!strcmp(res->filter, "get_syn_filter"))
-               get_syn_filter(res->port_id);
-       if (ret < 0)
-               printf("syn filter setting error: (%s)\n", strerror(-ret));
+                       syn_filter.hig_pri = 0;
 
+               syn_filter.queue = res->queue_id;
+               ret = rte_eth_dev_filter_ctrl(res->port_id,
+                                               RTE_ETH_FILTER_SYN,
+                                               RTE_ETH_FILTER_ADD,
+                                               &syn_filter);
+       } else
+               ret = rte_eth_dev_filter_ctrl(res->port_id,
+                                               RTE_ETH_FILTER_SYN,
+                                               RTE_ETH_FILTER_DELETE,
+                                               &syn_filter);
+
+       if (ret < 0)
+               printf("syn filter programming error: (%s)\n",
+                               strerror(-ret));
 }
-cmdline_parse_token_num_t cmd_syn_filter_portid =
-       TOKEN_NUM_INITIALIZER(struct cmd_set_syn_filter_result,
-                               port_id, UINT8);
+
+cmdline_parse_token_string_t cmd_syn_filter_filter =
+       TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
+       filter, "syn_filter");
+cmdline_parse_token_num_t cmd_syn_filter_port_id =
+       TOKEN_NUM_INITIALIZER(struct cmd_syn_filter_result,
+       port_id, UINT8);
+cmdline_parse_token_string_t cmd_syn_filter_ops =
+       TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
+       ops, "add#del");
 cmdline_parse_token_string_t cmd_syn_filter_priority =
-       TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
+       TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
                                priority, "priority");
 cmdline_parse_token_string_t cmd_syn_filter_high =
-       TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
+       TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
                                high, "high#low");
 cmdline_parse_token_string_t cmd_syn_filter_queue =
-       TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
+       TOKEN_STRING_INITIALIZER(struct cmd_syn_filter_result,
                                queue, "queue");
 cmdline_parse_token_num_t cmd_syn_filter_queue_id =
-       TOKEN_NUM_INITIALIZER(struct cmd_set_syn_filter_result,
+       TOKEN_NUM_INITIALIZER(struct cmd_syn_filter_result,
                                queue_id, UINT16);
-cmdline_parse_token_string_t cmd_syn_filter_add_filter =
-       TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
-                               filter, "add_syn_filter");
-cmdline_parse_token_string_t cmd_syn_filter_remove_filter =
-       TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
-                               filter, "remove_syn_filter");
-cmdline_parse_inst_t cmd_add_syn_filter = {
-               .f = cmd_set_syn_filter_parsed,
-               .data = NULL,
-               .help_str = "add syn filter",
-               .tokens = {
-                       (void *)&cmd_syn_filter_add_filter,
-                       (void *)&cmd_syn_filter_portid,
-                       (void *)&cmd_syn_filter_priority,
-                       (void *)&cmd_syn_filter_high,
-                       (void *)&cmd_syn_filter_queue,
-                       (void *)&cmd_syn_filter_queue_id,
-                       NULL,
-               },
-};
-cmdline_parse_inst_t cmd_remove_syn_filter = {
-               .f = cmd_set_syn_filter_parsed,
-               .data = NULL,
-               .help_str = "remove syn filter",
-               .tokens = {
-                       (void *)&cmd_syn_filter_remove_filter,
-                       (void *)&cmd_syn_filter_portid,
-                       NULL,
-               },
-};
-
-cmdline_parse_token_string_t cmd_syn_filter_get_filter =
-       TOKEN_STRING_INITIALIZER(struct cmd_set_syn_filter_result,
-                               filter, "get_syn_filter");
 
-cmdline_parse_inst_t cmd_get_syn_filter = {
-               .f = cmd_set_syn_filter_parsed,
-               .data = NULL,
-               .help_str = "get syn filter",
-               .tokens = {
-                       (void *)&cmd_syn_filter_get_filter,
-                       (void *)&cmd_syn_filter_portid,
-                       NULL,
-               },
+cmdline_parse_inst_t cmd_syn_filter = {
+       .f = cmd_syn_filter_parsed,
+       .data = NULL,
+       .help_str = "add/delete syn filter",
+       .tokens = {
+               (void *)&cmd_syn_filter_filter,
+               (void *)&cmd_syn_filter_port_id,
+               (void *)&cmd_syn_filter_ops,
+               (void *)&cmd_syn_filter_priority,
+               (void *)&cmd_syn_filter_high,
+               (void *)&cmd_syn_filter_queue,
+               (void *)&cmd_syn_filter_queue_id,
+               NULL,
+       },
 };
 
 /* *** ADD/REMOVE A 2tuple FILTER *** */
 struct cmd_2tuple_filter_result {
        cmdline_fixed_string_t filter;
-       uint8_t port_id;
-       cmdline_fixed_string_t protocol;
-       uint8_t protocol_value;
-       uint8_t protocol_mask;
+       uint8_t  port_id;
+       cmdline_fixed_string_t ops;
        cmdline_fixed_string_t dst_port;
        uint16_t dst_port_value;
-       uint16_t dst_port_mask;
-       cmdline_fixed_string_t flags;
-       uint8_t flags_value;
+       cmdline_fixed_string_t protocol;
+       uint8_t protocol_value;
+       cmdline_fixed_string_t mask;
+       uint8_t  mask_value;
+       cmdline_fixed_string_t tcp_flags;
+       uint8_t tcp_flags_value;
        cmdline_fixed_string_t priority;
-       uint8_t priority_value;
+       uint8_t  priority_value;
        cmdline_fixed_string_t queue;
-       uint16_t queue_id;
-       cmdline_fixed_string_t index;
-       uint16_t index_value;
+       uint16_t  queue_id;
 };
 
 static void
@@ -6919,59 +7027,92 @@ cmd_2tuple_filter_parsed(void *parsed_result,
                        __attribute__((unused)) struct cmdline *cl,
                        __attribute__((unused)) void *data)
 {
-       int ret = 0;
-       struct rte_2tuple_filter filter;
+       struct rte_eth_ntuple_filter filter;
        struct cmd_2tuple_filter_result *res = parsed_result;
+       int ret = 0;
 
-       memset(&filter, 0, sizeof(struct rte_2tuple_filter));
+       ret = rte_eth_dev_filter_supported(res->port_id, RTE_ETH_FILTER_NTUPLE);
+       if (ret < 0) {
+               printf("ntuple filter is not supported on port %u.\n",
+                       res->port_id);
+               return;
+       }
 
-       if (!strcmp(res->filter, "add_2tuple_filter")) {
-               /* need convert to big endian. */
-               filter.dst_port = rte_cpu_to_be_16(res->dst_port_value);
-               filter.protocol = res->protocol_value;
-               filter.dst_port_mask = (res->dst_port_mask) ? 0 : 1;
-               filter.protocol_mask = (res->protocol_mask) ? 0 : 1;
-               filter.priority = res->priority_value;
-               filter.tcp_flags = res->flags_value;
-               ret = rte_eth_dev_add_2tuple_filter(res->port_id,
-                       res->index_value, &filter, res->queue_id);
-       } else if (!strcmp(res->filter, "remove_2tuple_filter"))
-               ret = rte_eth_dev_remove_2tuple_filter(res->port_id,
-                       res->index_value);
-       else if (!strcmp(res->filter, "get_2tuple_filter"))
-               get_2tuple_filter(res->port_id, res->index_value);
+       memset(&filter, 0, sizeof(struct rte_eth_ntuple_filter));
 
+       filter.flags = RTE_2TUPLE_FLAGS;
+       filter.dst_port_mask = (res->mask_value & 0x02) ? UINT16_MAX : 0;
+       filter.proto_mask = (res->mask_value & 0x01) ? UINT8_MAX : 0;
+       filter.proto = res->protocol_value;
+       filter.priority = res->priority_value;
+       if (res->tcp_flags_value != 0 && filter.proto != IPPROTO_TCP) {
+               printf("nonzero tcp_flags is only meaningful"
+                       " when protocol is TCP.\n");
+               return;
+       }
+       if (res->tcp_flags_value > TCP_FLAG_ALL) {
+               printf("invalid TCP flags.\n");
+               return;
+       }
+
+       if (res->tcp_flags_value != 0) {
+               filter.flags |= RTE_NTUPLE_FLAGS_TCP_FLAG;
+               filter.tcp_flags = res->tcp_flags_value;
+       }
+
+       /* need convert to big endian. */
+       filter.dst_port = rte_cpu_to_be_16(res->dst_port_value);
+       filter.queue = res->queue_id;
+
+       if (!strcmp(res->ops, "add"))
+               ret = rte_eth_dev_filter_ctrl(res->port_id,
+                               RTE_ETH_FILTER_NTUPLE,
+                               RTE_ETH_FILTER_ADD,
+                               &filter);
+       else
+               ret = rte_eth_dev_filter_ctrl(res->port_id,
+                               RTE_ETH_FILTER_NTUPLE,
+                               RTE_ETH_FILTER_DELETE,
+                               &filter);
        if (ret < 0)
-               printf("2tuple filter setting error: (%s)\n", strerror(-ret));
+               printf("2tuple filter programming error: (%s)\n",
+                       strerror(-ret));
+
 }
 
+cmdline_parse_token_string_t cmd_2tuple_filter_filter =
+       TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
+                                filter, "2tuple_filter");
 cmdline_parse_token_num_t cmd_2tuple_filter_port_id =
        TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
                                port_id, UINT8);
-cmdline_parse_token_string_t cmd_2tuple_filter_protocol =
+cmdline_parse_token_string_t cmd_2tuple_filter_ops =
        TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
-                                protocol, "protocol");
-cmdline_parse_token_num_t cmd_2tuple_filter_protocol_value =
-       TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
-                                protocol_value, UINT8);
-cmdline_parse_token_num_t cmd_2tuple_filter_protocol_mask =
-       TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
-                               protocol_mask, UINT8);
+                                ops, "add#del");
 cmdline_parse_token_string_t cmd_2tuple_filter_dst_port =
        TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
                                dst_port, "dst_port");
 cmdline_parse_token_num_t cmd_2tuple_filter_dst_port_value =
        TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
                                dst_port_value, UINT16);
-cmdline_parse_token_num_t cmd_2tuple_filter_dst_port_mask =
+cmdline_parse_token_string_t cmd_2tuple_filter_protocol =
+       TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
+                               protocol, "protocol");
+cmdline_parse_token_num_t cmd_2tuple_filter_protocol_value =
+       TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
+                               protocol_value, UINT8);
+cmdline_parse_token_string_t cmd_2tuple_filter_mask =
+       TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
+                               mask, "mask");
+cmdline_parse_token_num_t cmd_2tuple_filter_mask_value =
        TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
-                               dst_port_mask, UINT16);
-cmdline_parse_token_string_t cmd_2tuple_filter_flags =
+                               mask_value, INT8);
+cmdline_parse_token_string_t cmd_2tuple_filter_tcp_flags =
        TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
-                               flags, "flags");
-cmdline_parse_token_num_t cmd_2tuple_filter_flags_value =
+                               tcp_flags, "tcp_flags");
+cmdline_parse_token_num_t cmd_2tuple_filter_tcp_flags_value =
        TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
-                               flags_value, UINT8);
+                               tcp_flags_value, UINT8);
 cmdline_parse_token_string_t cmd_2tuple_filter_priority =
        TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
                                priority, "priority");
@@ -6984,67 +7125,27 @@ cmdline_parse_token_string_t cmd_2tuple_filter_queue =
 cmdline_parse_token_num_t cmd_2tuple_filter_queue_id =
        TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
                                queue_id, UINT16);
-cmdline_parse_token_string_t cmd_2tuple_filter_index =
-       TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
-                               index, "index");
-cmdline_parse_token_num_t cmd_2tuple_filter_index_value =
-       TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
-                               index_value, UINT16);
-cmdline_parse_token_string_t cmd_2tuple_filter_add_filter =
-       TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
-                               filter, "add_2tuple_filter");
-cmdline_parse_inst_t cmd_add_2tuple_filter = {
+
+cmdline_parse_inst_t cmd_2tuple_filter = {
        .f = cmd_2tuple_filter_parsed,
        .data = NULL,
        .help_str = "add a 2tuple filter",
        .tokens = {
-               (void *)&cmd_2tuple_filter_add_filter,
+               (void *)&cmd_2tuple_filter_filter,
                (void *)&cmd_2tuple_filter_port_id,
-               (void *)&cmd_2tuple_filter_protocol,
-               (void *)&cmd_2tuple_filter_protocol_value,
-               (void *)&cmd_2tuple_filter_protocol_mask,
+               (void *)&cmd_2tuple_filter_ops,
                (void *)&cmd_2tuple_filter_dst_port,
                (void *)&cmd_2tuple_filter_dst_port_value,
-               (void *)&cmd_2tuple_filter_dst_port_mask,
-               (void *)&cmd_2tuple_filter_flags,
-               (void *)&cmd_2tuple_filter_flags_value,
+               (void *)&cmd_2tuple_filter_protocol,
+               (void *)&cmd_2tuple_filter_protocol_value,
+               (void *)&cmd_2tuple_filter_mask,
+               (void *)&cmd_2tuple_filter_mask_value,
+               (void *)&cmd_2tuple_filter_tcp_flags,
+               (void *)&cmd_2tuple_filter_tcp_flags_value,
                (void *)&cmd_2tuple_filter_priority,
                (void *)&cmd_2tuple_filter_priority_value,
                (void *)&cmd_2tuple_filter_queue,
                (void *)&cmd_2tuple_filter_queue_id,
-               (void *)&cmd_2tuple_filter_index,
-               (void *)&cmd_2tuple_filter_index_value,
-               NULL,
-       },
-};
-
-cmdline_parse_token_string_t cmd_2tuple_filter_remove_filter =
-       TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
-                               filter, "remove_2tuple_filter");
-cmdline_parse_inst_t cmd_remove_2tuple_filter = {
-       .f = cmd_2tuple_filter_parsed,
-       .data = NULL,
-       .help_str = "remove a 2tuple filter",
-       .tokens = {
-               (void *)&cmd_2tuple_filter_remove_filter,
-               (void *)&cmd_2tuple_filter_port_id,
-               (void *)&cmd_2tuple_filter_index,
-               (void *)&cmd_2tuple_filter_index_value,
-               NULL,
-       },
-};
-cmdline_parse_token_string_t cmd_2tuple_filter_get_filter =
-       TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
-                               filter, "get_2tuple_filter");
-cmdline_parse_inst_t cmd_get_2tuple_filter = {
-       .f = cmd_2tuple_filter_parsed,
-       .data = NULL,
-       .help_str = "get a 2tuple filter",
-       .tokens = {
-               (void *)&cmd_2tuple_filter_get_filter,
-               (void *)&cmd_2tuple_filter_port_id,
-               (void *)&cmd_2tuple_filter_index,
-               (void *)&cmd_2tuple_filter_index_value,
                NULL,
        },
 };
@@ -7053,6 +7154,7 @@ cmdline_parse_inst_t cmd_get_2tuple_filter = {
 struct cmd_5tuple_filter_result {
        cmdline_fixed_string_t filter;
        uint8_t  port_id;
+       cmdline_fixed_string_t ops;
        cmdline_fixed_string_t dst_ip;
        cmdline_ipaddr_t dst_ip_value;
        cmdline_fixed_string_t src_ip;
@@ -7065,14 +7167,12 @@ struct cmd_5tuple_filter_result {
        uint8_t protocol_value;
        cmdline_fixed_string_t mask;
        uint8_t  mask_value;
-       cmdline_fixed_string_t flags;
-       uint8_t flags_value;
+       cmdline_fixed_string_t tcp_flags;
+       uint8_t tcp_flags_value;
        cmdline_fixed_string_t priority;
        uint8_t  priority_value;
        cmdline_fixed_string_t queue;
        uint16_t  queue_id;
-       cmdline_fixed_string_t index;
-       uint16_t  index_value;
 };
 
 static void
@@ -7080,62 +7180,92 @@ cmd_5tuple_filter_parsed(void *parsed_result,
                        __attribute__((unused)) struct cmdline *cl,
                        __attribute__((unused)) void *data)
 {
-       int ret = 0;
-       struct rte_5tuple_filter filter;
+       struct rte_eth_ntuple_filter filter;
        struct cmd_5tuple_filter_result *res = parsed_result;
+       int ret = 0;
 
-       memset(&filter, 0, sizeof(struct rte_5tuple_filter));
-
-       if (!strcmp(res->filter, "add_5tuple_filter")) {
-               filter.dst_ip_mask = (res->mask_value & 0x10) ? 0 : 1;
-               filter.src_ip_mask = (res->mask_value & 0x08) ? 0 : 1;
-               filter.dst_port_mask = (res->mask_value & 0x04) ? 0 : 1;
-               filter.src_port_mask = (res->mask_value & 0x02) ? 0 : 1;
-               filter.protocol = res->protocol_value;
-               filter.protocol_mask = (res->mask_value & 0x01) ? 0 : 1;
-               filter.priority = res->priority_value;
-               filter.tcp_flags = res->flags_value;
-
-               if (res->dst_ip_value.family == AF_INET)
-                       /* no need to convert, already big endian. */
-                       filter.dst_ip = res->dst_ip_value.addr.ipv4.s_addr;
-               else {
-                       if (filter.dst_ip_mask == 0) {
-                               printf("can not support ipv6 involved compare.\n");
-                               return;
-                       }
-                       filter.dst_ip = 0;
+       ret = rte_eth_dev_filter_supported(res->port_id, RTE_ETH_FILTER_NTUPLE);
+       if (ret < 0) {
+               printf("ntuple filter is not supported on port %u.\n",
+                       res->port_id);
+               return;
+       }
+
+       memset(&filter, 0, sizeof(struct rte_eth_ntuple_filter));
+
+       filter.flags = RTE_5TUPLE_FLAGS;
+       filter.dst_ip_mask = (res->mask_value & 0x10) ? UINT32_MAX : 0;
+       filter.src_ip_mask = (res->mask_value & 0x08) ? UINT32_MAX : 0;
+       filter.dst_port_mask = (res->mask_value & 0x04) ? UINT16_MAX : 0;
+       filter.src_port_mask = (res->mask_value & 0x02) ? UINT16_MAX : 0;
+       filter.proto_mask = (res->mask_value & 0x01) ? UINT8_MAX : 0;
+       filter.proto = res->protocol_value;
+       filter.priority = res->priority_value;
+       if (res->tcp_flags_value != 0 && filter.proto != IPPROTO_TCP) {
+               printf("nonzero tcp_flags is only meaningful"
+                       " when protocol is TCP.\n");
+               return;
+       }
+       if (res->tcp_flags_value > TCP_FLAG_ALL) {
+               printf("invalid TCP flags.\n");
+               return;
+       }
+
+       if (res->tcp_flags_value != 0) {
+               filter.flags |= RTE_NTUPLE_FLAGS_TCP_FLAG;
+               filter.tcp_flags = res->tcp_flags_value;
+       }
+
+       if (res->dst_ip_value.family == AF_INET)
+               /* no need to convert, already big endian. */
+               filter.dst_ip = res->dst_ip_value.addr.ipv4.s_addr;
+       else {
+               if (filter.dst_ip_mask == 0) {
+                       printf("can not support ipv6 involved compare.\n");
+                       return;
                }
+               filter.dst_ip = 0;
+       }
 
-               if (res->src_ip_value.family == AF_INET)
-                       /* no need to convert, already big endian. */
-                       filter.src_ip = res->src_ip_value.addr.ipv4.s_addr;
-               else {
-                       if (filter.src_ip_mask == 0) {
-                               printf("can not support ipv6 involved compare.\n");
-                               return;
-                       }
-                       filter.src_ip = 0;
+       if (res->src_ip_value.family == AF_INET)
+               /* no need to convert, already big endian. */
+               filter.src_ip = res->src_ip_value.addr.ipv4.s_addr;
+       else {
+               if (filter.src_ip_mask == 0) {
+                       printf("can not support ipv6 involved compare.\n");
+                       return;
                }
-               /* need convert to big endian. */
-               filter.dst_port = rte_cpu_to_be_16(res->dst_port_value);
-               filter.src_port = rte_cpu_to_be_16(res->src_port_value);
-
-               ret = rte_eth_dev_add_5tuple_filter(res->port_id,
-                       res->index_value, &filter, res->queue_id);
-       } else if (!strcmp(res->filter, "remove_5tuple_filter"))
-               ret = rte_eth_dev_remove_5tuple_filter(res->port_id,
-                       res->index_value);
-       else if (!strcmp(res->filter, "get_5tuple_filter"))
-               get_5tuple_filter(res->port_id, res->index_value);
+               filter.src_ip = 0;
+       }
+       /* need convert to big endian. */
+       filter.dst_port = rte_cpu_to_be_16(res->dst_port_value);
+       filter.src_port = rte_cpu_to_be_16(res->src_port_value);
+       filter.queue = res->queue_id;
+
+       if (!strcmp(res->ops, "add"))
+               ret = rte_eth_dev_filter_ctrl(res->port_id,
+                               RTE_ETH_FILTER_NTUPLE,
+                               RTE_ETH_FILTER_ADD,
+                               &filter);
+       else
+               ret = rte_eth_dev_filter_ctrl(res->port_id,
+                               RTE_ETH_FILTER_NTUPLE,
+                               RTE_ETH_FILTER_DELETE,
+                               &filter);
        if (ret < 0)
-               printf("5tuple filter setting error: (%s)\n", strerror(-ret));
+               printf("5tuple filter programming error: (%s)\n",
+                       strerror(-ret));
 }
 
-
+cmdline_parse_token_string_t cmd_5tuple_filter_filter =
+       TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
+                                filter, "5tuple_filter");
 cmdline_parse_token_num_t cmd_5tuple_filter_port_id =
        TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result,
                                port_id, UINT8);
+cmdline_parse_token_string_t cmd_5tuple_filter_ops =
+       TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
+                                ops, "add#del");
 cmdline_parse_token_string_t cmd_5tuple_filter_dst_ip =
        TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
                                dst_ip, "dst_ip");
@@ -7172,12 +7302,12 @@ cmdline_parse_token_string_t cmd_5tuple_filter_mask =
 cmdline_parse_token_num_t cmd_5tuple_filter_mask_value =
        TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result,
                                mask_value, INT8);
-cmdline_parse_token_string_t cmd_5tuple_filter_flags =
+cmdline_parse_token_string_t cmd_5tuple_filter_tcp_flags =
        TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
-                               flags, "flags");
-cmdline_parse_token_num_t cmd_5tuple_filter_flags_value =
+                               tcp_flags, "tcp_flags");
+cmdline_parse_token_num_t cmd_5tuple_filter_tcp_flags_value =
        TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result,
-                               flags_value, UINT8);
+                               tcp_flags_value, UINT8);
 cmdline_parse_token_string_t cmd_5tuple_filter_priority =
        TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
                                priority, "priority");
@@ -7190,23 +7320,15 @@ cmdline_parse_token_string_t cmd_5tuple_filter_queue =
 cmdline_parse_token_num_t cmd_5tuple_filter_queue_id =
        TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result,
                                queue_id, UINT16);
-cmdline_parse_token_string_t cmd_5tuple_filter_index =
-       TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
-                               index, "index");
-cmdline_parse_token_num_t cmd_5tuple_filter_index_value =
-       TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result,
-                               index_value, UINT16);
 
-cmdline_parse_token_string_t cmd_5tuple_filter_add_filter =
-       TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
-                                filter, "add_5tuple_filter");
-cmdline_parse_inst_t cmd_add_5tuple_filter = {
+cmdline_parse_inst_t cmd_5tuple_filter = {
        .f = cmd_5tuple_filter_parsed,
        .data = NULL,
-       .help_str = "add a 5tuple filter",
+       .help_str = "add/del a 5tuple filter",
        .tokens = {
-               (void *)&cmd_5tuple_filter_add_filter,
+               (void *)&cmd_5tuple_filter_filter,
                (void *)&cmd_5tuple_filter_port_id,
+               (void *)&cmd_5tuple_filter_ops,
                (void *)&cmd_5tuple_filter_dst_ip,
                (void *)&cmd_5tuple_filter_dst_ip_value,
                (void *)&cmd_5tuple_filter_src_ip,
@@ -7219,46 +7341,12 @@ cmdline_parse_inst_t cmd_add_5tuple_filter = {
                (void *)&cmd_5tuple_filter_protocol_value,
                (void *)&cmd_5tuple_filter_mask,
                (void *)&cmd_5tuple_filter_mask_value,
-               (void *)&cmd_5tuple_filter_flags,
-               (void *)&cmd_5tuple_filter_flags_value,
+               (void *)&cmd_5tuple_filter_tcp_flags,
+               (void *)&cmd_5tuple_filter_tcp_flags_value,
                (void *)&cmd_5tuple_filter_priority,
                (void *)&cmd_5tuple_filter_priority_value,
                (void *)&cmd_5tuple_filter_queue,
                (void *)&cmd_5tuple_filter_queue_id,
-               (void *)&cmd_5tuple_filter_index,
-               (void *)&cmd_5tuple_filter_index_value,
-               NULL,
-       },
-};
-
-cmdline_parse_token_string_t cmd_5tuple_filter_remove_filter =
-       TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
-                               filter, "remove_5tuple_filter");
-cmdline_parse_inst_t cmd_remove_5tuple_filter = {
-       .f = cmd_5tuple_filter_parsed,
-       .data = NULL,
-       .help_str = "remove a 5tuple filter",
-       .tokens = {
-               (void *)&cmd_5tuple_filter_remove_filter,
-               (void *)&cmd_5tuple_filter_port_id,
-               (void *)&cmd_5tuple_filter_index,
-               (void *)&cmd_5tuple_filter_index_value,
-               NULL,
-       },
-};
-
-cmdline_parse_token_string_t cmd_5tuple_filter_get_filter =
-       TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
-                               filter, "get_5tuple_filter");
-cmdline_parse_inst_t cmd_get_5tuple_filter = {
-       .f = cmd_5tuple_filter_parsed,
-       .data = NULL,
-       .help_str = "get a 5tuple filter",
-       .tokens = {
-               (void *)&cmd_5tuple_filter_get_filter,
-               (void *)&cmd_5tuple_filter_port_id,
-               (void *)&cmd_5tuple_filter_index,
-               (void *)&cmd_5tuple_filter_index_value,
                NULL,
        },
 };
@@ -7623,32 +7711,35 @@ parse_flexbytes(const char *q_arg, uint8_t *flexbytes, uint16_t max_num)
        return ret;
 }
 
-static enum rte_eth_flow_type
+static uint16_t
 str2flowtype(char *string)
 {
        uint8_t i = 0;
        static const struct {
                char str[32];
-               enum rte_eth_flow_type type;
+               uint16_t type;
        } flowtype_str[] = {
-               {"raw", RTE_ETH_FLOW_TYPE_RAW},
-               {"ip4", RTE_ETH_FLOW_TYPE_IPV4_OTHER},
-               {"ip4-frag", RTE_ETH_FLOW_TYPE_FRAG_IPV4},
-               {"udp4", RTE_ETH_FLOW_TYPE_UDPV4},
-               {"tcp4", RTE_ETH_FLOW_TYPE_TCPV4},
-               {"sctp4", RTE_ETH_FLOW_TYPE_SCTPV4},
-               {"ip6", RTE_ETH_FLOW_TYPE_IPV6_OTHER},
-               {"ip6-frag", RTE_ETH_FLOW_TYPE_FRAG_IPV6},
-               {"udp6", RTE_ETH_FLOW_TYPE_UDPV6},
-               {"tcp6", RTE_ETH_FLOW_TYPE_TCPV6},
-               {"sctp6", RTE_ETH_FLOW_TYPE_TCPV6},
+               {"raw", RTE_ETH_FLOW_RAW},
+               {"ipv4", RTE_ETH_FLOW_IPV4},
+               {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
+               {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
+               {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
+               {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
+               {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
+               {"ipv6", RTE_ETH_FLOW_IPV6},
+               {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
+               {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
+               {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
+               {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
+               {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
+               {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
        };
 
        for (i = 0; i < RTE_DIM(flowtype_str); i++) {
                if (!strcmp(flowtype_str[i].str, string))
                        return flowtype_str[i].type;
        }
-       return RTE_ETH_FLOW_TYPE_NONE;
+       return RTE_ETH_FLOW_UNKNOWN;
 }
 
 #define IPV4_ADDR_TO_UINT(ip_addr, ip) \
@@ -7701,10 +7792,10 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 
        entry.input.flow_type = str2flowtype(res->flow_type);
        switch (entry.input.flow_type) {
-       case RTE_ETH_FLOW_TYPE_IPV4_OTHER:
-       case RTE_ETH_FLOW_TYPE_FRAG_IPV4:
-       case RTE_ETH_FLOW_TYPE_UDPV4:
-       case RTE_ETH_FLOW_TYPE_TCPV4:
+       case RTE_ETH_FLOW_FRAG_IPV4:
+       case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
+       case RTE_ETH_FLOW_NONFRAG_IPV4_UDP:
+       case RTE_ETH_FLOW_NONFRAG_IPV4_TCP:
                IPV4_ADDR_TO_UINT(res->ip_dst,
                        entry.input.flow.ip4_flow.dst_ip);
                IPV4_ADDR_TO_UINT(res->ip_src,
@@ -7715,7 +7806,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
                entry.input.flow.udp4_flow.src_port =
                                rte_cpu_to_be_16(res->port_src);
                break;
-       case RTE_ETH_FLOW_TYPE_SCTPV4:
+       case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP:
                IPV4_ADDR_TO_UINT(res->ip_dst,
                        entry.input.flow.sctp4_flow.ip.dst_ip);
                IPV4_ADDR_TO_UINT(res->ip_src,
@@ -7724,10 +7815,10 @@ cmd_flow_director_filter_parsed(void *parsed_result,
                entry.input.flow.sctp4_flow.verify_tag =
                                rte_cpu_to_be_32(res->verify_tag_value);
                break;
-       case RTE_ETH_FLOW_TYPE_IPV6_OTHER:
-       case RTE_ETH_FLOW_TYPE_FRAG_IPV6:
-       case RTE_ETH_FLOW_TYPE_UDPV6:
-       case RTE_ETH_FLOW_TYPE_TCPV6:
+       case RTE_ETH_FLOW_FRAG_IPV6:
+       case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER:
+       case RTE_ETH_FLOW_NONFRAG_IPV6_UDP:
+       case RTE_ETH_FLOW_NONFRAG_IPV6_TCP:
                IPV6_ADDR_TO_ARRAY(res->ip_dst,
                        entry.input.flow.ipv6_flow.dst_ip);
                IPV6_ADDR_TO_ARRAY(res->ip_src,
@@ -7738,7 +7829,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
                entry.input.flow.udp6_flow.src_port =
                                rte_cpu_to_be_16(res->port_src);
                break;
-       case RTE_ETH_FLOW_TYPE_SCTPV6:
+       case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP:
                IPV6_ADDR_TO_ARRAY(res->ip_dst,
                        entry.input.flow.sctp6_flow.ip.dst_ip);
                IPV6_ADDR_TO_ARRAY(res->ip_src,
@@ -7794,9 +7885,8 @@ cmdline_parse_token_string_t cmd_flow_director_flow =
                                 flow, "flow");
 cmdline_parse_token_string_t cmd_flow_director_flow_type =
        TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
-                                flow_type,
-                                "ip4#ip4-frag#tcp4#udp4#sctp4#"
-                                "ip6#ip6-frag#tcp6#udp6#sctp6");
+               flow_type, "ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
+               "ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp");
 cmdline_parse_token_string_t cmd_flow_director_src =
        TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
                                 src, "src");
@@ -8105,7 +8195,8 @@ cmd_flow_director_flex_mask_parsed(void *parsed_result,
        struct rte_eth_fdir_info fdir_info;
        struct rte_eth_fdir_flex_mask flex_mask;
        struct rte_port *port;
-       enum rte_eth_flow_type i;
+       uint32_t flow_type_mask;
+       uint16_t i;
        int ret;
 
        if (res->port_id > nb_ports) {
@@ -8129,14 +8220,22 @@ cmd_flow_director_flex_mask_parsed(void *parsed_result,
                return;
        }
 
+       memset(&fdir_info, 0, sizeof(fdir_info));
+       ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_FDIR,
+                               RTE_ETH_FILTER_INFO, &fdir_info);
+       if (ret < 0) {
+               printf("Cannot get FDir filter info\n");
+               return;
+       }
+
+       flow_type_mask = fdir_info.flow_types_mask[0];
        if (!strcmp(res->flow_type, "all")) {
-               memset(&fdir_info, 0, sizeof(fdir_info));
-               rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_FDIR,
-                                      RTE_ETH_FILTER_INFO, &fdir_info);
-               for (i = RTE_ETH_FLOW_TYPE_RAW;
-                    i <= RTE_ETH_FLOW_TYPE_FRAG_IPV6;
-                    i++) {
-                       if (fdir_info.flow_types_mask[0] & (1 << i)) {
+               if (!flow_type_mask) {
+                       printf("No flow type supported\n");
+                       return;
+               }
+               for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
+                       if (flow_type_mask & (1 << i)) {
                                flex_mask.flow_type = i;
                                fdir_set_flex_mask(res->port_id, &flex_mask);
                        }
@@ -8145,6 +8244,11 @@ cmd_flow_director_flex_mask_parsed(void *parsed_result,
                return;
        }
        flex_mask.flow_type = str2flowtype(res->flow_type);
+       if (!(flow_type_mask & (1 << flex_mask.flow_type))) {
+               printf("Flow type %s not supported on port %d\n",
+                               res->flow_type, res->port_id);
+               return;
+       }
        fdir_set_flex_mask(res->port_id, &flex_mask);
        cmd_reconfig_device_queue(res->port_id, 1, 1);
 }
@@ -8161,9 +8265,8 @@ cmdline_parse_token_string_t cmd_flow_director_flexmask_flow =
                                 flow, "flow");
 cmdline_parse_token_string_t cmd_flow_director_flexmask_flow_type =
        TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,
-                                flow_type,
-                               "raw#ip4#ip4-frag#tcp4#udp4#sctp4#"
-                               "ip6#ip6-frag#tcp6#udp6#sctp6#all");
+               flow_type, "raw#ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
+               "ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#all");
 cmdline_parse_token_string_t cmd_flow_director_flexmask_mask =
        TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,
                                 mask, NULL);
@@ -8422,23 +8525,26 @@ struct cmd_get_hash_global_config_result {
 };
 
 static char *
-flowtype_to_str(enum rte_eth_flow_type ftype)
+flowtype_to_str(uint16_t ftype)
 {
        uint16_t i;
        static struct {
                char str[16];
-               enum rte_eth_flow_type ftype;
+               uint16_t ftype;
        } ftype_table[] = {
-               {"ip4", RTE_ETH_FLOW_TYPE_IPV4_OTHER},
-               {"ip4-frag", RTE_ETH_FLOW_TYPE_FRAG_IPV4},
-               {"udp4", RTE_ETH_FLOW_TYPE_UDPV4},
-               {"tcp4", RTE_ETH_FLOW_TYPE_TCPV4},
-               {"sctp4", RTE_ETH_FLOW_TYPE_SCTPV4},
-               {"ip6", RTE_ETH_FLOW_TYPE_IPV6_OTHER},
-               {"ip6-frag", RTE_ETH_FLOW_TYPE_FRAG_IPV6},
-               {"udp6", RTE_ETH_FLOW_TYPE_UDPV6},
-               {"tcp6", RTE_ETH_FLOW_TYPE_TCPV6},
-               {"sctp6", RTE_ETH_FLOW_TYPE_TCPV6},
+               {"ipv4", RTE_ETH_FLOW_IPV4},
+               {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
+               {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
+               {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
+               {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
+               {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
+               {"ipv6", RTE_ETH_FLOW_IPV6},
+               {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
+               {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
+               {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
+               {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
+               {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
+               {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
        };
 
        for (i = 0; i < RTE_DIM(ftype_table); i++) {
@@ -8456,7 +8562,8 @@ cmd_get_hash_global_config_parsed(void *parsed_result,
 {
        struct cmd_get_hash_global_config_result *res = parsed_result;
        struct rte_eth_hash_filter_info info;
-       uint32_t idx, offset, i;
+       uint32_t idx, offset;
+       uint16_t i;
        char *str;
        int ret;
 
@@ -8489,13 +8596,13 @@ cmd_get_hash_global_config_parsed(void *parsed_result,
                break;
        }
 
-       for (i = 0; i < RTE_ETH_FLOW_TYPE_MAX; i++) {
+       for (i = 0; i < RTE_ETH_FLOW_MAX; i++) {
                idx = i / UINT32_BIT;
                offset = i % UINT32_BIT;
                if (!(info.info.global_conf.valid_bit_mask[idx] &
                                                (1UL << offset)))
                        continue;
-               str = flowtype_to_str((enum rte_eth_flow_type)i);
+               str = flowtype_to_str(i);
                if (!str)
                        continue;
                printf("Symmetric hash is %s globally for flow type %s "
@@ -8590,7 +8697,8 @@ cmdline_parse_token_string_t cmd_set_hash_global_config_hash_func =
 cmdline_parse_token_string_t cmd_set_hash_global_config_flow_type =
        TOKEN_STRING_INITIALIZER(struct cmd_set_hash_global_config_result,
                flow_type,
-               "ip4#ip4-frag#tcp4#udp4#sctp4#ip6#ip6-frag#tcp6#udp6#sctp6");
+               "ipv4#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#ipv4-other#ipv6#"
+               "ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#ipv6-other#l2_payload");
 cmdline_parse_token_string_t cmd_set_hash_global_config_enable =
        TOKEN_STRING_INITIALIZER(struct cmd_set_hash_global_config_result,
                enable, "enable#disable");
@@ -8600,7 +8708,8 @@ cmdline_parse_inst_t cmd_set_hash_global_config = {
        .data = NULL,
        .help_str = "set_hash_global_config port_id "
                "toeplitz|simple_xor|default "
-               "ip4|ip4-frag|tcp4|udp4|#sctp4|ip6|ip6-frag|tcp6|udp6|sctp6 "
+               "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|"
+               "ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload "
                "enable|disable",
        .tokens = {
                (void *)&cmd_set_hash_global_config_all,
@@ -8691,6 +8800,8 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_set_qmap,
        (cmdline_parse_inst_t *)&cmd_operate_port,
        (cmdline_parse_inst_t *)&cmd_operate_specific_port,
+       (cmdline_parse_inst_t *)&cmd_operate_attach_port,
+       (cmdline_parse_inst_t *)&cmd_operate_detach_port,
        (cmdline_parse_inst_t *)&cmd_config_speed_all,
        (cmdline_parse_inst_t *)&cmd_config_speed_specific,
        (cmdline_parse_inst_t *)&cmd_config_rx_tx,
@@ -8724,15 +8835,9 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_dump,
        (cmdline_parse_inst_t *)&cmd_dump_one,
        (cmdline_parse_inst_t *)&cmd_ethertype_filter,
-       (cmdline_parse_inst_t *)&cmd_add_syn_filter,
-       (cmdline_parse_inst_t *)&cmd_remove_syn_filter,
-       (cmdline_parse_inst_t *)&cmd_get_syn_filter,
-       (cmdline_parse_inst_t *)&cmd_add_2tuple_filter,
-       (cmdline_parse_inst_t *)&cmd_remove_2tuple_filter,
-       (cmdline_parse_inst_t *)&cmd_get_2tuple_filter,
-       (cmdline_parse_inst_t *)&cmd_add_5tuple_filter,
-       (cmdline_parse_inst_t *)&cmd_remove_5tuple_filter,
-       (cmdline_parse_inst_t *)&cmd_get_5tuple_filter,
+       (cmdline_parse_inst_t *)&cmd_syn_filter,
+       (cmdline_parse_inst_t *)&cmd_2tuple_filter,
+       (cmdline_parse_inst_t *)&cmd_5tuple_filter,
        (cmdline_parse_inst_t *)&cmd_flex_filter,
        (cmdline_parse_inst_t *)&cmd_add_del_ip_flow_director,
        (cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director,
@@ -8768,7 +8873,7 @@ prompt(void)
 static void
 cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue)
 {
-       if (id < nb_ports) {
+       if (!port_id_is_invalid(id, DISABLED_WARN)) {
                /* check if need_reconfig has been set to 1 */
                if (ports[id].need_reconfig == 0)
                        ports[id].need_reconfig = dev;
@@ -8778,7 +8883,7 @@ cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue)
        } else {
                portid_t pid;
 
-               for (pid = 0; pid < nb_ports; pid++) {
+               FOREACH_PORT(pid, ports) {
                        /* check if need_reconfig has been set to 1 */
                        if (ports[pid].need_reconfig == 0)
                                ports[pid].need_reconfig = dev;
@@ -8796,10 +8901,8 @@ bypass_is_supported(portid_t port_id)
        struct rte_port   *port;
        struct rte_pci_id *pci_id;
 
-       if (port_id >= nb_ports) {
-               printf("\tPort id must be less than %d.\n", nb_ports);
+       if (port_id_is_invalid(port_id, ENABLED_WARN))
                return 0;
-       }
 
        /* Get the device id. */
        port    = &ports[port_id];