@@ -750,6 +750,7 @@ pmd_probe(struct rte_vdev_device *vdev)
}
/* TODO: request info from primary to set up Rx and Tx */
eth_dev->dev_ops = &pmd_ops;
+ eth_dev->device = &vdev->device;
rte_eth_dev_probing_finish(eth_dev);
return 0;
}
@@ -803,17 +804,29 @@ pmd_remove(struct rte_vdev_device *vdev)
{
struct rte_eth_dev *dev = NULL;
struct pmd_internals *p;
+ const char *name;
if (!vdev)
return -EINVAL;
- PMD_LOG(INFO, "Removing device \"%s\"",
- rte_vdev_device_name(vdev));
+ name = rte_vdev_device_name(vdev);
+ PMD_LOG(INFO, "Removing device \"%s\"", name);
/* Find the ethdev entry */
- dev = rte_eth_dev_allocated(rte_vdev_device_name(vdev));
+ dev = rte_eth_dev_allocated(name);
if (dev == NULL)
return -ENODEV;
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+ /* detach device on local pprocess only */
+ if (strlen(rte_vdev_device_args(vdev)) == 0)
+ return rte_eth_dev_release_port_private(dev);
+ /**
+ * else this is a private device for current process
+ * so continue with normal detach scenario
+ */
+ }
+
p = dev->data->dev_private;
/* Free device data structures*/
Previously, detach port on secondary process will mess primary process and cause same device can't be attached again, by take advantage of rte_eth_release_port_private, we can support this with minor change. Signed-off-by: Qi Zhang <qi.z.zhang@intel.com> --- drivers/net/softnic/rte_eth_softnic.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)