From patchwork Fri Feb 26 15:26:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 10890 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id D64315A36; Fri, 26 Feb 2016 16:27:22 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 8E35F5A36 for ; Fri, 26 Feb 2016 16:27:21 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 26 Feb 2016 07:27:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,498,1449561600"; d="scan'208";a="921789521" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 26 Feb 2016 07:27:19 -0800 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 u1QFRImL023886; Fri, 26 Feb 2016 15:27:18 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id u1QFRIN7027475; Fri, 26 Feb 2016 15:27:18 GMT Received: (from fyigit@localhost) by sivswdev01.ir.intel.com with id u1QFRIEf027471; Fri, 26 Feb 2016 15:27:18 GMT From: Ferruh Yigit To: dev@dpdk.org Date: Fri, 26 Feb 2016 15:26:54 +0000 Message-Id: <1456500415-27416-3-git-send-email-ferruh.yigit@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1456500415-27416-1-git-send-email-ferruh.yigit@intel.com> References: <1455794803-20383-1-git-send-email-ferruh.yigit@intel.com> <1456500415-27416-1-git-send-email-ferruh.yigit@intel.com> Cc: =?UTF-8?q?Nicol=C3=A1s=20Pernas=20Maradei?= Subject: [dpdk-dev] [PATCH v3 2/3] ring: rename fields in internal data struct 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Rename nb_rx/tx_queues fields in internals struct to max_rx/tx_queues This patch just does variable renaming to help understanding code better, nothing changed in functionality of the code. Updated fields required to keep max queue numbers configured. For current queue number requirements data->nb_rx/tx_queues fields used. Signed-off-by: Ferruh Yigit --- drivers/net/ring/rte_eth_ring.c | 59 ++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index d92b088..c9ecb0e 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -59,8 +59,8 @@ struct ring_queue { }; struct pmd_internals { - unsigned nb_rx_queues; - unsigned nb_tx_queues; + unsigned max_rx_queues; + unsigned max_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 +138,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, @@ -169,36 +169,36 @@ eth_dev_info(struct rte_eth_dev *dev, 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 = (uint16_t)internals->max_rx_queues; + dev_info->max_tx_queues = (uint16_t)internals->max_tx_queues; dev_info->min_rx_bufsize = 0; dev_info->pci_dev = NULL; } static void -eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats) +eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { unsigned i; unsigned long rx_total = 0, tx_total = 0, tx_err_total = 0; const struct pmd_internals *internal = dev->data->dev_private; for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && - i < internal->nb_rx_queues; i++) { - igb_stats->q_ipackets[i] = internal->rx_ring_queues[i].rx_pkts.cnt; - rx_total += igb_stats->q_ipackets[i]; + i < dev->data->nb_rx_queues; i++) { + stats->q_ipackets[i] = internal->rx_ring_queues[i].rx_pkts.cnt; + rx_total += stats->q_ipackets[i]; } for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && - i < internal->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]; - tx_err_total += igb_stats->q_errors[i]; + i < dev->data->nb_tx_queues; i++) { + stats->q_opackets[i] = internal->tx_ring_queues[i].tx_pkts.cnt; + stats->q_errors[i] = internal->tx_ring_queues[i].err_pkts.cnt; + tx_total += stats->q_opackets[i]; + tx_err_total += stats->q_errors[i]; } - igb_stats->ipackets = rx_total; - igb_stats->opackets = tx_total; - igb_stats->oerrors = tx_err_total; + stats->ipackets = rx_total; + stats->opackets = tx_total; + stats->oerrors = tx_err_total; } static void @@ -206,9 +206,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 +262,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,15 +290,15 @@ 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); + 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); + 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; @@ -327,8 +326,8 @@ 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; + internals->max_rx_queues = nb_rx_queues; + internals->max_tx_queues = nb_tx_queues; 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]; @@ -349,10 +348,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));