remove extra parentheses in return statement
[dpdk.git] / app / test-pmd / cmdline.c
index 7187cd8..52e9f5f 100644 (file)
@@ -90,6 +90,8 @@
 
 #include "testpmd.h"
 
+static struct cmdline *testpmd_cl;
+
 static void cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue);
 
 #ifdef RTE_NIC_BYPASS
@@ -199,6 +201,9 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all)\n"
                        "    Clear information for port_id, or all.\n\n"
 
+                       "show (rxq|txq) info (port_id) (queue_id)\n"
+                       "    Display information for configured RX/TX queue.\n\n"
+
                        "show config (rxtx|cores|fwd|txpkts)\n"
                        "    Display the given configuration.\n\n"
 
@@ -2415,11 +2420,11 @@ parse_item_list(char* str, const char* item_name, unsigned int max_items,
                }
                if (c != ',') {
                        printf("character %c is not a decimal digit\n", c);
-                       return (0);
+                       return 0;
                }
                if (! value_ok) {
                        printf("No valid value before comma\n");
-                       return (0);
+                       return 0;
                }
                if (nb_item < max_items) {
                        parsed_items[nb_item] = value;
@@ -2431,11 +2436,11 @@ parse_item_list(char* str, const char* item_name, unsigned int max_items,
        if (nb_item >= max_items) {
                printf("Number of %s = %u > %u (maximum items)\n",
                       item_name, nb_item + 1, max_items);
-               return (0);
+               return 0;
        }
        parsed_items[nb_item++] = value;
        if (! check_unique_values)
-               return (nb_item);
+               return nb_item;
 
        /*
         * Then, check that all values in the list are differents.
@@ -2446,11 +2451,11 @@ parse_item_list(char* str, const char* item_name, unsigned int max_items,
                        if (parsed_items[j] == parsed_items[i]) {
                                printf("duplicated %s %u at index %u and %u\n",
                                       item_name, parsed_items[i], i, j);
-                               return (0);
+                               return 0;
                        }
                }
        }
-       return (nb_item);
+       return nb_item;
 }
 
 struct cmd_set_list_result {
@@ -9775,17 +9780,21 @@ cmdline_parse_ctx_t main_ctx[] = {
 void
 prompt(void)
 {
-       struct cmdline *cl;
-
        /* initialize non-constant commands */
        cmd_set_fwd_mode_init();
 
-       cl = cmdline_stdin_new(main_ctx, "testpmd> ");
-       if (cl == NULL) {
+       testpmd_cl = cmdline_stdin_new(main_ctx, "testpmd> ");
+       if (testpmd_cl == NULL)
                return;
-       }
-       cmdline_interact(cl);
-       cmdline_stdin_exit(cl);
+       cmdline_interact(testpmd_cl);
+       cmdline_stdin_exit(testpmd_cl);
+}
+
+void
+prompt_exit(void)
+{
+       if (testpmd_cl != NULL)
+               cmdline_quit(testpmd_cl);
 }
 
 static void