app/testpmd: fix flow completion for RSS queues
authorAdrien Mazarguil <adrien.mazarguil@6wind.com>
Thu, 19 Apr 2018 10:07:33 +0000 (12:07 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 27 Apr 2018 14:54:56 +0000 (15:54 +0100)
The lack of a working completion for RSS queues was overlooked during
development; until now only "end" was displayed as a valid token.

Fixes: 05d34c6e9d2c ("app/testpmd: add queue actions to flow command")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
app/test-pmd/cmdline_flow.c

index 59f3b3b..4640f18 100644 (file)
@@ -2663,17 +2663,15 @@ static int
 comp_vc_action_rss_queue(struct context *ctx, const struct token *token,
                         unsigned int ent, char *buf, unsigned int size)
 {
-       static const char *const str[] = { "", "end", NULL };
-       unsigned int i;
-
        (void)ctx;
        (void)token;
-       for (i = 0; str[i] != NULL; ++i)
-               if (buf && i == ent)
-                       return snprintf(buf, size, "%s", str[i]);
-       if (buf)
-               return -1;
-       return i;
+       if (!buf)
+               return nb_rxq + 1;
+       if (ent < nb_rxq)
+               return snprintf(buf, size, "%u", ent);
+       if (ent == nb_rxq)
+               return snprintf(buf, size, "end");
+       return -1;
 }
 
 /** Internal context. */