]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: fix port state when stop
authorMin Hu (Connor) <humin29@huawei.com>
Tue, 3 May 2022 10:02:17 +0000 (18:02 +0800)
committerFerruh Yigit <ferruh.yigit@xilinx.com>
Mon, 30 May 2022 11:20:22 +0000 (13:20 +0200)
Currently, 'dev_started' is always set to be 0 when dev stop, whether
it succeeded or failed. This is unreasonable and this patch fixed it.

Fixes: 62024eb82756 ("ethdev: change stop operation callback to return int")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
lib/ethdev/rte_ethdev.c

index a1758676514cbea822b610786e9def8e8b45a5e9..fe64f8d39da8ebc697294fc0167882202e168e4e 100644 (file)
@@ -1533,8 +1533,9 @@ rte_eth_dev_stop(uint16_t port_id)
        /* point fast-path functions to dummy ones */
        eth_dev_fp_ops_reset(rte_eth_fp_ops + port_id);
 
-       dev->data->dev_started = 0;
        ret = (*dev->dev_ops->dev_stop)(dev);
+       if (ret == 0)
+               dev->data->dev_started = 0;
        rte_ethdev_trace_stop(port_id, ret);
 
        return ret;