For future support of virtual devices, move the PCI code to its own file. Create a new device interface, struct ionic_dev_intf, to plug in to common code.
Signed-off-by: Andrew Boyer <andrew.bo...@amd.com> Signed-off-by: Neel Patel <neel.pa...@amd.com> Signed-off-by: R Mohamed Shah <mohamedsha...@amd.com> --- drivers/net/ionic/ionic.h | 13 +- drivers/net/ionic/ionic_dev.c | 62 --------- drivers/net/ionic/ionic_dev.h | 13 +- drivers/net/ionic/ionic_dev_pci.c | 216 ++++++++++++++++++++++++++++++ drivers/net/ionic/ionic_ethdev.c | 161 ++++++---------------- drivers/net/ionic/ionic_ethdev.h | 9 ++ drivers/net/ionic/ionic_main.c | 2 +- drivers/net/ionic/meson.build | 1 + 8 files changed, 286 insertions(+), 191 deletions(-) create mode 100644 drivers/net/ionic/ionic_dev_pci.c diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h index ebe23ad4e6..6bfab623f7 100644 --- a/drivers/net/ionic/ionic.h +++ b/drivers/net/ionic/ionic.h @@ -8,8 +8,6 @@ #include <stdint.h> #include <inttypes.h> -#include <bus_pci_driver.h> - #include "ionic_dev.h" #include "ionic_if.h" #include "ionic_osdep.h" @@ -42,6 +40,11 @@ struct ionic_hw { uint16_t vendor_id; }; +struct ionic_bars { + struct ionic_dev_bar bar[IONIC_BARS_MAX]; + uint32_t num_bars; +}; + /* * Structure to store private data for each driver instance (for each adapter). */ @@ -49,10 +52,10 @@ struct ionic_adapter { struct ionic_hw hw; struct ionic_dev idev; const char *name; - struct ionic_dev_bar bars[IONIC_BARS_MAX]; + struct ionic_bars bars; + const struct ionic_dev_intf *intf; struct ionic_identity ident; struct ionic_lif *lif; - uint32_t num_bars; uint32_t max_ntxqs_per_lif; uint32_t max_nrxqs_per_lif; uint32_t max_mac_addrs; @@ -61,7 +64,7 @@ struct ionic_adapter { bool intrs[IONIC_INTR_CTRL_REGS_MAX]; bool link_up; char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN]; - struct rte_pci_device *pci_dev; + void *bus_dev; }; /** ionic_admin_ctx - Admin command context. diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index a631523e59..d0d2ab1b17 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -10,68 +10,6 @@ #include "ionic_lif.h" #include "ionic.h" -int -ionic_dev_setup(struct ionic_adapter *adapter) -{ - struct ionic_dev_bar *bar = adapter->bars; - unsigned int num_bars = adapter->num_bars; - struct ionic_dev *idev = &adapter->idev; - uint32_t sig; - u_char *bar0_base; - unsigned int i; - - /* BAR0: dev_cmd and interrupts */ - if (num_bars < 1) { - IONIC_PRINT(ERR, "No bars found, aborting"); - return -EFAULT; - } - - if (bar->len < IONIC_BAR0_SIZE) { - IONIC_PRINT(ERR, - "Resource bar size %lu too small, aborting", - bar->len); - return -EFAULT; - } - - bar0_base = bar->vaddr; - idev->dev_info = (union ionic_dev_info_regs *) - &bar0_base[IONIC_BAR0_DEV_INFO_REGS_OFFSET]; - idev->dev_cmd = (union ionic_dev_cmd_regs *) - &bar0_base[IONIC_BAR0_DEV_CMD_REGS_OFFSET]; - idev->intr_status = (struct ionic_intr_status *) - &bar0_base[IONIC_BAR0_INTR_STATUS_OFFSET]; - idev->intr_ctrl = (struct ionic_intr *) - &bar0_base[IONIC_BAR0_INTR_CTRL_OFFSET]; - - sig = ioread32(&idev->dev_info->signature); - if (sig != IONIC_DEV_INFO_SIGNATURE) { - IONIC_PRINT(ERR, "Incompatible firmware signature %" PRIx32 "", - sig); - return -EFAULT; - } - - for (i = 0; i < IONIC_DEVINFO_FWVERS_BUFLEN; i++) - adapter->fw_version[i] = - ioread8(&idev->dev_info->fw_version[i]); - adapter->fw_version[IONIC_DEVINFO_FWVERS_BUFLEN - 1] = '\0'; - - adapter->name = adapter->pci_dev->device.name; - - IONIC_PRINT(DEBUG, "%s firmware version: %s", - adapter->name, adapter->fw_version); - - /* BAR1: doorbells */ - bar++; - if (num_bars < 2) { - IONIC_PRINT(ERR, "Doorbell bar missing, aborting"); - return -EFAULT; - } - - idev->db_pages = bar->vaddr; - - return 0; -} - /* Devcmd Interface */ uint8_t diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 600d8f4abd..3b8e9fc3c2 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -173,14 +173,23 @@ struct ionic_cq { struct ionic_lif; struct ionic_adapter; struct ionic_qcq; +struct rte_mempool; +struct rte_eth_dev; + +struct ionic_dev_intf { + int (*setup)(struct ionic_adapter *adapter); + void (*copy_bus_info)(struct ionic_adapter *adapter, + struct rte_eth_dev *eth_dev); + int (*configure_intr)(struct ionic_adapter *adapter); + void (*unconfigure_intr)(struct ionic_adapter *adapter); + void (*unmap_bars)(struct ionic_adapter *adapter); +}; void ionic_intr_init(struct ionic_dev *idev, struct ionic_intr_info *intr, unsigned long index); const char *ionic_opcode_to_str(enum ionic_cmd_opcode opcode); -int ionic_dev_setup(struct ionic_adapter *adapter); - void ionic_dev_cmd_go(struct ionic_dev *idev, union ionic_dev_cmd *cmd); uint8_t ionic_dev_cmd_status(struct ionic_dev *idev); bool ionic_dev_cmd_done(struct ionic_dev *idev); diff --git a/drivers/net/ionic/ionic_dev_pci.c b/drivers/net/ionic/ionic_dev_pci.c new file mode 100644 index 0000000000..1735fa9b17 --- /dev/null +++ b/drivers/net/ionic/ionic_dev_pci.c @@ -0,0 +1,216 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved. + */ + +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdint.h> + +#include <rte_common.h> +#include <rte_interrupts.h> +#include <rte_log.h> +#include <rte_pci.h> +#include <bus_pci_driver.h> +#include <rte_eal.h> +#include <ethdev_pci.h> +#include <rte_dev.h> + +#include "ionic.h" +#include "ionic_if.h" +#include "ionic_dev.h" +#include "ionic_ethdev.h" +#include "ionic_logs.h" + +static const struct rte_pci_id pci_id_ionic_map[] = { + { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_PF) }, + { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_VF) }, + { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_MGMT) }, + { .vendor_id = 0, /* sentinel */ }, +}; + +static int +ionic_pci_setup(struct ionic_adapter *adapter) +{ + struct ionic_dev_bar *bar = adapter->bars.bar; + unsigned int num_bars = adapter->bars.num_bars; + struct ionic_dev *idev = &adapter->idev; + struct rte_pci_device *bus_dev = adapter->bus_dev; + uint32_t sig; + u_char *bar0_base; + unsigned int i; + + /* BAR0: dev_cmd and interrupts */ + if (num_bars < 1) { + IONIC_PRINT(ERR, "No bars found, aborting\n"); + return -EFAULT; + } + + if (bar->len < IONIC_BAR0_SIZE) { + IONIC_PRINT(ERR, + "Resource bar size %lu too small, aborting\n", + bar->len); + return -EFAULT; + } + + bar0_base = bar->vaddr; + idev->dev_info = (union ionic_dev_info_regs *) + &bar0_base[IONIC_BAR0_DEV_INFO_REGS_OFFSET]; + idev->dev_cmd = (union ionic_dev_cmd_regs *) + &bar0_base[IONIC_BAR0_DEV_CMD_REGS_OFFSET]; + idev->intr_status = (struct ionic_intr_status *) + &bar0_base[IONIC_BAR0_INTR_STATUS_OFFSET]; + idev->intr_ctrl = (struct ionic_intr *) + &bar0_base[IONIC_BAR0_INTR_CTRL_OFFSET]; + + sig = ioread32(&idev->dev_info->signature); + if (sig != IONIC_DEV_INFO_SIGNATURE) { + IONIC_PRINT(ERR, "Incompatible firmware signature %#x", + sig); + return -EFAULT; + } + + for (i = 0; i < IONIC_DEVINFO_FWVERS_BUFLEN; i++) + adapter->fw_version[i] = + ioread8(&idev->dev_info->fw_version[i]); + adapter->fw_version[IONIC_DEVINFO_FWVERS_BUFLEN - 1] = '\0'; + + adapter->name = bus_dev->device.name; + + IONIC_PRINT(DEBUG, "%s firmware version: %s", + adapter->name, adapter->fw_version); + + /* BAR1: doorbells */ + bar++; + if (num_bars < 2) { + IONIC_PRINT(ERR, "Doorbell bar missing, aborting\n"); + return -EFAULT; + } + + idev->db_pages = bar->vaddr; + + return 0; +} + +static void +ionic_pci_copy_bus_info(struct ionic_adapter *adapter, + struct rte_eth_dev *eth_dev) +{ + rte_eth_copy_pci_info(eth_dev, adapter->bus_dev); +} + +static int +ionic_pci_configure_intr(struct ionic_adapter *adapter) +{ + struct rte_pci_device *pci_dev = + (struct rte_pci_device *)(adapter->bus_dev); + struct rte_intr_handle *intr_handle = pci_dev->intr_handle; + int err; + + IONIC_PRINT(ERR, "Configuring %u intrs", adapter->nintrs); + + if (rte_intr_efd_enable(intr_handle, adapter->nintrs)) { + IONIC_PRINT(ERR, "Fail to create eventfd"); + return -1; + } + + if (rte_intr_dp_is_en(intr_handle)) { + IONIC_PRINT(NOTICE, + "Packet I/O interrupt on datapath is enabled"); + if (rte_intr_vec_list_alloc(intr_handle, "intr_vec", + adapter->nintrs)) { + IONIC_PRINT(ERR, "Failed to allocate %u vectors", + adapter->nintrs); + return -ENOMEM; + } + } + + err = rte_intr_callback_register(intr_handle, + ionic_dev_interrupt_handler, + adapter); + if (err) { + IONIC_PRINT(ERR, + "Failure registering interrupts handler (%d)", err); + return err; + } + + /* enable intr mapping */ + err = rte_intr_enable(intr_handle); + if (err) { + IONIC_PRINT(ERR, "Failure enabling interrupts (%d)", err); + return err; + } + + return 0; +} + +static void +ionic_pci_unconfigure_intr(struct ionic_adapter *adapter) +{ + struct rte_pci_device *pci_dev = + (struct rte_pci_device *)(adapter->bus_dev); + struct rte_intr_handle *intr_handle = pci_dev->intr_handle; + + rte_intr_disable(intr_handle); + + rte_intr_callback_unregister(intr_handle, + ionic_dev_interrupt_handler, + adapter); +} + +static const struct ionic_dev_intf ionic_pci_intf = { + .setup = ionic_pci_setup, + .copy_bus_info = ionic_pci_copy_bus_info, + .configure_intr = ionic_pci_configure_intr, + .unconfigure_intr = ionic_pci_unconfigure_intr, +}; + +static int +eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, + struct rte_pci_device *pci_dev) +{ + struct rte_mem_resource *resource; + struct ionic_bars bars; + unsigned long i; + + IONIC_PRINT(NOTICE, "Initializing device %s %s", + pci_dev->device.name, + rte_eal_process_type() == RTE_PROC_SECONDARY ? + "[SECONDARY]" : ""); + + bars.num_bars = 0; + for (i = 0; i < PCI_MAX_RESOURCE && i < IONIC_BARS_MAX; i++) { + resource = &pci_dev->mem_resource[i]; + if (resource->phys_addr == 0 || resource->len == 0) + continue; + + bars.bar[bars.num_bars].vaddr = resource->addr; + bars.bar[bars.num_bars].bus_addr = resource->phys_addr; + bars.bar[bars.num_bars].len = resource->len; + bars.num_bars++; + } + + return eth_ionic_dev_probe((void *)pci_dev, + &pci_dev->device, + &bars, + &ionic_pci_intf, + pci_dev->id.device_id, + pci_dev->id.vendor_id); +} + +static int +eth_ionic_pci_remove(struct rte_pci_device *pci_dev) +{ + return eth_ionic_dev_remove(&pci_dev->device); +} + +static struct rte_pci_driver rte_pci_ionic_pmd = { + .id_table = pci_id_ionic_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, + .probe = eth_ionic_pci_probe, + .remove = eth_ionic_pci_remove, +}; + +RTE_PMD_REGISTER_PCI(net_ionic_pci, rte_pci_ionic_pmd); +RTE_PMD_REGISTER_PCI_TABLE(net_ionic_pci, pci_id_ionic_map); +RTE_PMD_REGISTER_KMOD_DEP(net_ionic_pci, "* igb_uio | uio_pci_generic | vfio-pci"); diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index efea691b8f..186cde8330 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -2,12 +2,9 @@ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved. */ -#include <rte_pci.h> -#include <bus_pci_driver.h> #include <rte_ethdev.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <ethdev_pci.h> #include "ionic_logs.h" #include "ionic.h" @@ -57,13 +54,6 @@ static int ionic_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, static int ionic_dev_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, size_t fw_size); -static const struct rte_pci_id pci_id_ionic_map[] = { - { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_PF) }, - { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_VF) }, - { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_MGMT) }, - { .vendor_id = 0, /* sentinel */ }, -}; - static const struct rte_eth_desc_lim rx_desc_lim = { .nb_max = IONIC_MAX_RING_DESC, .nb_min = IONIC_MIN_RING_DESC, @@ -328,7 +318,7 @@ ionic_dev_link_update(struct rte_eth_dev *eth_dev, * @return * void */ -static void +void ionic_dev_interrupt_handler(void *param) { struct ionic_adapter *adapter = (struct ionic_adapter *)param; @@ -946,8 +936,6 @@ ionic_dev_stop(struct rte_eth_dev *eth_dev) return 0; } -static void ionic_unconfigure_intr(struct ionic_adapter *adapter); - /* * Reset and stop device. */ @@ -966,22 +954,24 @@ ionic_dev_close(struct rte_eth_dev *eth_dev) ionic_lif_free_queues(lif); IONIC_PRINT(NOTICE, "Removing device %s", eth_dev->device->name); - ionic_unconfigure_intr(adapter); + if (adapter->intf->unconfigure_intr) + (*adapter->intf->unconfigure_intr)(adapter); rte_eth_dev_destroy(eth_dev, eth_ionic_dev_uninit); ionic_port_reset(adapter); ionic_reset(adapter); + if (adapter->intf->unmap_bars) + (*adapter->intf->unmap_bars)(adapter); rte_free(adapter); return 0; } -static int +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; @@ -997,7 +987,8 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - rte_eth_copy_pci_info(eth_dev, pci_dev); + if (adapter->intf->copy_bus_info) + (*adapter->intf->copy_bus_info)(adapter, eth_dev); eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; lif->eth_dev = eth_dev; @@ -1068,73 +1059,12 @@ eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev) return 0; } -static int -ionic_configure_intr(struct ionic_adapter *adapter) -{ - struct rte_pci_device *pci_dev = adapter->pci_dev; - struct rte_intr_handle *intr_handle = pci_dev->intr_handle; - int err; - - IONIC_PRINT(DEBUG, "Configuring %u intrs", adapter->nintrs); - - if (rte_intr_efd_enable(intr_handle, adapter->nintrs)) { - IONIC_PRINT(ERR, "Fail to create eventfd"); - return -1; - } - - if (rte_intr_dp_is_en(intr_handle)) { - IONIC_PRINT(DEBUG, - "Packet I/O interrupt on datapath is enabled"); - - if (rte_intr_vec_list_alloc(intr_handle, "intr_vec", - adapter->nintrs)) { - IONIC_PRINT(ERR, "Failed to allocate %u vectors", - adapter->nintrs); - return -ENOMEM; - } - } - - err = rte_intr_callback_register(intr_handle, - ionic_dev_interrupt_handler, - adapter); - - if (err) { - IONIC_PRINT(ERR, - "Failure registering interrupts handler (%d)", - err); - return err; - } - - /* enable intr mapping */ - err = rte_intr_enable(intr_handle); - - if (err) { - IONIC_PRINT(ERR, "Failure enabling interrupts (%d)", err); - return err; - } - - return 0; -} - -static void -ionic_unconfigure_intr(struct ionic_adapter *adapter) -{ - struct rte_pci_device *pci_dev = adapter->pci_dev; - struct rte_intr_handle *intr_handle = pci_dev->intr_handle; - - rte_intr_disable(intr_handle); - - rte_intr_callback_unregister(intr_handle, - ionic_dev_interrupt_handler, - adapter); -} - -static int -eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, - struct rte_pci_device *pci_dev) +int +eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev, + struct ionic_bars *bars, const struct ionic_dev_intf *intf, + uint16_t device_id, uint16_t vendor_id) { char name[RTE_ETH_NAME_MAX_LEN]; - struct rte_mem_resource *resource; struct ionic_adapter *adapter; struct ionic_hw *hw; unsigned long i; @@ -1149,9 +1079,6 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, goto err; } - IONIC_PRINT(DEBUG, "Initializing device %s", - pci_dev->device.name); - adapter = rte_zmalloc("ionic", sizeof(*adapter), 0); if (!adapter) { IONIC_PRINT(ERR, "OOM"); @@ -1159,11 +1086,12 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, goto err; } - adapter->pci_dev = pci_dev; + adapter->bus_dev = bus_dev; hw = &adapter->hw; - hw->device_id = pci_dev->id.device_id; - hw->vendor_id = pci_dev->id.vendor_id; + /* Vendor and Device ID need to be set before init of shared code */ + hw->device_id = device_id; + hw->vendor_id = vendor_id; err = ionic_init_mac(hw); if (err != 0) { @@ -1172,19 +1100,21 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, goto err_free_adapter; } - adapter->num_bars = 0; - for (i = 0; i < PCI_MAX_RESOURCE && i < IONIC_BARS_MAX; i++) { - resource = &pci_dev->mem_resource[i]; - if (resource->phys_addr == 0 || resource->len == 0) - continue; - adapter->bars[adapter->num_bars].vaddr = resource->addr; - adapter->bars[adapter->num_bars].bus_addr = resource->phys_addr; - adapter->bars[adapter->num_bars].len = resource->len; - adapter->num_bars++; + adapter->bars.num_bars = bars->num_bars; + for (i = 0; i < bars->num_bars; i++) { + adapter->bars.bar[i].vaddr = bars->bar[i].vaddr; + adapter->bars.bar[i].bus_addr = bars->bar[i].bus_addr; + adapter->bars.bar[i].len = bars->bar[i].len; } - /* Discover ionic dev resources */ + if (intf->setup == NULL) { + IONIC_PRINT(ERR, "Device setup function is mandatory"); + goto err_free_adapter; + } + + adapter->intf = intf; + /* Discover ionic dev resources */ err = ionic_setup(adapter); if (err) { IONIC_PRINT(ERR, "Cannot setup device: %d, aborting", err); @@ -1241,20 +1171,20 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, goto err_free_adapter; } - snprintf(name, sizeof(name), "%s_lif", pci_dev->device.name); - err = rte_eth_dev_create(&pci_dev->device, - name, sizeof(struct ionic_lif), + snprintf(name, sizeof(name), "%s_lif", rte_dev->name); + err = rte_eth_dev_create(rte_dev, name, sizeof(struct ionic_lif), NULL, NULL, eth_ionic_dev_init, adapter); if (err) { IONIC_PRINT(ERR, "Cannot create eth device for %s", name); goto err_free_adapter; } - err = ionic_configure_intr(adapter); - - if (err) { - IONIC_PRINT(ERR, "Failed to configure interrupts"); - goto err_free_adapter; + if (adapter->intf->configure_intr) { + err = (*adapter->intf->configure_intr)(adapter); + if (err) { + IONIC_PRINT(ERR, "Failed to configure interrupts"); + goto err_free_adapter; + } } return 0; @@ -1265,33 +1195,22 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, return err; } -static int -eth_ionic_pci_remove(struct rte_pci_device *pci_dev) +int +eth_ionic_dev_remove(struct rte_device *rte_dev) { char name[RTE_ETH_NAME_MAX_LEN]; struct rte_eth_dev *eth_dev; /* Adapter lookup is using the eth_dev name */ - snprintf(name, sizeof(name), "%s_lif", pci_dev->device.name); + snprintf(name, sizeof(name), "%s_lif", rte_dev->name); eth_dev = rte_eth_dev_allocated(name); if (eth_dev) ionic_dev_close(eth_dev); else - IONIC_PRINT(DEBUG, "Cannot find device %s", - pci_dev->device.name); + IONIC_PRINT(DEBUG, "Cannot find device %s", rte_dev->name); return 0; } -static struct rte_pci_driver rte_ionic_pmd = { - .id_table = pci_id_ionic_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, - .probe = eth_ionic_pci_probe, - .remove = eth_ionic_pci_remove, -}; - -RTE_PMD_REGISTER_PCI(net_ionic, rte_ionic_pmd); -RTE_PMD_REGISTER_PCI_TABLE(net_ionic, pci_id_ionic_map); -RTE_PMD_REGISTER_KMOD_DEP(net_ionic, "* igb_uio | uio_pci_generic | vfio-pci"); RTE_LOG_REGISTER_DEFAULT(ionic_logtype, NOTICE); diff --git a/drivers/net/ionic/ionic_ethdev.h b/drivers/net/ionic/ionic_ethdev.h index f4a4276d33..c5726408de 100644 --- a/drivers/net/ionic/ionic_ethdev.h +++ b/drivers/net/ionic/ionic_ethdev.h @@ -18,6 +18,15 @@ #define IONIC_ETH_DEV_TO_LIF(eth_dev) ((struct ionic_lif *) \ (eth_dev)->data->dev_private) +struct ionic_bars; +struct ionic_dev_intf; + +int eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev, + struct ionic_bars *bars, const struct ionic_dev_intf *intf, + uint16_t device_id, uint16_t vendor_id); +int eth_ionic_dev_remove(struct rte_device *rte_dev); + +void ionic_dev_interrupt_handler(void *param); int ionic_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete); #endif /* _IONIC_ETHDEV_H_ */ diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index b42430713c..996af0a51f 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -336,7 +336,7 @@ ionic_dev_cmd_wait_check(struct ionic_dev *idev, unsigned long max_wait) int ionic_setup(struct ionic_adapter *adapter) { - return ionic_dev_setup(adapter); + return (*adapter->intf->setup)(adapter); } int diff --git a/drivers/net/ionic/meson.build b/drivers/net/ionic/meson.build index e251e7cbe0..2869e0027c 100644 --- a/drivers/net/ionic/meson.build +++ b/drivers/net/ionic/meson.build @@ -9,6 +9,7 @@ endif sources = files( 'ionic_dev.c', + 'ionic_dev_pci.c', 'ionic_ethdev.c', 'ionic_lif.c', 'ionic_mac_api.c', -- 2.17.1