From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 93B38C35A for ; Fri, 17 Apr 2015 17:16:48 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 17 Apr 2015 08:16:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,595,1422950400"; d="scan'208";a="557715783" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 17 Apr 2015 08:16:46 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t3HFGj4N030420; Fri, 17 Apr 2015 16:16:45 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t3HFGjEf028139; Fri, 17 Apr 2015 16:16:45 +0100 Received: (from bricha3@localhost) by sivswdev01.ir.intel.com with id t3HFGjXf028135; Fri, 17 Apr 2015 16:16:45 +0100 From: Bruce Richardson To: dev@dpdk.org, keith.wiles@intel.com Date: Fri, 17 Apr 2015 16:16:42 +0100 Message-Id: <1429283804-28087-3-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1429283804-28087-1-git-send-email-bruce.richardson@intel.com> References: <1428954274-26944-1-git-send-email-keith.wiles@intel.com> <1429283804-28087-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [RFC PATCH 2/4] Make ethdev explicitly a subclass of pktdev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 15:16:49 -0000 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 #include #include +#include #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