app/testpmd: fix flow flush with invalid port
authorJunyu Jiang <junyux.jiang@intel.com>
Fri, 16 Oct 2020 02:03:10 +0000 (02:03 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 16 Oct 2020 17:48:19 +0000 (19:48 +0200)
There is no error info displayed when running flow flush
command with invalid port. This patch fixed the issue.

Fixes: 2a449871a12d ("app/testpmd: align behaviour of multi-port detach")
Cc: stable@dpdk.org
Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>
Reviewed-by: Suanming Mou <suanmingm@nvidia.com>
app/test-pmd/config.c

index 2c00b55..c783108 100644 (file)
@@ -1988,19 +1988,22 @@ int
 port_flow_flush(portid_t port_id)
 {
        struct rte_flow_error error;
-       struct rte_port *port = &ports[port_id];
+       struct rte_port *port;
        int ret = 0;
 
+       if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+               port_id == (portid_t)RTE_PORT_ALL)
+               return -EINVAL;
+
+       port = &ports[port_id];
+
        if (port->flow_list == NULL)
                return ret;
 
        /* Poisoning to make sure PMDs update it in case of error. */
        memset(&error, 0x44, sizeof(error));
        if (rte_flow_flush(port_id, &error)) {
-               ret = port_flow_complain(&error);
-               if (port_id_is_invalid(port_id, DISABLED_WARN) ||
-                   port_id == (portid_t)RTE_PORT_ALL)
-                       return ret;
+               port_flow_complain(&error);
        }
 
        while (port->flow_list) {