From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id E6B825A58 for ; Wed, 3 Jun 2015 13:05:22 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 03 Jun 2015 04:05:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,546,1427785200"; d="scan'208";a="740070054" Received: from unknown (HELO Sent) ([10.217.248.134]) by orsmga002.jf.intel.com with SMTP; 03 Jun 2015 04:05:21 -0700 Received: by Sent (sSMTP sendmail emulation); Wed, 03 Jun 2015 13:04:16 +0200 From: Tomasz Kulasek To: dev@dpdk.org Date: Wed, 3 Jun 2015 12:59:03 +0200 Message-Id: <1433329147-2840-5-git-send-email-tomaszx.kulasek@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1433329147-2840-1-git-send-email-tomaszx.kulasek@intel.com> References: <1433329147-2840-1-git-send-email-tomaszx.kulasek@intel.com> Subject: [dpdk-dev] [PATCH 4/8] bond: 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: Wed, 03 Jun 2015 11:05:23 -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 4f6fc68..7a4ecb8 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1766,7 +1766,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; /* clear bonded stats before populating from slaves */ memset(stats, 0, sizeof(*stats)); @@ -1788,6 +1788,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]; + } + } } @@ -2090,6 +2099,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, @@ -2103,6 +2130,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