This patch allows us to take an ethdev port id and get from it a generic pktdev object that we can call using the pktdev routines, if we like. Change the actual rx/tx calls in the ethdev api to call the pktdev versions - which becuase of inlining will work the same as before, with no impact. --- lib/librte_ether/rte_ethdev.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 21aa359..4986d6b 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -178,6 +178,7 @@ extern "C" { #include <rte_dev.h> #include <rte_devargs.h> #include <rte_mbuf.h> +#include <rte_pktdev.h> #include "rte_ether.h" #include "rte_eth_ctrl.h" @@ -1446,9 +1447,7 @@ enum rte_eth_dev_type { * process, while the actual configuration data for the device is shared. */ struct rte_eth_dev { - eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function. */ - eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */ - struct rte_eth_dev_data *data; /**< Pointer to device data */ + RTE_PKT_DEV_HDR(rte_eth_dev); const struct eth_driver *driver;/**< Driver for this device */ const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */ struct rte_pci_device *pci_dev; /**< PCI info. supplied by probing */ @@ -1486,13 +1485,7 @@ struct rte_eth_dev_sriov { * processes in a multi-process configuration. */ struct rte_eth_dev_data { - char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */ - - void **rx_queues; /**< Array of pointers to RX queues. */ - void **tx_queues; /**< Array of pointers to TX queues. */ - uint16_t nb_rx_queues; /**< Number of RX queues. */ - uint16_t nb_tx_queues; /**< Number of TX queues. */ - + RTE_PKT_DEV_DATA_HDR; struct rte_eth_dev_sriov sriov; /**< SRIOV data */ void *dev_private; /**< PMD-specific private data */ @@ -2298,6 +2291,12 @@ extern int rte_eth_dev_get_vlan_offload(uint8_t port_id); */ extern int rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on); +static inline struct rte_pkt_dev * +rte_eth_get_dev(uint8_t port_id) +{ + return (void *)&rte_eth_devices[port_id]; +} + /** * * Retrieve a burst of input packets from a receive queue of an Ethernet @@ -2392,8 +2391,8 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id, dev = &rte_eth_devices[port_id]; - int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id], - rx_pkts, nb_pkts); + int16_t nb_rx = rte_pkt_rx_burst(rte_eth_get_dev(port_id), queue_id, + rx_pkts, nb_pkts); #ifdef RTE_ETHDEV_RXTX_CALLBACKS struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id]; @@ -2547,7 +2546,8 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id, } #endif - return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, nb_pkts); + return rte_pkt_tx_burst(rte_eth_get_dev(port_id), queue_id, + tx_pkts, nb_pkts); } #endif -- 2.1.0