From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 2EDCD68A5 for ; Mon, 29 Jun 2015 16:54:56 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 29 Jun 2015 07:54:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,699,1427785200"; d="scan'208";a="755184425" Received: from unknown (HELO Sent) ([10.217.248.134]) by orsmga002.jf.intel.com with SMTP; 29 Jun 2015 07:54:53 -0700 Received: by Sent (sSMTP sendmail emulation); Mon, 29 Jun 2015 16:54:10 +0200 From: Tomasz Kulasek To: dev@dpdk.org Date: Mon, 29 Jun 2015 16:50:40 +0200 Message-Id: <1435589444-1988-5-git-send-email-tomaszx.kulasek@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1435589444-1988-1-git-send-email-tomaszx.kulasek@intel.com> References: <1434723200-7528-1-git-send-email-tomaszx.kulasek@intel.com> <1435589444-1988-1-git-send-email-tomaszx.kulasek@intel.com> Subject: [dpdk-dev] [PATCH v3 4/8] bonding: queue stats mapping 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: Mon, 29 Jun 2015 14:54:56 -0000 Queue stats mapping is used in example application. This patch adds propagation of mapping over the slaves, and fills bonding port's stats with a sum of corresponding values taken from bonded slaves, when stats are requested for bonding port. Signed-off-by: Tomasz Kulasek --- drivers/net/bonding/rte_eth_bond_pmd.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index cd23f42..ade84c4 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1783,7 +1783,7 @@ bond_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { struct bond_dev_private *internals = dev->data->dev_private; struct rte_eth_stats slave_stats; - int i; + int i, j; for (i = 0; i < internals->slave_count; i++) { rte_eth_stats_get(internals->slaves[i].port_id, &slave_stats); @@ -1802,6 +1802,15 @@ bond_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->rx_pause_xon += slave_stats.rx_pause_xon; stats->tx_pause_xoff += slave_stats.tx_pause_xoff; stats->rx_pause_xoff += slave_stats.rx_pause_xoff; + + for (j = 0; j < RTE_ETHDEV_QUEUE_STAT_CNTRS; j++) { + stats->q_ipackets[j] += slave_stats.q_ipackets[j]; + stats->q_opackets[j] += slave_stats.q_ipackets[j]; + stats->q_ibytes[j] += slave_stats.q_ipackets[j]; + stats->q_obytes[j] += slave_stats.q_ipackets[j]; + stats->q_errors[j] += slave_stats.q_ipackets[j]; + } + } } @@ -2110,6 +2119,24 @@ bond_ethdev_rss_hash_conf_get(struct rte_eth_dev *dev, return 0; } +static int +bond_ethdev_queue_stats_mapping_set(struct rte_eth_dev *dev, uint16_t queue_id, + uint8_t stat_idx, uint8_t is_rx) +{ + int i; + struct bond_dev_private *internals = dev->data->dev_private; + + for (i = 0; i < internals->slave_count; i++) + if (is_rx) + rte_eth_dev_set_rx_queue_stats_mapping( + internals->slaves[i].port_id, queue_id, stat_idx); + else + rte_eth_dev_set_tx_queue_stats_mapping( + internals->slaves[i].port_id, queue_id, stat_idx); + + return 0; +} + struct eth_dev_ops default_dev_ops = { .dev_start = bond_ethdev_start, .dev_stop = bond_ethdev_stop, @@ -2123,6 +2150,7 @@ struct eth_dev_ops default_dev_ops = { .link_update = bond_ethdev_link_update, .stats_get = bond_ethdev_stats_get, .stats_reset = bond_ethdev_stats_reset, + .queue_stats_mapping_set = bond_ethdev_queue_stats_mapping_set, .promiscuous_enable = bond_ethdev_promiscuous_enable, .promiscuous_disable = bond_ethdev_promiscuous_disable, .reta_update = bond_ethdev_rss_reta_update, -- 1.7.9.5