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 */
*/
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
{
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;
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;
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;
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;
err:
rte_free(pci_dev);
rte_free(pci_drv);
- rte_free(eth_drv);
rte_free(id_table);
rte_free(dev_private);