[dpdk-dev] [PATCH v3] net/i40e: fix Rx statistic inconsistent

2016-08-09 Thread Wei Zhao1
rx_good_bytes and rx_good_packets statistic is inconsistent when port
stopped,ipackets statistic is minus the discard packets but rx_bytes
statistic not,but i40e has no statistic of discard bytes.So we check
"dev_started" flag, if the port is started we do the statistic work,if
stopped we don't.We can avoid the statistic inconsistent
problem by this way.

Fixes: 9aace75fc82e ("i40e: fix statistics")

Signed-off-by: Wei Zhao1 
---
 drivers/net/i40e/i40e_ethdev.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index d0aeb70..47ed6e9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2315,7 +2315,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
unsigned i;

/* call read registers - updates values, now write them to struct */
-   i40e_read_stats_registers(pf, hw);
+   if (dev->data->dev_started == 1)
+   i40e_read_stats_registers(pf, hw);

stats->ipackets = pf->main_vsi->eth_stats.rx_unicast +
pf->main_vsi->eth_stats.rx_multicast +
@@ -2494,7 +2495,8 @@ i40e_dev_xstats_get(struct rte_eth_dev *dev, struct 
rte_eth_xstat *xstats,
if (n < count)
return count;

-   i40e_read_stats_registers(pf, hw);
+   if (dev->data->dev_started == 1)
+   i40e_read_stats_registers(pf, hw);

if (xstats == NULL)
return 0;
-- 
2.5.5



[dpdk-dev] [PATCH v2] net/i40e: fix Rx statistic inconsistent

2016-07-29 Thread Wei Zhao1
rx_good_bytes and rx_good_packets statistic is inconsistent when port
stopped,ipackets statistic is minus the discard packets but rx_bytes
statistic not.Also,i40e has no statistic of discard bytes, so we have to
delete discard packets item from rx_good_packets statistic.

Fixes: 9aace75fc82e ("i40e: fix statistics")

Signed-off-by: Wei Zhao1 
---
 drivers/net/i40e/i40e_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 11a5804..553dfd9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2319,8 +2319,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)

stats->ipackets = pf->main_vsi->eth_stats.rx_unicast +
pf->main_vsi->eth_stats.rx_multicast +
-   pf->main_vsi->eth_stats.rx_broadcast -
-   pf->main_vsi->eth_stats.rx_discards;
+   pf->main_vsi->eth_stats.rx_broadcast;
stats->opackets = pf->main_vsi->eth_stats.tx_unicast +
pf->main_vsi->eth_stats.tx_multicast +
pf->main_vsi->eth_stats.tx_broadcast;
-- 
2.5.5



[dpdk-dev] [PATCH] net/i40e: fiX statstic inconsistent when port stopped

2016-07-26 Thread Wei Zhao1
rx_good_bytes and rx_good_packets statstic is inconsistent when port 
stopped,ipackets statistic is minus the discard packets but rx_bytes statistic 
not.
Also,i40e has no statstic of discard bytes, so we have to delete discard 
packets item from rx_good_packets statstic.

Fixes: 9aace75fc82e ("i40e: fix statistics")

Signed-off-by: Wei Zhao1 
---
 drivers/net/i40e/i40e_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 11a5804..553dfd9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2319,8 +2319,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)

stats->ipackets = pf->main_vsi->eth_stats.rx_unicast +
pf->main_vsi->eth_stats.rx_multicast +
-   pf->main_vsi->eth_stats.rx_broadcast -
-   pf->main_vsi->eth_stats.rx_discards;
+   pf->main_vsi->eth_stats.rx_broadcast;
stats->opackets = pf->main_vsi->eth_stats.tx_unicast +
pf->main_vsi->eth_stats.tx_multicast +
pf->main_vsi->eth_stats.tx_broadcast;
-- 
2.5.5