[dpdk-dev] i40e: fixed tx stats bug

Message ID 1416386354-18274-1-git-send-email-zhida.zang@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

zzang Nov. 19, 2014, 8:39 a.m. UTC
From: zzang <zhida.zang@intel.com>

Fixed tx stats bug in i40e

Signed-off-by: zzang <zhida.zang@intel.com>
---
 lib/librte_pmd_i40e/i40e_ethdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Michael Qiu Nov. 19, 2014, 9:26 a.m. UTC | #1
On 11/19/2014 4:43 PM, zhida zang wrote:
> From: zzang <zhida.zang@intel.com>
>
> Fixed tx stats bug in i40e


Would you mind to give more details about this bug in the commit log?

 This can really help reviewer to get the initial idea about your patch
without go through the code it self.

Thanks,
Michael
>
> Signed-off-by: zzang <zhida.zang@intel.com>
> ---
>  lib/librte_pmd_i40e/i40e_ethdev.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
> index 4b7a827..e01590c 100644
> --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> @@ -1102,6 +1102,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>  	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>  	struct i40e_hw_port_stats *ns = &pf->stats; /* new stats */
>  	struct i40e_hw_port_stats *os = &pf->stats_offset; /* old stats */
> +	struct i40e_eth_stats *ves = &pf->main_vsi->eth_stats; /* vsi stats */
>  
>  	/* Get statistics of struct i40e_eth_stats */
>  	i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port),
> @@ -1284,8 +1285,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>  
>  	stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast +
>  						ns->eth.rx_broadcast;
> -	stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast +
> -						ns->eth.tx_broadcast;
> +	stats->opackets = ves->tx_unicast + ves->tx_multicast +
> +						ves->tx_broadcast;
>  	stats->ibytes   = ns->eth.rx_bytes;
>  	stats->obytes   = ns->eth.tx_bytes;
>  	stats->oerrors  = ns->eth.tx_errors;
  
zzang Nov. 20, 2014, 1:15 a.m. UTC | #2
Is that OK that I send another patch with details directly?

-----Original Message-----
From: Qiu, Michael 
Sent: Wednesday, November 19, 2014 17:27
To: Zang, Zhida; dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] i40e: fixed tx stats bug

On 11/19/2014 4:43 PM, zhida zang wrote:
> From: zzang <zhida.zang@intel.com>
>
> Fixed tx stats bug in i40e


Would you mind to give more details about this bug in the commit log?

 This can really help reviewer to get the initial idea about your patch without go through the code it self.

Thanks,
Michael
>
> Signed-off-by: zzang <zhida.zang@intel.com>
> ---
>  lib/librte_pmd_i40e/i40e_ethdev.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c 
> b/lib/librte_pmd_i40e/i40e_ethdev.c
> index 4b7a827..e01590c 100644
> --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> @@ -1102,6 +1102,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>  	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>  	struct i40e_hw_port_stats *ns = &pf->stats; /* new stats */
>  	struct i40e_hw_port_stats *os = &pf->stats_offset; /* old stats */
> +	struct i40e_eth_stats *ves = &pf->main_vsi->eth_stats; /* vsi stats 
> +*/
>  
>  	/* Get statistics of struct i40e_eth_stats */
>  	i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port), @@ -1284,8 
> +1285,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
> rte_eth_stats *stats)
>  
>  	stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast +
>  						ns->eth.rx_broadcast;
> -	stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast +
> -						ns->eth.tx_broadcast;
> +	stats->opackets = ves->tx_unicast + ves->tx_multicast +
> +						ves->tx_broadcast;
>  	stats->ibytes   = ns->eth.rx_bytes;
>  	stats->obytes   = ns->eth.tx_bytes;
>  	stats->oerrors  = ns->eth.tx_errors;
  
Michael Qiu Nov. 21, 2014, 2:23 a.m. UTC | #3
Yes, but I think it is better for you to made a v2 patch

Thanks
Michael

-----Original Message-----
From: Zang, Zhida 
Sent: Thursday, November 20, 2014 9:15 AM
To: Qiu, Michael; dev@dpdk.org
Subject: RE: [dpdk-dev] [PATCH] i40e: fixed tx stats bug

Is that OK that I send another patch with details directly?

-----Original Message-----
From: Qiu, Michael
Sent: Wednesday, November 19, 2014 17:27
To: Zang, Zhida; dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] i40e: fixed tx stats bug

On 11/19/2014 4:43 PM, zhida zang wrote:
> From: zzang <zhida.zang@intel.com>
>
> Fixed tx stats bug in i40e


Would you mind to give more details about this bug in the commit log?

 This can really help reviewer to get the initial idea about your patch without go through the code it self.

Thanks,
Michael
>
> Signed-off-by: zzang <zhida.zang@intel.com>
> ---
>  lib/librte_pmd_i40e/i40e_ethdev.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c
> b/lib/librte_pmd_i40e/i40e_ethdev.c
> index 4b7a827..e01590c 100644
> --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> @@ -1102,6 +1102,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>  	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>  	struct i40e_hw_port_stats *ns = &pf->stats; /* new stats */
>  	struct i40e_hw_port_stats *os = &pf->stats_offset; /* old stats */
> +	struct i40e_eth_stats *ves = &pf->main_vsi->eth_stats; /* vsi stats 
> +*/
>  
>  	/* Get statistics of struct i40e_eth_stats */
>  	i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port), @@ -1284,8
> +1285,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct
> rte_eth_stats *stats)
>  
>  	stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast +
>  						ns->eth.rx_broadcast;
> -	stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast +
> -						ns->eth.tx_broadcast;
> +	stats->opackets = ves->tx_unicast + ves->tx_multicast +
> +						ves->tx_broadcast;
>  	stats->ibytes   = ns->eth.rx_bytes;
>  	stats->obytes   = ns->eth.tx_bytes;
>  	stats->oerrors  = ns->eth.tx_errors;
  

Patch

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 4b7a827..e01590c 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -1102,6 +1102,7 @@  i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct i40e_hw_port_stats *ns = &pf->stats; /* new stats */
 	struct i40e_hw_port_stats *os = &pf->stats_offset; /* old stats */
+	struct i40e_eth_stats *ves = &pf->main_vsi->eth_stats; /* vsi stats */
 
 	/* Get statistics of struct i40e_eth_stats */
 	i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port),
@@ -1284,8 +1285,8 @@  i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 
 	stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast +
 						ns->eth.rx_broadcast;
-	stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast +
-						ns->eth.tx_broadcast;
+	stats->opackets = ves->tx_unicast + ves->tx_multicast +
+						ves->tx_broadcast;
 	stats->ibytes   = ns->eth.rx_bytes;
 	stats->obytes   = ns->eth.tx_bytes;
 	stats->oerrors  = ns->eth.tx_errors;