| 3879 | } |
| 3880 | |
| 3881 | static int |
| 3882 | bond_remove(struct rte_vdev_device *dev) |
| 3883 | { |
| 3884 | struct rte_eth_dev *eth_dev; |
| 3885 | struct bond_dev_private *internals; |
| 3886 | const char *name; |
| 3887 | int ret = 0; |
| 3888 | |
| 3889 | if (!dev) |
| 3890 | return -EINVAL; |
| 3891 | |
| 3892 | name = rte_vdev_device_name(dev); |
| 3893 | RTE_BOND_LOG(INFO, "Uninitializing pmd_bond for %s", name); |
| 3894 | |
| 3895 | /* find an ethdev entry */ |
| 3896 | eth_dev = rte_eth_dev_allocated(name); |
| 3897 | if (eth_dev == NULL) |
| 3898 | return 0; /* port already released */ |
| 3899 | |
| 3900 | if (rte_eal_process_type() != RTE_PROC_PRIMARY) |
| 3901 | return rte_eth_dev_release_port(eth_dev); |
| 3902 | |
| 3903 | RTE_ASSERT(eth_dev->device == &dev->device); |
| 3904 | |
| 3905 | internals = eth_dev->data->dev_private; |
| 3906 | if (internals->member_count != 0) |
| 3907 | return -EBUSY; |
| 3908 | |
| 3909 | if (eth_dev->data->dev_started == 1) { |
| 3910 | ret = bond_ethdev_stop(eth_dev); |
| 3911 | bond_ethdev_close(eth_dev); |
| 3912 | } |
| 3913 | rte_eth_dev_release_port(eth_dev); |
| 3914 | |
| 3915 | return ret; |
| 3916 | } |
| 3917 | |
| 3918 | /* this part will resolve the member portids after all the other pdev and vdev |
| 3919 | * have been allocated */ |
nothing calls this directly
no test coverage detected