+static const struct eth_dev_ops ionic_eth_dev_ops = {
+};
+
+static int
+eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
+{
+ struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
+ struct ionic_adapter *adapter = (struct ionic_adapter *)init_params;
+ int err;
+
+ IONIC_PRINT_CALL();
+
+ eth_dev->dev_ops = &ionic_eth_dev_ops;
+
+ /* Multi-process not supported, primary does initialization anyway */
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
+
+ rte_eth_copy_pci_info(eth_dev, pci_dev);
+
+ lif->index = adapter->nlifs;
+ lif->eth_dev = eth_dev;
+ lif->adapter = adapter;
+ adapter->lifs[adapter->nlifs] = lif;
+
+ err = ionic_lif_alloc(lif);
+ if (err) {
+ IONIC_PRINT(ERR, "Cannot allocate LIFs: %d, aborting",
+ err);
+ goto err;
+ }
+
+ err = ionic_lif_init(lif);
+ if (err) {
+ IONIC_PRINT(ERR, "Cannot init LIFs: %d, aborting", err);
+ goto err_free_lif;
+ }
+
+ IONIC_PRINT(DEBUG, "Port %u initialized", eth_dev->data->port_id);
+
+ return 0;
+
+err_free_lif:
+ ionic_lif_free(lif);
+err:
+ return err;
+}
+
+static int
+eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+ struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
+ struct ionic_adapter *adapter = lif->adapter;
+
+ IONIC_PRINT_CALL();
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
+
+ adapter->lifs[lif->index] = NULL;
+
+ ionic_lif_deinit(lif);
+ ionic_lif_free(lif);
+
+ eth_dev->dev_ops = NULL;
+
+ return 0;
+}
+