summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Monjalon <thomas.monjalon@6wind.com>2015-07-18 19:46:20 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-07-19 12:50:02 +0200
commitff3ae4d4462bc8685bcb10f61b1f850eefad6f3e (patch)
tree5be8ae58213f4bfb6758d9a2bf91f5b477f2d79c
parentd800f55ff06ebb117bc4ba81d78cbce2838585c3 (diff)
downloaddpdk-ff3ae4d4462bc8685bcb10f61b1f850eefad6f3e.zip
dpdk-ff3ae4d4462bc8685bcb10f61b1f850eefad6f3e.tar.gz
dpdk-ff3ae4d4462bc8685bcb10f61b1f850eefad6f3e.tar.xz
ethdev: refactor port release
Use DEV_DETACHED constant and deduplicate code in init. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
-rw-r--r--lib/librte_ether/rte_ethdev.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 9596047..d00d104 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -287,7 +287,7 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
if (eth_dev == NULL)
return -EINVAL;
- eth_dev->attached = 0;
+ eth_dev->attached = DEV_DETACHED;
nb_ports--;
return 0;
}
@@ -342,8 +342,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
(unsigned) pci_dev->id.device_id);
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
rte_free(eth_dev->data->dev_private);
- eth_dev->attached = DEV_DETACHED;
- nb_ports--;
+ rte_eth_dev_release_port(eth_dev);
return diag;
}