net/virtio: fix incorrect cast of void *
[dpdk.git] / app / test-pmd / cmdline.c
index bedf1e4..f71d963 100644 (file)
@@ -526,6 +526,10 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "    e.g., 'set stat_qmap rx 0 2 5' sets rx queue 2"
                        " on port 0 to mapping 5.\n\n"
 
+                       "set xstats-hide-zero on|off\n"
+                       "    Set the option to hide the zero values"
+                       " for xstats display.\n"
+
                        "set port (port_id) vf (vf_id) rx|tx on|off\n"
                        "    Enable/Disable a VF receive/tranmit from a port\n\n"
 
@@ -7173,6 +7177,48 @@ cmdline_parse_inst_t cmd_set_qmap = {
        },
 };
 
+/* *** SET OPTION TO HIDE ZERO VALUES FOR XSTATS  DISPLAY *** */
+struct cmd_set_xstats_hide_zero_result {
+       cmdline_fixed_string_t keyword;
+       cmdline_fixed_string_t name;
+       cmdline_fixed_string_t on_off;
+};
+
+static void
+cmd_set_xstats_hide_zero_parsed(void *parsed_result,
+                       __attribute__((unused)) struct cmdline *cl,
+                       __attribute__((unused)) void *data)
+{
+       struct cmd_set_xstats_hide_zero_result *res;
+       uint16_t on_off = 0;
+
+       res = parsed_result;
+       on_off = !strcmp(res->on_off, "on") ? 1 : 0;
+       set_xstats_hide_zero(on_off);
+}
+
+cmdline_parse_token_string_t cmd_set_xstats_hide_zero_keyword =
+       TOKEN_STRING_INITIALIZER(struct cmd_set_xstats_hide_zero_result,
+                                keyword, "set");
+cmdline_parse_token_string_t cmd_set_xstats_hide_zero_name =
+       TOKEN_STRING_INITIALIZER(struct cmd_set_xstats_hide_zero_result,
+                                name, "xstats-hide-zero");
+cmdline_parse_token_string_t cmd_set_xstats_hide_zero_on_off =
+       TOKEN_STRING_INITIALIZER(struct cmd_set_xstats_hide_zero_result,
+                                on_off, "on#off");
+
+cmdline_parse_inst_t cmd_set_xstats_hide_zero = {
+       .f = cmd_set_xstats_hide_zero_parsed,
+       .data = NULL,
+       .help_str = "set xstats-hide-zero on|off",
+       .tokens = {
+               (void *)&cmd_set_xstats_hide_zero_keyword,
+               (void *)&cmd_set_xstats_hide_zero_name,
+               (void *)&cmd_set_xstats_hide_zero_on_off,
+               NULL,
+       },
+};
+
 /* *** CONFIGURE UNICAST HASH TABLE *** */
 struct cmd_set_uc_hash_table {
        cmdline_fixed_string_t set;
@@ -7494,6 +7540,8 @@ cmd_set_vf_rxmode_parsed(void *parsed_result,
                        rx_mode |= ETH_VMDQ_ACCEPT_MULTICAST;
        }
 
+       RTE_SET_USED(is_on);
+
 #ifdef RTE_LIBRTE_IXGBE_PMD
        if (ret == -ENOTSUP)
                ret = rte_pmd_ixgbe_set_vf_rxmode(res->port_id, res->vf_id,
@@ -10163,7 +10211,7 @@ cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
                "ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|"
                "l2_payload src <src_ip> dst <dst_ip> tos <tos_value> "
                "proto <proto_value> ttl <ttl_value> vlan <vlan_value> "
-               "flexbytes <flexbyte_vaues> drop|fw <pf_vf> queue <queue_id> "
+               "flexbytes <flexbyte_values> drop|fw <pf_vf> queue <queue_id> "
                "fd_id <fd_id_value>: "
                "Add or delete an ip flow director entry on NIC",
        .tokens = {
@@ -14314,7 +14362,7 @@ cmd_ddp_info_parsed(
        uint32_t dev_num = 0;
        struct rte_pmd_i40e_ddp_device_id *devs;
        uint32_t proto_num = 0;
-       struct rte_pmd_i40e_proto_info *proto;
+       struct rte_pmd_i40e_proto_info *proto = NULL;
        uint32_t pctype_num = 0;
        struct rte_pmd_i40e_ptype_info *pctype;
        uint32_t ptype_num = 0;
@@ -14493,9 +14541,10 @@ no_print_pctypes:
        free(ptype);
        printf("\n");
 
-       free(proto);
        ret = 0;
 no_print_return:
+       if (proto)
+               free(proto);
 #endif
        if (ret == -ENOTSUP)
                printf("Function not supported in PMD driver\n");
@@ -15577,6 +15626,7 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_stop,
        (cmdline_parse_inst_t *)&cmd_mac_addr,
        (cmdline_parse_inst_t *)&cmd_set_qmap,
+       (cmdline_parse_inst_t *)&cmd_set_xstats_hide_zero,
        (cmdline_parse_inst_t *)&cmd_operate_port,
        (cmdline_parse_inst_t *)&cmd_operate_specific_port,
        (cmdline_parse_inst_t *)&cmd_operate_attach_port,