[dpdk-dev] [PATCH 4/4] fm10k: remove crc size from all byte counters

2015-11-17 Thread Qiu, Michael
Hi, Harry

Have you ever tested this patch by yourself?

fm10k's stats should already remove the crc bytes by default.

After your patch applied, if send a packet without vlan(64 bytes),
we expect receive 60 bytes, but it will disappoint you, that only
56 bytes shows in system.

Thanks,
Michael

On 2015/11/16 18:36, Harry van Haaren wrote:
> This patch removes the crc bytes from byte counter statistics.
>
> Signed-off-by: Harry van Haaren 
> ---
>  drivers/net/fm10k/fm10k_ethdev.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c 
> b/drivers/net/fm10k/fm10k_ethdev.c
> index 441f713..fdb2e81 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -1183,11 +1183,13 @@ fm10k_stats_get(struct rte_eth_dev *dev, struct 
> rte_eth_stats *stats)
>  
>   ipackets = opackets = ibytes = obytes = 0;
>   for (i = 0; (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) &&
> - (i < hw->mac.max_queues); ++i) {
> + (i < hw->mac.max_queues); ++i) {
>   stats->q_ipackets[i] = hw_stats->q[i].rx_packets.count;
>   stats->q_opackets[i] = hw_stats->q[i].tx_packets.count;
> - stats->q_ibytes[i]   = hw_stats->q[i].rx_bytes.count;
> - stats->q_obytes[i]   = hw_stats->q[i].tx_bytes.count;
> + stats->q_ibytes[i]   = hw_stats->q[i].rx_bytes.count -
> + (stats->q_ipackets[i] * 4);
> + stats->q_obytes[i]   = hw_stats->q[i].tx_bytes.count -
> + (stats->q_opackets[i] * 4);
>   ipackets += stats->q_ipackets[i];
>   opackets += stats->q_opackets[i];
>   ibytes   += stats->q_ibytes[i];



[dpdk-dev] [PATCH 4/4] fm10k: remove crc size from all byte counters

2015-11-16 Thread Harry van Haaren
This patch removes the crc bytes from byte counter statistics.

Signed-off-by: Harry van Haaren 
---
 drivers/net/fm10k/fm10k_ethdev.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 441f713..fdb2e81 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1183,11 +1183,13 @@ fm10k_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)

ipackets = opackets = ibytes = obytes = 0;
for (i = 0; (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) &&
-   (i < hw->mac.max_queues); ++i) {
+   (i < hw->mac.max_queues); ++i) {
stats->q_ipackets[i] = hw_stats->q[i].rx_packets.count;
stats->q_opackets[i] = hw_stats->q[i].tx_packets.count;
-   stats->q_ibytes[i]   = hw_stats->q[i].rx_bytes.count;
-   stats->q_obytes[i]   = hw_stats->q[i].tx_bytes.count;
+   stats->q_ibytes[i]   = hw_stats->q[i].rx_bytes.count -
+   (stats->q_ipackets[i] * 4);
+   stats->q_obytes[i]   = hw_stats->q[i].tx_bytes.count -
+   (stats->q_opackets[i] * 4);
ipackets += stats->q_ipackets[i];
opackets += stats->q_opackets[i];
ibytes   += stats->q_ibytes[i];
-- 
1.9.1