net/i40e: fix packet count for PF
PATCH 1/1 net/i40e: fix packet count for PF
Previously, for PF statistics we use VSI register for packet count but use port's register for packet bytes, that cause inconsistent situation of PF statistics when some VF is active, since it will cover VF's packet bytes but not packet count.
The patch will take port register for PF packet count back, but still exclude main vsi's discard packet count.
Just like pervious fix, its still not perfect,(since RX packet number is over counted when there is VF discard packet) but seems it make the overall better).
--- drivers/net/i40e/i40e_ethdev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_ethdev.c +7 -6
@@ -2664,13 +2664,14 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)/* call read registers - updates values, now write them to struct */ i40e_read_stats_registers (pf, hw); - stats->ipackets = pf->main_vsi->eth_stats.rx_unicast + - pf->main_vsi->eth_stats.rx_multicast + - pf->main_vsi->eth_stats.rx_broadcast - + stats->ipackets = ns->eth.rx_unicast + + ns->eth.rx_multicast + + ns->eth.rx_broadcast - + ns->eth.rx_discards - pf->main_vsi->eth_stats.rx_discards; - stats->opackets = pf->main_vsi->eth_stats.tx_unicast + - pf->main_vsi->eth_stats.tx_multicast + - pf->main_vsi->eth_stats.tx_broadcast; + stats->opackets = ns->eth.tx_unicast + + ns->eth.tx_multicast + + ns->eth.tx_broadcast; stats->ibytes = ns->eth.rx_bytes; stats->obytes = ns->eth.tx_bytes; stats->oerrors = ns->eth.tx_errors +
Signature · 1 line
2.9.4
Quoted 9 lines · Qi Zhang
Previously, for PF statistics we use VSI register for packet count but use port's register for packet bytes, that cause inconsistent situation of PF statistics when some VF is active, since it will cover VF's packet bytes but not packet count.
The patch will take port register for PF packet count back, but still exclude main vsi's discard packet count.
Just like pervious fix, its still not perfect,(since RX packet number is over counted when there is VF discard packet) but seems it make the overall better).
What does Linux do for stats calculation?
I believe it is good to be consistent with it.
Quoted 15 lines
Fixes 9aace75fc82e ("i40e: fix statistics")Signed-off-by Qi Zhang <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)drivers/net/i40e/i40e_ethdev.c +0
-0@@ -2664,13 +2664,14 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)/* call read registers - updates values, now write them to struct */
drivers/net/i40e/i40e_ethdev.c i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) · line 2671
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +4
-3i40e_read_stats_registers (pf, hw); - stats->ipackets = pf->main_vsi->eth_stats.rx_unicast + - pf->main_vsi->eth_stats.rx_multicast + - pf->main_vsi->eth_stats.rx_broadcast - + stats->ipackets = ns->eth.rx_unicast + + ns->eth.rx_multicast + + ns->eth.rx_broadcast - + ns->eth.rx_discards - pf->main_vsi->eth_stats.rx_discards;
Both port rx_discards and PF rx_discards excluded, is this intentional? Won't this cause double exclusion of some rx_discards packets?
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +3
-3- stats->opackets = pf->main_vsi->eth_stats.tx_unicast + - pf->main_vsi->eth_stats.tx_multicast + - pf->main_vsi->eth_stats.tx_broadcast; + stats->opackets = ns->eth.tx_unicast + + ns->eth.tx_multicast + + ns->eth.tx_broadcast; stats->ibytes = ns->eth.rx_bytes; stats->obytes = ns->eth.tx_bytes; stats->oerrors = ns->eth.tx_errors +
Sorry for late reply
Quoted 18 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, August 21, 2017 8:43 PM
To: Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-stable] [PATCH] net/i40e: fix packet count for PFQuoted 9 lines · Qi Zhang
Previously, for PF statistics we use VSI register for packet count but use port's register for packet bytes, that cause inconsistent situation of PF statistics when some VF is active, since it will cover VF's packet bytes but not packet count.
The patch will take port register for PF packet count back, but still exclude main vsi's discard packet count.
Just like pervious fix, its still not perfect,(since RX packet number is over counted when there is VF discard packet) but seems it make the overall better).
Quoted 2 lines
What does Linux do for stats calculation?
I believe it is good to be consistent with it.
Kernel driver is quite different on the stats calucation, I don't think this patch is going to cover this. It just try to fix the mismatch between rxbytes and rx_packets on PF.
But your suggestion is considerable
Quoted 19 lines
drivers/net/i40e/i40e_ethdev.c i40e_dev_stats_get(struct rte_eth_dev *dev,
Quoted 15 lines
Fixes 9aace75fc82e ("i40e: fix statistics")Signed-off-by Qi Zhang <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 5f26e24..63acbb8 100644drivers/net/i40e/i40e_ethdev.c +0
-0@@ -2664,13 +2664,14 @@ i40e_dev_stats_get(struct rte_eth_dev *dev,struct
rte_eth_stats*stats)Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +0
-0/* call read registers - updates values, now write them to struct */ i40e_read_stats_registers (pf, hw);
Quoted 11 lines
drivers/net/i40e/i40e_ethdev.c i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) · line 2671
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +4
-3- stats->ipackets = pf->main_vsi->eth_stats.rx_unicast + - pf->main_vsi->eth_stats.rx_multicast + - pf->main_vsi->eth_stats.rx_broadcast - + stats->ipackets = ns->eth.rx_unicast + + ns->eth.rx_multicast + + ns->eth.rx_broadcast - + ns->eth.rx_discards - pf->main_vsi->eth_stats.rx_discards;Both port
rx_discardsand PFrx_discardsexcluded, is this intentional? Won't this cause double exclusion of somerx_discardspackets?
Yes, this is intentional, port rx_discard and VSI rx_discard counts on different part of total drop packets.
Quoted 11 lines
drivers/net/i40e/i40e_ethdev.c i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) · line 2677
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +3
-3- stats->opackets = pf->main_vsi->eth_stats.tx_unicast + - pf->main_vsi->eth_stats.tx_multicast + - pf->main_vsi->eth_stats.tx_broadcast; + stats->opackets = ns->eth.tx_unicast + + ns->eth.tx_multicast + + ns->eth.tx_broadcast; stats->ibytes = ns->eth.rx_bytes; stats->obytes = ns->eth.tx_bytes; stats->oerrors = ns->eth.tx_errors +
Regards
Qi
Quoted 20 lines · Qi Z
Sorry for late reply
Quoted 18 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, August 21, 2017 8:43 PM
To: Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-stable] [PATCH] net/i40e: fix packet count for PFQuoted 9 lines · Qi Zhang
Previously, for PF statistics we use VSI register for packet count but use port's register for packet bytes, that cause inconsistent situation of PF statistics when some VF is active, since it will cover VF's packet bytes but not packet count.
The patch will take port register for PF packet count back, but still exclude main vsi's discard packet count.
Just like pervious fix, its still not perfect,(since RX packet number is over counted when there is VF discard packet) but seems it make the overall better).
Quoted 6 lines
Quoted 2 lines
What does Linux do for stats calculation?
I believe it is good to be consistent with it.Kernel driver is quite different on the stats calucation, I don't think this patch is going to cover this. It just try to fix the mismatch between rxbytes and
rx_packetson PF.
But your suggestion is considerable
Method can be different, but numbers should be same :)
Not for this patch, bur for long term, I think having exact stats numbers as Linux should be the target, if this is not the case already.
Quoted 48 lines
Quoted 20 lines
drivers/net/i40e/i40e_ethdev.c i40e_dev_stats_get(struct rte_eth_dev *dev,
Quoted 16 lines
Fixes 9aace75fc82e ("i40e: fix statistics")Signed-off-by Qi Zhang <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 5f26e24..63acbb8 100644drivers/net/i40e/i40e_ethdev.c +0
-0@@ -2664,13 +2664,14 @@ i40e_dev_stats_get(struct rte_eth_dev *dev,struct
rte_eth_stats*stats)Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +0
-0/* call read registers - updates values, now write them to struct */ i40e_read_stats_registers (pf, hw);Quoted 11 lines
drivers/net/i40e/i40e_ethdev.c i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) · line 2671
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +4
-3- stats->ipackets = pf->main_vsi->eth_stats.rx_unicast + - pf->main_vsi->eth_stats.rx_multicast + - pf->main_vsi->eth_stats.rx_broadcast - + stats->ipackets = ns->eth.rx_unicast + + ns->eth.rx_multicast + + ns->eth.rx_broadcast - + ns->eth.rx_discards - pf->main_vsi->eth_stats.rx_discards;Both port
rx_discardsand PFrx_discardsexcluded, is this intentional? Won't this cause double exclusion of somerx_discardspackets?Yes, this is intentional, port
rx_discardand VSIrx_discardcounts on different part of total drop packets.Quoted 11 lines
drivers/net/i40e/i40e_ethdev.c i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) · line 2677
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +3
-3- stats->opackets = pf->main_vsi->eth_stats.tx_unicast + - pf->main_vsi->eth_stats.tx_multicast + - pf->main_vsi->eth_stats.tx_broadcast; + stats->opackets = ns->eth.tx_unicast + + ns->eth.tx_multicast + + ns->eth.tx_broadcast; stats->ibytes = ns->eth.rx_bytes; stats->obytes = ns->eth.tx_bytes; stats->oerrors = ns->eth.tx_errors +Regards
Qi
Ferruh Yigit
AppliedQuoted 10 lines · Qi Zhang
Previously, for PF statistics we use VSI register for packet count but use port's register for packet bytes, that cause inconsistent situation of PF statistics when some VF is active, since it will cover VF's packet bytes but not packet count.
The patch will take port register for PF packet count back, but still exclude main vsi's discard packet count.
Just like pervious fix, its still not perfect,(since RX packet number is over counted when there is VF discard packet) but seems it make the overall better).
Quoted 4 lines
Fixes 9aace75fc82e ("i40e: fix statistics")Signed-off-by Qi Zhang <[email protected]>
Applied to dpdk-next-net/master, thanks.