ethdev: refactor port release
Use DEV_DETACHED constant and deduplicate code in init. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
This commit is contained in:
parent
d800f55ff0
commit
ff3ae4d446
@ -287,7 +287,7 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
|
|||||||
if (eth_dev == NULL)
|
if (eth_dev == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
eth_dev->attached = 0;
|
eth_dev->attached = DEV_DETACHED;
|
||||||
nb_ports--;
|
nb_ports--;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -342,8 +342,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
|
|||||||
(unsigned) pci_dev->id.device_id);
|
(unsigned) pci_dev->id.device_id);
|
||||||
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
|
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
|
||||||
rte_free(eth_dev->data->dev_private);
|
rte_free(eth_dev->data->dev_private);
|
||||||
eth_dev->attached = DEV_DETACHED;
|
rte_eth_dev_release_port(eth_dev);
|
||||||
nb_ports--;
|
|
||||||
return diag;
|
return diag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user