[v3] ethdev: fix dev close in secondary process
Checks
Commit Message
From: Min Hu <humin29@huawei.com>
Secondary process need to close dev to release process private resources.
But secondary process should not be obliged to wait for device stop before
closing ethdev.
This patch fixed it.
Fixes: febc855b358e ("ethdev: forbid closing started device")
Cc: stable@dpdk.org
Signed-off-by: Min Hu <humin29@huawei.com>
---
v3:
* add comment in the code.
v2:
* fixed comment.
---
lib/ethdev/rte_ethdev.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
Comments
On 6/1/22 06:15, Min Hu (Connor) wrote:
> From: Min Hu <humin29@huawei.com>
>
> Secondary process need to close dev to release process private resources.
> But secondary process should not be obliged to wait for device stop before
> closing ethdev.
>
> This patch fixed it.
>
> Fixes: febc855b358e ("ethdev: forbid closing started device")
> Cc: stable@dpdk.org
>
> Signed-off-by: Min Hu <humin29@huawei.com>
Applied to dpdk-next-net/main, thanks.
@@ -1574,7 +1574,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 need to close dev 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;