apps: use helper to create mbuf pools
[dpdk.git] / app / test-pmd / cmdline.c
index 8b0ac85..f01db2a 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>
@@ -318,7 +317,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 
                        "csum set (ip|udp|tcp|sctp|outer-ip) (hw|sw) (port_id)\n"
                        "    Select hardware or software calculation of the"
-                       " checksum with when transmitting a packet using the"
+                       " checksum when transmitting a packet using the"
                        " csum forward engine.\n"
                        "    ip|udp|tcp|sctp always concern the inner layer.\n"
                        "    outer-ip concerns the outer IP layer in"
@@ -530,7 +529,8 @@ 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"
@@ -661,8 +661,7 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "    Set flow director mask.\n\n"
 
                        "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|"
+                       " flow (none|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"
@@ -1343,6 +1342,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;
@@ -1371,7 +1397,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");
@@ -1379,7 +1406,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,
@@ -8199,6 +8227,19 @@ cmd_flow_director_flex_mask_parsed(void *parsed_result,
                return;
        }
 
+       if (!strcmp(res->flow_type, "none")) {
+               /* means don't specify the flow type */
+               flex_mask.flow_type = RTE_ETH_FLOW_UNKNOWN;
+               for (i = 0; i < RTE_ETH_FLOW_MAX; i++)
+                       memset(&port->dev_conf.fdir_conf.flex_conf.flex_mask[i],
+                              0, sizeof(struct rte_eth_fdir_flex_mask));
+               port->dev_conf.fdir_conf.flex_conf.nb_flexmasks = 1;
+               (void)rte_memcpy(&port->dev_conf.fdir_conf.flex_conf.flex_mask[0],
+                                &flex_mask,
+                                sizeof(struct rte_eth_fdir_flex_mask));
+               cmd_reconfig_device_queue(res->port_id, 1, 1);
+               return;
+       }
        flow_type_mask = fdir_info.flow_types_mask[0];
        if (!strcmp(res->flow_type, "all")) {
                if (!flow_type_mask) {
@@ -8236,7 +8277,7 @@ 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#ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
+               flow_type, "none#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,
@@ -8844,14 +8885,7 @@ prompt(void)
 static void
 cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue)
 {
-       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;
-               /* check if need_reconfig_queues has been set to 1 */
-               if (ports[id].need_reconfig_queues == 0)
-                       ports[id].need_reconfig_queues = queue;
-       } else {
+       if (id == (portid_t)RTE_PORT_ALL) {
                portid_t pid;
 
                FOREACH_PORT(pid, ports) {
@@ -8862,6 +8896,13 @@ cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue)
                        if (ports[pid].need_reconfig_queues == 0)
                                ports[pid].need_reconfig_queues = queue;
                }
+       } else 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;
+               /* check if need_reconfig_queues has been set to 1 */
+               if (ports[id].need_reconfig_queues == 0)
+                       ports[id].need_reconfig_queues = queue;
        }
 }