From 9dca21fb80b6c43e58d83c794e161ddc671c07ba Mon Sep 17 00:00:00 2001 From: Jan Blunck Date: Tue, 11 Apr 2017 17:44:46 +0200 Subject: [PATCH] ethdev: remove ethdev driver This removes the now unused struct eth_driver. Signed-off-by: Jan Blunck Acked-by: Stephen Hemminger --- drivers/net/cxgbe/cxgbe_main.c | 1 - drivers/net/ring/rte_eth_ring.c | 1 - lib/librte_ether/rte_ethdev.h | 73 ------------------------------ lib/librte_ether/rte_ethdev_pci.h | 2 - lib/librte_ether/rte_ethdev_vdev.h | 1 - test/test/virtual_pmd.c | 12 ++--- 6 files changed, 3 insertions(+), 87 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index 541fc40eb2..f895b187da 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -1165,7 +1165,6 @@ int cxgbe_probe(struct adapter *adapter) allocate_mac: pi->eth_dev->device = &adapter->pdev->device; pi->eth_dev->data->dev_private = pi; - pi->eth_dev->driver = adapter->eth_dev->driver; pi->eth_dev->dev_ops = adapter->eth_dev->dev_ops; pi->eth_dev->tx_pkt_burst = adapter->eth_dev->tx_pkt_burst; pi->eth_dev->rx_pkt_burst = adapter->eth_dev->rx_pkt_burst; diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index 4bae89570d..36867e6751 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -338,7 +338,6 @@ do_eth_dev_ring_create(const char *name, data->mac_addrs = &internals->address; eth_dev->data = data; - eth_dev->driver = NULL; eth_dev->dev_ops = &ops; data->dev_flags = RTE_ETH_DEV_DETACHABLE; data->kdrv = RTE_KDRV_NONE; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index e2eec815e0..6da5b27bfd 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1651,7 +1651,6 @@ struct rte_eth_dev { eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */ eth_tx_prep_t tx_pkt_prepare; /**< Pointer to PMD transmit prepare function. */ struct rte_eth_dev_data *data; /**< Pointer to device data */ - const struct eth_driver *driver;/**< Driver for this device */ const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */ struct rte_device *device; /**< Backing device */ struct rte_intr_handle *intr_handle; /**< Device interrupt handle */ @@ -1854,78 +1853,6 @@ int rte_eth_dev_attach(const char *devargs, uint8_t *port_id); */ int rte_eth_dev_detach(uint8_t port_id, char *devname); -struct eth_driver; -/** - * @internal - * Initialization function of an Ethernet driver invoked for each matching - * Ethernet PCI device detected during the PCI probing phase. - * - * @param eth_dev - * The *eth_dev* pointer is the address of the *rte_eth_dev* structure - * associated with the matching device and which have been [automatically] - * allocated in the *rte_eth_devices* array. - * The *eth_dev* structure is supplied to the driver initialization function - * with the following fields already initialized: - * - * - *pci_dev*: Holds the pointers to the *rte_pci_device* structure which - * contains the generic PCI information of the matching device. - * - * - *driver*: Holds the pointer to the *eth_driver* structure. - * - * - *dev_private*: Holds a pointer to the device private data structure. - * - * - *mtu*: Contains the default Ethernet maximum frame length (1500). - * - * - *port_id*: Contains the port index of the device (actually the index - * of the *eth_dev* structure in the *rte_eth_devices* array). - * - * @return - * - 0: Success, the device is properly initialized by the driver. - * In particular, the driver MUST have set up the *dev_ops* pointer - * of the *eth_dev* structure. - * - <0: Error code of the device initialization failure. - */ -typedef int (*eth_dev_init_t)(struct rte_eth_dev *eth_dev); - -/** - * @internal - * Finalization function of an Ethernet driver invoked for each matching - * Ethernet PCI device detected during the PCI closing phase. - * - * @param eth_dev - * The *eth_dev* pointer is the address of the *rte_eth_dev* structure - * associated with the matching device and which have been [automatically] - * allocated in the *rte_eth_devices* array. - * @return - * - 0: Success, the device is properly finalized by the driver. - * In particular, the driver MUST free the *dev_ops* pointer - * of the *eth_dev* structure. - * - <0: Error code of the device initialization failure. - */ -typedef int (*eth_dev_uninit_t)(struct rte_eth_dev *eth_dev); - -/** - * @internal - * The structure associated with a PMD Ethernet driver. - * - * Each Ethernet driver acts as a PCI driver and is represented by a generic - * *eth_driver* structure that holds: - * - * - An *rte_pci_driver* structure (which must be the first field). - * - * - The *eth_dev_init* function invoked for each matching PCI device. - * - * - The *eth_dev_uninit* function invoked for each matching PCI device. - * - * - The size of the private data to allocate for each matching device. - */ -struct eth_driver { - struct rte_pci_driver pci_drv; /**< The PMD is also a PCI driver. */ - eth_dev_init_t eth_dev_init; /**< Device init function. */ - eth_dev_uninit_t eth_dev_uninit; /**< Device uninit function. */ - unsigned int dev_private_size; /**< Size of device private data. */ -}; - /** * Convert a numerical speed in Mbps to a bitmap flag that can be used in * the bitmap link_speeds of the struct rte_eth_conf diff --git a/lib/librte_ether/rte_ethdev_pci.h b/lib/librte_ether/rte_ethdev_pci.h index fe62589444..f85d26f017 100644 --- a/lib/librte_ether/rte_ethdev_pci.h +++ b/lib/librte_ether/rte_ethdev_pci.h @@ -84,7 +84,6 @@ rte_eth_dev_pci_allocate(struct rte_pci_device *dev, size_t private_data_size) } eth_dev->device = &dev->device; - eth_dev->driver = NULL; eth_dev->intr_handle = &dev->intr_handle; rte_eth_copy_pci_info(eth_dev, dev); return eth_dev; @@ -102,7 +101,6 @@ rte_eth_dev_pci_release(struct rte_eth_dev *eth_dev) eth_dev->data->dev_private = NULL; eth_dev->device = NULL; - eth_dev->driver = NULL; eth_dev->intr_handle = NULL; } diff --git a/lib/librte_ether/rte_ethdev_vdev.h b/lib/librte_ether/rte_ethdev_vdev.h index 0b475357a3..fa2cb61e1c 100644 --- a/lib/librte_ether/rte_ethdev_vdev.h +++ b/lib/librte_ether/rte_ethdev_vdev.h @@ -73,7 +73,6 @@ rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size) } eth_dev->device = &dev->device; - eth_dev->driver = NULL; eth_dev->intr_handle = NULL; eth_dev->data->kdrv = RTE_KDRV_NONE; diff --git a/test/test/virtual_pmd.c b/test/test/virtual_pmd.c index b8802cd6ae..e9dd8ac30c 100644 --- a/test/test/virtual_pmd.c +++ b/test/test/virtual_pmd.c @@ -532,7 +532,6 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, { struct rte_pci_device *pci_dev = NULL; struct rte_eth_dev *eth_dev = NULL; - struct eth_driver *eth_drv = NULL; struct rte_pci_driver *pci_drv = NULL; struct rte_pci_id *id_table = NULL; struct virtual_ethdev_private *dev_private = NULL; @@ -550,10 +549,6 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, if (pci_dev == NULL) goto err; - eth_drv = rte_zmalloc_socket(name, sizeof(*eth_drv), 0, socket_id); - if (eth_drv == NULL) - goto err; - pci_drv = rte_zmalloc_socket(name, sizeof(*pci_drv), 0, socket_id); if (pci_drv == NULL) goto err; @@ -594,8 +589,8 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, pci_drv->drv_flags &= ~RTE_PCI_DRV_INTR_LSC; - eth_drv->pci_drv = (struct rte_pci_driver)(*pci_drv); - eth_dev->driver = eth_drv; + eth_dev->device = &pci_dev->device; + eth_dev->device->driver = &pci_drv->driver; eth_dev->data->nb_rx_queues = (uint16_t)1; eth_dev->data->nb_tx_queues = (uint16_t)1; @@ -622,7 +617,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, dev_private->dev_ops = virtual_ethdev_default_dev_ops; eth_dev->dev_ops = &dev_private->dev_ops; - pci_dev->device.driver = ð_drv->pci_drv.driver; + pci_dev->device.driver = &pci_drv->driver; eth_dev->device = &pci_dev->device; eth_dev->rx_pkt_burst = virtual_ethdev_rx_burst_success; @@ -633,7 +628,6 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, err: rte_free(pci_dev); rte_free(pci_drv); - rte_free(eth_drv); rte_free(id_table); rte_free(dev_private); -- 2.20.1