Skip to content

Commit

Permalink
ethdev: fix port close in secondary process
Browse files Browse the repository at this point in the history
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: febc855 ("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>
  • Loading branch information
hushenggitcount authored and ol-andrewr committed Jun 1, 2022
1 parent ae9aafe commit ea6101a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/ethdev/rte_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ea6101a

Please sign in to comment.