From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Cc: "Nicolás Pernas Maradei" <nicolas.pernas.maradei@emutex.com>
Subject: [dpdk-dev] [PATCH 2/3] ring: remove duplicate fields in internal data struct
Date: Fri, 29 Jan 2016 17:16:21 +0000 [thread overview]
Message-ID: <1454087782-15085-3-git-send-email-ferruh.yigit@intel.com> (raw)
In-Reply-To: <1454087782-15085-1-git-send-email-ferruh.yigit@intel.com>
1- Remove duplicate nb_rx/tx_queues fields from internals
2- Remove data->rx/tx_queues allocation, whose auto allocated by
libether
3- Remove duplicate data->rx/tx_queues[i] assignments
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/ring/rte_eth_ring.c | 52 +++++++++++------------------------------
1 file changed, 14 insertions(+), 38 deletions(-)
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index d92b088..47dd5f2 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -59,9 +59,6 @@ struct ring_queue {
};
struct pmd_internals {
- unsigned nb_rx_queues;
- unsigned nb_tx_queues;
-
struct ring_queue rx_ring_queues[RTE_PMD_RING_MAX_RX_RINGS];
struct ring_queue tx_ring_queues[RTE_PMD_RING_MAX_TX_RINGS];
@@ -138,7 +135,7 @@ eth_dev_set_link_up(struct rte_eth_dev *dev)
}
static int
-eth_rx_queue_setup(struct rte_eth_dev *dev,uint16_t rx_queue_id,
+eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
uint16_t nb_rx_desc __rte_unused,
unsigned int socket_id __rte_unused,
const struct rte_eth_rxconf *rx_conf __rte_unused,
@@ -165,12 +162,11 @@ static void
eth_dev_info(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
- struct pmd_internals *internals = dev->data->dev_private;
dev_info->driver_name = drivername;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
- dev_info->max_rx_queues = (uint16_t)internals->nb_rx_queues;
- dev_info->max_tx_queues = (uint16_t)internals->nb_tx_queues;
+ dev_info->max_rx_queues = dev->data->nb_rx_queues;
+ dev_info->max_tx_queues = dev->data->nb_tx_queues;
dev_info->min_rx_bufsize = 0;
dev_info->pci_dev = NULL;
}
@@ -183,13 +179,13 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats)
const struct pmd_internals *internal = dev->data->dev_private;
for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS &&
- i < internal->nb_rx_queues; i++) {
+ i < dev->data->nb_rx_queues; i++) {
igb_stats->q_ipackets[i] = internal->rx_ring_queues[i].rx_pkts.cnt;
rx_total += igb_stats->q_ipackets[i];
}
for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS &&
- i < internal->nb_tx_queues; i++) {
+ i < dev->data->nb_tx_queues; i++) {
igb_stats->q_opackets[i] = internal->tx_ring_queues[i].tx_pkts.cnt;
igb_stats->q_errors[i] = internal->tx_ring_queues[i].err_pkts.cnt;
tx_total += igb_stats->q_opackets[i];
@@ -206,9 +202,9 @@ eth_stats_reset(struct rte_eth_dev *dev)
{
unsigned i;
struct pmd_internals *internal = dev->data->dev_private;
- for (i = 0; i < internal->nb_rx_queues; i++)
+ for (i = 0; i < dev->data->nb_rx_queues; i++)
internal->rx_ring_queues[i].rx_pkts.cnt = 0;
- for (i = 0; i < internal->nb_tx_queues; i++) {
+ for (i = 0; i < dev->data->nb_tx_queues; i++) {
internal->tx_ring_queues[i].tx_pkts.cnt = 0;
internal->tx_ring_queues[i].err_pkts.cnt = 0;
}
@@ -262,7 +258,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
struct rte_eth_dev_data *data = NULL;
struct pmd_internals *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
-
unsigned i;
/* do some parameter checking */
@@ -291,20 +286,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
goto error;
}
- data->rx_queues = rte_zmalloc_socket(name, sizeof(void *) * nb_rx_queues,
- 0, numa_node);
- if (data->rx_queues == NULL) {
- rte_errno = ENOMEM;
- goto error;
- }
-
- data->tx_queues = rte_zmalloc_socket(name, sizeof(void *) * nb_tx_queues,
- 0, numa_node);
- if (data->tx_queues == NULL) {
- rte_errno = ENOMEM;
- goto error;
- }
-
internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
if (internals == NULL) {
rte_errno = ENOMEM;
@@ -327,16 +308,11 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
/* NOTE: we'll replace the data element, of originally allocated eth_dev
* so the rings are local per-process */
- internals->nb_rx_queues = nb_rx_queues;
- internals->nb_tx_queues = nb_tx_queues;
- for (i = 0; i < nb_rx_queues; i++) {
+ for (i = 0; i < nb_rx_queues; i++)
internals->rx_ring_queues[i].rng = rx_queues[i];
- data->rx_queues[i] = &internals->rx_ring_queues[i];
- }
- for (i = 0; i < nb_tx_queues; i++) {
+
+ for (i = 0; i < nb_tx_queues; i++)
internals->tx_ring_queues[i].rng = tx_queues[i];
- data->tx_queues[i] = &internals->tx_ring_queues[i];
- }
data->dev_private = internals;
data->port_id = eth_dev->data->port_id;
@@ -349,10 +325,10 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
eth_dev->data = data;
eth_dev->driver = NULL;
eth_dev->dev_ops = &ops;
- eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
- eth_dev->data->kdrv = RTE_KDRV_NONE;
- eth_dev->data->drv_name = drivername;
- eth_dev->data->numa_node = numa_node;
+ data->dev_flags = RTE_ETH_DEV_DETACHABLE;
+ data->kdrv = RTE_KDRV_NONE;
+ data->drv_name = drivername;
+ data->numa_node = numa_node;
TAILQ_INIT(&(eth_dev->link_intr_cbs));
--
2.5.0
next prev parent reply other threads:[~2016-01-29 17:17 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-29 17:16 [dpdk-dev] [PATCH 0/3] clean-up on virtual PMDs Ferruh Yigit
2016-01-29 17:16 ` [dpdk-dev] [PATCH 1/3] pcap: remove duplicate fields in internal data struct Ferruh Yigit
2016-01-29 17:16 ` Ferruh Yigit [this message]
2016-02-17 17:36 ` [dpdk-dev] [PATCH 2/3] ring: " Bruce Richardson
2016-02-18 9:50 ` Ferruh Yigit
2016-01-29 17:16 ` [dpdk-dev] [PATCH 3/3] null: " Ferruh Yigit
2016-02-03 6:21 ` Tetsuya Mukawa
2016-02-18 11:26 ` [dpdk-dev] [PATCH v2 0/3] clean-up on virtual PMDs Ferruh Yigit
2016-02-18 11:26 ` [dpdk-dev] [PATCH v2 1/3] pcap: remove duplicate fields in internal data struct Ferruh Yigit
2016-02-22 9:54 ` Nicolas Pernas Maradei
2016-02-18 11:26 ` [dpdk-dev] [PATCH v2 2/3] ring: " Ferruh Yigit
2016-02-22 9:55 ` Nicolas Pernas Maradei
2016-02-23 15:26 ` Bruce Richardson
2016-02-23 15:58 ` Ferruh Yigit
2016-02-23 16:06 ` Bruce Richardson
2016-02-18 11:26 ` [dpdk-dev] [PATCH v2 3/3] null: " Ferruh Yigit
2016-02-22 9:56 ` Nicolas Pernas Maradei
2016-02-26 15:26 ` [dpdk-dev] [PATCH v3 0/3] clean-up on virtual PMDs Ferruh Yigit
2016-02-26 15:26 ` [dpdk-dev] [PATCH v3 1/3] pcap: remove duplicate fields in internal data struct Ferruh Yigit
2016-02-26 15:26 ` [dpdk-dev] [PATCH v3 2/3] ring: rename " Ferruh Yigit
2016-02-26 16:35 ` Bruce Richardson
2016-02-26 15:26 ` [dpdk-dev] [PATCH v3 3/3] null: remove duplicate " Ferruh Yigit
2016-02-26 16:58 ` [dpdk-dev] [PATCH v4 0/3] clean-up on virtual PMDs Ferruh Yigit
2016-02-26 16:58 ` [dpdk-dev] [PATCH v4 1/3] pcap: remove duplicate fields in internal data struct Ferruh Yigit
2016-02-26 16:58 ` [dpdk-dev] [PATCH v4 2/3] ring: variable rename and code cleanup Ferruh Yigit
2016-03-10 11:11 ` Bruce Richardson
2016-02-26 16:58 ` [dpdk-dev] [PATCH v4 3/3] null: remove duplicate fields in internal data struct Ferruh Yigit
2016-03-10 11:12 ` [dpdk-dev] [PATCH v4 0/3] clean-up on virtual PMDs Bruce Richardson
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=1454087782-15085-3-git-send-email-ferruh.yigit@intel.com \
--to=ferruh.yigit@intel.com \
--cc=dev@dpdk.org \
--cc=nicolas.pernas.maradei@emutex.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).