* [dpdk-dev] [PATCH] net/i40e: exclude internal packet's byte count @ 2017-05-31 22:53 Qi Zhang 2017-06-01 9:12 ` Xing, Beilei 0 siblings, 1 reply; 3+ messages in thread From: Qi Zhang @ 2017-05-31 22:53 UTC (permalink / raw) To: jingjing.wu, helin.zhang; +Cc: dev, Qi Zhang, stable Tx/Rx byte counts of internal managed packet should be exluded from the total rx/tx bytes. Fixes: 9aace75fc82e ("i40e: fix statistics") Cc: stable@dpdk.org Signed-off-by: Qi Zhang <qi.z.zhang@intel.com> --- drivers/net/i40e/i40e_ethdev.c | 13 +++++++++++-- drivers/net/i40e/i40e_ethdev.h | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 4c49673..c8802f2 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2379,6 +2379,15 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) struct i40e_hw_port_stats *ns = &pf->stats; /* new stats */ struct i40e_hw_port_stats *os = &pf->stats_offset; /* old stats */ + /* Get rx/tx bytes of internal transfer packets */ + i40e_stat_update_48(hw, I40E_GLV_GORCH(hw->port), I40E_GLV_GORCL(hw->port), + pf->offset_loaded, &pf->internal_rx_bytes_offset, + &pf->internal_rx_bytes); + + i40e_stat_update_48(hw, I40E_GLV_GOTCH(hw->port), I40E_GLV_GOTCL(hw->port), + pf->offset_loaded, &pf->internal_tx_bytes_offset, + &pf->internal_tx_bytes); + /* Get statistics of struct i40e_eth_stats */ i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port), I40E_GLPRT_GORCL(hw->port), @@ -2400,7 +2409,7 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) * so subtract ETHER_CRC_LEN from the byte counter for each rx packet. */ ns->eth.rx_bytes -= (ns->eth.rx_unicast + ns->eth.rx_multicast + - ns->eth.rx_broadcast) * ETHER_CRC_LEN; + ns->eth.rx_broadcast) * ETHER_CRC_LEN + pf->internal_rx_bytes; i40e_stat_update_32(hw, I40E_GLPRT_RDPC(hw->port), pf->offset_loaded, &os->eth.rx_discards, @@ -2428,7 +2437,7 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) pf->offset_loaded, &os->eth.tx_broadcast, &ns->eth.tx_broadcast); ns->eth.tx_bytes -= (ns->eth.tx_unicast + ns->eth.tx_multicast + - ns->eth.tx_broadcast) * ETHER_CRC_LEN; + ns->eth.tx_broadcast) * ETHER_CRC_LEN + pf->internal_tx_bytes; /* GLPRT_TEPC not supported */ /* additional port specific stats */ diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 2ff8282..b0d963c 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -639,6 +639,11 @@ struct i40e_pf { struct i40e_hw_port_stats stats_offset; struct i40e_hw_port_stats stats; + /* internal packet byte count, it should be excluded from the total */ + uint64_t internal_rx_bytes; + uint64_t internal_tx_bytes; + uint64_t internal_rx_bytes_offset; + uint64_t internal_tx_bytes_offset; bool offset_loaded; struct rte_eth_dev_data *dev_data; /* Pointer to the device data */ -- 2.7.4 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/i40e: exclude internal packet's byte count 2017-05-31 22:53 [dpdk-dev] [PATCH] net/i40e: exclude internal packet's byte count Qi Zhang @ 2017-06-01 9:12 ` Xing, Beilei 2017-06-02 0:23 ` Zhang, Qi Z 0 siblings, 1 reply; 3+ messages in thread From: Xing, Beilei @ 2017-06-01 9:12 UTC (permalink / raw) To: Zhang, Qi Z, Wu, Jingjing, Zhang, Helin; +Cc: dev, Zhang, Qi Z, stable Hi Qi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qi Zhang > Sent: Thursday, June 1, 2017 6:53 AM > To: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Helin > <helin.zhang@intel.com> > Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; stable@dpdk.org > Subject: [dpdk-dev] [PATCH] net/i40e: exclude internal packet's byte count > > Tx/Rx byte counts of internal managed packet should be exluded from the > total rx/tx bytes. > > Fixes: 9aace75fc82e ("i40e: fix statistics") > Cc: stable@dpdk.org > > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com> > --- > drivers/net/i40e/i40e_ethdev.c | 13 +++++++++++-- > drivers/net/i40e/i40e_ethdev.h | 5 +++++ > 2 files changed, 16 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c > index 4c49673..c8802f2 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -2379,6 +2379,15 @@ i40e_read_stats_registers(struct i40e_pf *pf, > struct i40e_hw *hw) > struct i40e_hw_port_stats *ns = &pf->stats; /* new stats */ > struct i40e_hw_port_stats *os = &pf->stats_offset; /* old stats */ > > + /* Get rx/tx bytes of internal transfer packets */ > + i40e_stat_update_48(hw, I40E_GLV_GORCH(hw->port), > I40E_GLV_GORCL(hw->port), > + pf->offset_loaded, &pf->internal_rx_bytes_offset, > + &pf->internal_rx_bytes); > + > + i40e_stat_update_48(hw, I40E_GLV_GOTCH(hw->port), > I40E_GLV_GOTCL(hw->port), > + pf->offset_loaded, &pf->internal_tx_bytes_offset, > + &pf->internal_tx_bytes); > + > /* Get statistics of struct i40e_eth_stats */ > i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port), > I40E_GLPRT_GORCL(hw->port), > @@ -2400,7 +2409,7 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct > i40e_hw *hw) > * so subtract ETHER_CRC_LEN from the byte counter for each rx > packet. > */ > ns->eth.rx_bytes -= (ns->eth.rx_unicast + ns->eth.rx_multicast + > - ns->eth.rx_broadcast) * ETHER_CRC_LEN; > + ns->eth.rx_broadcast) * ETHER_CRC_LEN + pf- > >internal_rx_bytes; > > i40e_stat_update_32(hw, I40E_GLPRT_RDPC(hw->port), > pf->offset_loaded, &os->eth.rx_discards, @@ - > 2428,7 +2437,7 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct > i40e_hw *hw) > pf->offset_loaded, &os->eth.tx_broadcast, > &ns->eth.tx_broadcast); > ns->eth.tx_bytes -= (ns->eth.tx_unicast + ns->eth.tx_multicast + > - ns->eth.tx_broadcast) * ETHER_CRC_LEN; > + ns->eth.tx_broadcast) * ETHER_CRC_LEN + pf- > >internal_tx_bytes; > /* GLPRT_TEPC not supported */ > > /* additional port specific stats */ > diff --git a/drivers/net/i40e/i40e_ethdev.h > b/drivers/net/i40e/i40e_ethdev.h index 2ff8282..b0d963c 100644 > --- a/drivers/net/i40e/i40e_ethdev.h > +++ b/drivers/net/i40e/i40e_ethdev.h > @@ -639,6 +639,11 @@ struct i40e_pf { > > struct i40e_hw_port_stats stats_offset; > struct i40e_hw_port_stats stats; > + /* internal packet byte count, it should be excluded from the total */ > + uint64_t internal_rx_bytes; > + uint64_t internal_tx_bytes; > + uint64_t internal_rx_bytes_offset; > + uint64_t internal_tx_bytes_offset; > bool offset_loaded; > > struct rte_eth_dev_data *dev_data; /* Pointer to the device data */ > -- > 2.7.4 Do we need to clear the two new stats counters in i40e_pf_setup function? Just like clear pf->stats and pf->stats_offset. ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/i40e: exclude internal packet's byte count 2017-06-01 9:12 ` Xing, Beilei @ 2017-06-02 0:23 ` Zhang, Qi Z 0 siblings, 0 replies; 3+ messages in thread From: Zhang, Qi Z @ 2017-06-02 0:23 UTC (permalink / raw) To: Xing, Beilei, Wu, Jingjing, Zhang, Helin; +Cc: dev, stable > -----Original Message----- > From: Xing, Beilei > Sent: Thursday, June 1, 2017 5:13 PM > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing > <jingjing.wu@intel.com>; Zhang, Helin <helin.zhang@intel.com> > Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; stable@dpdk.org > Subject: RE: [dpdk-dev] [PATCH] net/i40e: exclude internal packet's byte > count > > Hi Qi, > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qi Zhang > > Sent: Thursday, June 1, 2017 6:53 AM > > To: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Helin > > <helin.zhang@intel.com> > > Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; stable@dpdk.org > > Subject: [dpdk-dev] [PATCH] net/i40e: exclude internal packet's byte > > count > > > > Tx/Rx byte counts of internal managed packet should be exluded from > > the total rx/tx bytes. > > > > Fixes: 9aace75fc82e ("i40e: fix statistics") > > Cc: stable@dpdk.org > > > > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com> > > --- > > drivers/net/i40e/i40e_ethdev.c | 13 +++++++++++-- > > drivers/net/i40e/i40e_ethdev.h | 5 +++++ > > 2 files changed, 16 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/net/i40e/i40e_ethdev.c > > b/drivers/net/i40e/i40e_ethdev.c index 4c49673..c8802f2 100644 > > --- a/drivers/net/i40e/i40e_ethdev.c > > +++ b/drivers/net/i40e/i40e_ethdev.c > > @@ -2379,6 +2379,15 @@ i40e_read_stats_registers(struct i40e_pf *pf, > > struct i40e_hw *hw) > > struct i40e_hw_port_stats *ns = &pf->stats; /* new stats */ > > struct i40e_hw_port_stats *os = &pf->stats_offset; /* old stats */ > > > > + /* Get rx/tx bytes of internal transfer packets */ > > + i40e_stat_update_48(hw, I40E_GLV_GORCH(hw->port), > > I40E_GLV_GORCL(hw->port), > > + pf->offset_loaded, &pf->internal_rx_bytes_offset, > > + &pf->internal_rx_bytes); > > + > > + i40e_stat_update_48(hw, I40E_GLV_GOTCH(hw->port), > > I40E_GLV_GOTCL(hw->port), > > + pf->offset_loaded, &pf->internal_tx_bytes_offset, > > + &pf->internal_tx_bytes); > > + > > /* Get statistics of struct i40e_eth_stats */ > > i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port), > > I40E_GLPRT_GORCL(hw->port), > > @@ -2400,7 +2409,7 @@ i40e_read_stats_registers(struct i40e_pf *pf, > > struct i40e_hw *hw) > > * so subtract ETHER_CRC_LEN from the byte counter for each rx > > packet. > > */ > > ns->eth.rx_bytes -= (ns->eth.rx_unicast + ns->eth.rx_multicast + > > - ns->eth.rx_broadcast) * ETHER_CRC_LEN; > > + ns->eth.rx_broadcast) * ETHER_CRC_LEN + pf- > > >internal_rx_bytes; > > > > i40e_stat_update_32(hw, I40E_GLPRT_RDPC(hw->port), > > pf->offset_loaded, &os->eth.rx_discards, @@ - > > 2428,7 +2437,7 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct > > i40e_hw *hw) > > pf->offset_loaded, &os->eth.tx_broadcast, > > &ns->eth.tx_broadcast); > > ns->eth.tx_bytes -= (ns->eth.tx_unicast + ns->eth.tx_multicast + > > - ns->eth.tx_broadcast) * ETHER_CRC_LEN; > > + ns->eth.tx_broadcast) * ETHER_CRC_LEN + pf- > > >internal_tx_bytes; > > /* GLPRT_TEPC not supported */ > > > > /* additional port specific stats */ diff --git > > a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h > > index 2ff8282..b0d963c 100644 > > --- a/drivers/net/i40e/i40e_ethdev.h > > +++ b/drivers/net/i40e/i40e_ethdev.h > > @@ -639,6 +639,11 @@ struct i40e_pf { > > > > struct i40e_hw_port_stats stats_offset; > > struct i40e_hw_port_stats stats; > > + /* internal packet byte count, it should be excluded from the total */ > > + uint64_t internal_rx_bytes; > > + uint64_t internal_tx_bytes; > > + uint64_t internal_rx_bytes_offset; > > + uint64_t internal_tx_bytes_offset; > > bool offset_loaded; > > > > struct rte_eth_dev_data *dev_data; /* Pointer to the device data */ > > -- > > 2.7.4 > > Do we need to clear the two new stats counters in i40e_pf_setup function? > Just like clear pf->stats and pf->stats_offset. Yes, it should be reset as other stats Thanks for capture this. Qi ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-02 0:23 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-05-31 22:53 [dpdk-dev] [PATCH] net/i40e: exclude internal packet's byte count Qi Zhang 2017-06-01 9:12 ` Xing, Beilei 2017-06-02 0:23 ` Zhang, Qi Z
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).