From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org, keith.wiles@intel.com
Subject: [dpdk-dev] [RFC PATCH 2/4] Make ethdev explicitly a subclass of pktdev
Date: Fri, 17 Apr 2015 16:16:42 +0100 [thread overview]
Message-ID: <1429283804-28087-3-git-send-email-bruce.richardson@intel.com> (raw)
In-Reply-To: <1429283804-28087-1-git-send-email-bruce.richardson@intel.com>
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
next prev parent reply other threads:[~2015-04-17 15:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-13 19:44 [dpdk-dev] [RFC PATCH 0/4 v2] Extending DPDK with multiple device support Keith Wiles
2015-04-13 19:44 ` [dpdk-dev] [RFC PATCH 1/4 v2] Adding the common device files for " Keith Wiles
2015-05-04 13:13 ` Marc Sune
2015-05-04 14:44 ` Wiles, Keith
2015-04-13 19:44 ` [dpdk-dev] [RFC PATCH 2/4 v2] Add the ethdev changes " Keith Wiles
2015-04-13 19:44 ` [dpdk-dev] [RFC PATCH 3/4 v2] Add the test file changes for common " Keith Wiles
2015-04-13 19:44 ` [dpdk-dev] [RFC PATCH 4/4 v2] Update PMD files for new " Keith Wiles
2015-04-17 15:16 ` [dpdk-dev] [RFC PATCH 0/4] pktdev Bruce Richardson
2015-04-17 15:16 ` [dpdk-dev] [RFC PATCH 1/4] Add example pktdev implementation Bruce Richardson
2015-04-20 11:26 ` Ananyev, Konstantin
2015-04-20 15:02 ` Bruce Richardson
2015-04-21 8:40 ` Ananyev, Konstantin
2015-04-21 9:23 ` Bruce Richardson
2015-04-17 15:16 ` Bruce Richardson [this message]
2015-04-17 15:16 ` [dpdk-dev] [RFC PATCH 3/4] add support for a ring to be a pktdev Bruce Richardson
2015-04-17 17:31 ` Neil Horman
2015-04-18 0:00 ` Ouyang, Changchun
2015-04-20 10:32 ` Ananyev, Konstantin
2015-04-17 15:16 ` [dpdk-dev] [RFC PATCH 4/4] example app showing pktdevs used in a chain Bruce Richardson
2015-04-17 17:28 ` [dpdk-dev] [RFC PATCH 0/4] pktdev Neil Horman
2015-04-17 18:49 ` Marc Sune
2015-04-17 19:50 ` Wiles, Keith
2015-04-20 6:51 ` Marc Sune
2015-04-20 10:43 ` Bruce Richardson
2015-04-20 17:03 ` Marc Sune
2015-04-20 13:19 ` Wiles, Keith
2015-04-20 13:30 ` Wiles, Keith
2015-05-04 13:13 ` [dpdk-dev] [RFC PATCH 0/4 v2] Extending DPDK with multiple device support Marc Sune
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429283804-28087-3-git-send-email-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=keith.wiles@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).