summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
80d8c6a)
The test PMD uses a special type of eth_dev_ops to test features.
Rather allocating this separately, just put in the private data area.
This allows for next change to make dev_ops const.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
static const char *virtual_ethdev_driver_name = "Virtual PMD";
struct virtual_ethdev_private {
static const char *virtual_ethdev_driver_name = "Virtual PMD";
struct virtual_ethdev_private {
+ struct eth_dev_ops dev_ops;
struct rte_eth_stats eth_stats;
struct rte_ring *rx_queue;
struct rte_eth_stats eth_stats;
struct rte_ring *rx_queue;
void
virtual_ethdev_start_fn_set_success(uint8_t port_id, uint8_t success)
{
void
virtual_ethdev_start_fn_set_success(uint8_t port_id, uint8_t success)
{
- struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id];
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ struct virtual_ethdev_private *dev_private = dev->data->dev_private;
+ struct eth_dev_ops *dev_ops = &dev_private->dev_ops;
- vrtl_eth_dev->dev_ops->dev_start = virtual_ethdev_start_success;
+ dev_ops->dev_start = virtual_ethdev_start_success;
- vrtl_eth_dev->dev_ops->dev_start = virtual_ethdev_start_fail;
+ dev_ops->dev_start = virtual_ethdev_start_fail;
}
void
virtual_ethdev_configure_fn_set_success(uint8_t port_id, uint8_t success)
{
}
void
virtual_ethdev_configure_fn_set_success(uint8_t port_id, uint8_t success)
{
- struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id];
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ struct virtual_ethdev_private *dev_private = dev->data->dev_private;
+ struct eth_dev_ops *dev_ops = &dev_private->dev_ops;
- vrtl_eth_dev->dev_ops->dev_configure = virtual_ethdev_configure_success;
+ dev_ops->dev_configure = virtual_ethdev_configure_success;
- vrtl_eth_dev->dev_ops->dev_configure = virtual_ethdev_configure_fail;
+ dev_ops->dev_configure = virtual_ethdev_configure_fail;
}
void
virtual_ethdev_rx_queue_setup_fn_set_success(uint8_t port_id, uint8_t success)
{
}
void
virtual_ethdev_rx_queue_setup_fn_set_success(uint8_t port_id, uint8_t success)
{
- struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id];
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ struct virtual_ethdev_private *dev_private = dev->data->dev_private;
+ struct eth_dev_ops *dev_ops = &dev_private->dev_ops;
- vrtl_eth_dev->dev_ops->rx_queue_setup =
- virtual_ethdev_rx_queue_setup_success;
+ dev_ops->rx_queue_setup = virtual_ethdev_rx_queue_setup_success;
- vrtl_eth_dev->dev_ops->rx_queue_setup =
- virtual_ethdev_rx_queue_setup_fail;
+ dev_ops->rx_queue_setup = virtual_ethdev_rx_queue_setup_fail;
}
void
virtual_ethdev_tx_queue_setup_fn_set_success(uint8_t port_id, uint8_t success)
{
}
void
virtual_ethdev_tx_queue_setup_fn_set_success(uint8_t port_id, uint8_t success)
{
- struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id];
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ struct virtual_ethdev_private *dev_private = dev->data->dev_private;
+ struct eth_dev_ops *dev_ops = &dev_private->dev_ops;
- vrtl_eth_dev->dev_ops->tx_queue_setup =
- virtual_ethdev_tx_queue_setup_success;
+ dev_ops->tx_queue_setup = virtual_ethdev_tx_queue_setup_success;
- vrtl_eth_dev->dev_ops->tx_queue_setup =
- virtual_ethdev_tx_queue_setup_fail;
+ dev_ops->tx_queue_setup = virtual_ethdev_tx_queue_setup_fail;
}
void
virtual_ethdev_link_update_fn_set_success(uint8_t port_id, uint8_t success)
{
}
void
virtual_ethdev_link_update_fn_set_success(uint8_t port_id, uint8_t success)
{
- struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id];
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ struct virtual_ethdev_private *dev_private = dev->data->dev_private;
+ struct eth_dev_ops *dev_ops = &dev_private->dev_ops;
- vrtl_eth_dev->dev_ops->link_update = virtual_ethdev_link_update_success;
+ dev_ops->link_update = virtual_ethdev_link_update_success;
- vrtl_eth_dev->dev_ops->link_update = virtual_ethdev_link_update_fail;
+ dev_ops->link_update = virtual_ethdev_link_update_fail;
struct rte_eth_dev *eth_dev = NULL;
struct eth_driver *eth_drv = NULL;
struct rte_pci_driver *pci_drv = NULL;
struct rte_eth_dev *eth_dev = NULL;
struct eth_driver *eth_drv = NULL;
struct rte_pci_driver *pci_drv = NULL;
- struct eth_dev_ops *dev_ops = NULL;
struct rte_pci_id *id_table = NULL;
struct virtual_ethdev_private *dev_private = NULL;
char name_buf[RTE_RING_NAMESIZE];
struct rte_pci_id *id_table = NULL;
struct virtual_ethdev_private *dev_private = NULL;
char name_buf[RTE_RING_NAMESIZE];
if (pci_drv == NULL)
goto err;
if (pci_drv == NULL)
goto err;
- dev_ops = rte_zmalloc_socket(name, sizeof(*dev_ops), 0, socket_id);
- if (dev_ops == NULL)
- goto err;
-
id_table = rte_zmalloc_socket(name, sizeof(*id_table), 0, socket_id);
if (id_table == NULL)
goto err;
id_table = rte_zmalloc_socket(name, sizeof(*id_table), 0, socket_id);
if (id_table == NULL)
goto err;
eth_dev->data->dev_private = dev_private;
eth_dev->data->dev_private = dev_private;
- eth_dev->dev_ops = dev_ops;
-
/* Copy default device operation functions */
/* Copy default device operation functions */
- memcpy(eth_dev->dev_ops, &virtual_ethdev_default_dev_ops,
- sizeof(*eth_dev->dev_ops));
+ dev_private->dev_ops = virtual_ethdev_default_dev_ops;
+ eth_dev->dev_ops = &dev_private->dev_ops;
eth_dev->pci_dev = pci_dev;
eth_dev->pci_dev->driver = ð_drv->pci_drv;
eth_dev->pci_dev = pci_dev;
eth_dev->pci_dev->driver = ð_drv->pci_drv;
rte_free(pci_dev);
rte_free(pci_drv);
rte_free(eth_drv);
rte_free(pci_dev);
rte_free(pci_drv);
rte_free(eth_drv);
rte_free(id_table);
rte_free(dev_private);
rte_free(id_table);
rte_free(dev_private);