net/iavf: fix stats reset
PATCH 1/1 net/iavf: fix stats reset
stats_reset has been missed when support stats in iavf driver. This patch add statistics reset function.
--- drivers/net/iavf/iavf.h | 6 ++++ drivers/net/iavf/iavf_ethdev.c | 75 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+)
drivers/net/iavf/iavf.h +6 -0
@@ -6,6 +6,7 @@#define _IAVF_ETHDEV_H_#include <rte_kvargs.h> +#include "base/iavf_type.h" #define IAVF_AQ_LEN 32#define IAVF_AQ_BUF_SZ 4096
@@ -58,6 +59,10 @@#define IAVF_ETH_OVERHEAD \ (ETHER_HDR_LEN + ETHER_CRC_LEN + IAVF_VLAN_TAG_SIZE * 2) +#define IAVF_32_BIT_WIDTH (CHAR_BIT * 4) +#define IAVF_48_BIT_WIDTH (CHAR_BIT * 6) +#define IAVF_48_BIT_MASK RTE_LEN2MASK(IAVF_48_BIT_WIDTH, uint64_t) +struct iavf_adapter ;struct iavf_rx_queue ;struct iavf_tx_queue ;
@@ -71,6 +76,7 @@ struct iavf_vsi {uint16_t max_macaddrs;/* Maximum number of MAC addresses */ uint16_t base_vector;uint16_t msix_intr;/* The MSIX interrupt binds to VSI */ +struct virtchnl_eth_stats eth_stats_offset; };/* TODO: is that correct to assume the max number to be 16 ?*/
drivers/net/iavf/iavf_ethdev.c +75 -0
109 lines not on this page · raw message
Signature · 1 line
2.9.5
Quoted 9 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiming Yang
Sent: Monday, April 22, 2019 10:19 AM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] net/iavf: fix stats reset
Quoted 7 lines
stats_resethas been missed when support stats in iavf driver. This patch add statistics reset function.Fixes f4a41a6953af ("net/avf: support stats")Signed-off-by Qiming Yang <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi
Quoted 7 lines · Qiming Yang
stats_resethas been missed when support stats in iavf driver. This patch add statistics reset function.Fixes f4a41a6953af ("net/avf: support stats")Signed-off-by Qiming Yang <[email protected]>
<...>
Quoted 21 lines
drivers/net/iavf/iavf_ethdev.c +17
-0@@ -977,16 +979,71 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev,return 0 ; } +static void +iavf_stat_update_48 (uint64_t *offset, +uint64_t *stat) +{ +if (*stat >= *offset) + *stat = *stat - *offset; +else + *stat = (uint64_t )((*stat + + ((uint64_t )1 <<IAVF_48_BIT_WIDTH )) - *offset); + + *stat &=IAVF_48_BIT_MASK ; +} + +static void +iavf_stat_update_32 (uint64_t *offset, +uint64_t *stat) +{
drivers/net/iavf/iavf_ethdev.c iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, · line 1008
Quoted 10 lines
drivers/net/iavf/iavf_ethdev.c +10
-0+if (*stat >= *offset) + *stat = (uint64_t )(*stat - *offset); +else + *stat = (uint64_t )((*stat + + ((uint64_t )1 <<IAVF_32_BIT_WIDTH )) - *offset); +} + +static void +iavf_update_stats (struct iavf_vsi *vsi, +struct virtchnl_eth_stats *nes)
This syntax looks odd, will fix while merging, similar to above functions, no need to break parameter lines into multiple line, will update them too.
Quoted 7 lines · Qiming Yang
stats_resethas been missed when support stats in iavf driver. This patch add statistics reset function.Fixes f4a41a6953af ("net/avf: support stats")Signed-off-by Qiming Yang <[email protected]>
Hi - This won't apply on 18.11 branch. Please send a backport, or let me know if it's not needed. Btw, adding an "i" prefix to every filename/define/struct/function is a pain for backports :/