]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: fix port close in secondary process
authorMin Hu (Connor) <humin29@huawei.com>
Wed, 1 Jun 2022 03:15:13 +0000 (11:15 +0800)
committerAndrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Wed, 1 Jun 2022 09:09:42 +0000 (11:09 +0200)
Secondary process needs to close device to release process private
resources.  But secondary process should not be obliged to wait for
device stop before closing ethdev.

Fixes: febc855b358e ("ethdev: forbid closing started device")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
lib/ethdev/rte_ethdev.c

index 46c088dc8893165a91152e29e8b9af862c03acc8..b9c5dea09fba64a015a21fe32f205f0d0f731cc3 100644 (file)
@@ -1576,7 +1576,13 @@ rte_eth_dev_close(uint16_t port_id)
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
        dev = &rte_eth_devices[port_id];
 
-       if (dev->data->dev_started) {
+       /*
+        * Secondary process needs to close device to release process private
+        * resources. But secondary process should not be obliged to wait
+        * for device stop before closing ethdev.
+        */
+       if (rte_eal_process_type() == RTE_PROC_PRIMARY &&
+                       dev->data->dev_started) {
                RTE_ETHDEV_LOG(ERR, "Cannot close started device (port %u)\n",
                               port_id);
                return -EINVAL;