return -ENOMEM;
}
+static void ifpga_adapter_destroy(struct opae_adapter *adapter)
+{
+ struct ifpga_fme_hw *fme;
+
+ if (adapter && adapter->mgr && adapter->mgr->data) {
+ fme = (struct ifpga_fme_hw *)adapter->mgr->data;
+ if (fme->parent)
+ ifpga_bus_uinit(fme->parent);
+ }
+}
+
struct opae_adapter_ops ifpga_adapter_ops = {
.enumerate = ifpga_adapter_enumerate,
+ .destroy = ifpga_adapter_destroy,
};
/**
return 0;
}
+
+int ifpga_bus_uinit(struct ifpga_hw *hw)
+{
+ int i;
+ struct ifpga_port_hw *port;
+
+ if (hw) {
+ fme_hw_uinit(&hw->fme);
+ for (i = 0; i < MAX_FPGA_PORT_NUM; i++) {
+ port = &hw->port[i];
+ port_hw_uinit(port);
+ }
+ }
+
+ return 0;
+}
#define _IFPGA_ENUMERATE_H_
int ifpga_bus_init(struct ifpga_hw *hw);
+int ifpga_bus_uinit(struct ifpga_hw *hw);
int ifpga_bus_enumerate(struct ifpga_hw *hw);
#endif /* _IFPGA_ENUMERATE_H_ */
static int
ifpga_rawdev_close(struct rte_rawdev *dev)
{
+ struct opae_adapter *adapter;
+
+ if (dev) {
+ adapter = ifpga_rawdev_get_priv(dev);
+ if (adapter) {
+ opae_adapter_destroy(adapter);
+ opae_adapter_data_free(adapter->data);
+ }
+ }
+
return dev ? 0:1;
}
char name[RTE_RAWDEV_NAME_MAX_LEN];
struct opae_adapter *adapter;
struct opae_manager *mgr;
+ struct ifpga_rawdev *dev;
if (!pci_dev) {
IFPGA_RAWDEV_PMD_ERR("Invalid pci_dev of the device!");
IFPGA_RAWDEV_PMD_ERR("Invalid device name (%s)", name);
return -EINVAL;
}
+ dev = ifpga_rawdev_get(rawdev);
+ if (dev)
+ dev->rawdev = NULL;
adapter = ifpga_rawdev_get_priv(rawdev);
if (!adapter)
fme_interrupt_handler, mgr) < 0)
return -EINVAL;
- opae_adapter_data_free(adapter->data);
- opae_adapter_free(adapter);
-
/* rte_rawdev_close is called by pmd_release */
ret = rte_rawdev_pmd_release(rawdev);
if (ret)