Skip to content

Commit

Permalink
net/hns3: support device stats
Browse files Browse the repository at this point in the history
This patch adds stats_get, stats_reset, xstats_get, xstats_get_names
xstats_reset, xstats_get_by_id and xstats_get_names_by_id related
function codes.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Hao Chen <chenhao164@huawei.com>
Signed-off-by: Chunsong Feng <fengchunsong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  • Loading branch information
xavierhw authored and Ferruh Yigit committed Oct 7, 2019
1 parent 3988ab0 commit 8839c5e
Show file tree
Hide file tree
Showing 9 changed files with 1,154 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/guides/nics/features/hns3.ini
Expand Up @@ -25,6 +25,9 @@ L3 checksum offload = Y
L4 checksum offload = Y
Inner L3 checksum = Y
Inner L4 checksum = Y
Basic stats = Y
Extended stats = Y
Stats per queue = Y
FW version = Y
Linux UIO = Y
Linux VFIO = Y
Expand Down
3 changes: 3 additions & 0 deletions doc/guides/nics/features/hns3_vf.ini
Expand Up @@ -21,6 +21,9 @@ L3 checksum offload = Y
L4 checksum offload = Y
Inner L3 checksum = Y
Inner L4 checksum = Y
Basic stats = Y
Extended stats = Y
Stats per queue = Y
Linux UIO = Y
Linux VFIO = Y
ARMv8 = Y
1 change: 1 addition & 0 deletions drivers/net/hns3/Makefile
Expand Up @@ -31,6 +31,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_HNS3_PMD) += hns3_rss.c
SRCS-$(CONFIG_RTE_LIBRTE_HNS3_PMD) += hns3_flow.c
SRCS-$(CONFIG_RTE_LIBRTE_HNS3_PMD) += hns3_fdir.c
SRCS-$(CONFIG_RTE_LIBRTE_HNS3_PMD) += hns3_intr.c
SRCS-$(CONFIG_RTE_LIBRTE_HNS3_PMD) += hns3_stats.c
SRCS-$(CONFIG_RTE_LIBRTE_HNS3_PMD) += hns3_regs.c
SRCS-$(CONFIG_RTE_LIBRTE_HNS3_PMD) += hns3_dcb.c

Expand Down
7 changes: 7 additions & 0 deletions drivers/net/hns3/hns3_ethdev.c
Expand Up @@ -4190,6 +4190,13 @@ static const struct eth_dev_ops hns3_eth_dev_ops = {
.allmulticast_enable = hns3_dev_allmulticast_enable,
.allmulticast_disable = hns3_dev_allmulticast_disable,
.mtu_set = hns3_dev_mtu_set,
.stats_get = hns3_stats_get,
.stats_reset = hns3_stats_reset,
.xstats_get = hns3_dev_xstats_get,
.xstats_get_names = hns3_dev_xstats_get_names,
.xstats_reset = hns3_dev_xstats_reset,
.xstats_get_by_id = hns3_dev_xstats_get_by_id,
.xstats_get_names_by_id = hns3_dev_xstats_get_names_by_id,
.dev_infos_get = hns3_dev_infos_get,
.fw_version_get = hns3_fw_version_get,
.rx_queue_setup = hns3_rx_queue_setup,
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/hns3/hns3_ethdev.h
Expand Up @@ -12,6 +12,7 @@
#include "hns3_mbx.h"
#include "hns3_rss.h"
#include "hns3_fdir.h"
#include "hns3_stats.h"

/* Vendor ID */
#define PCI_VENDOR_ID_HUAWEI 0x19e5
Expand Down Expand Up @@ -338,6 +339,9 @@ struct hns3_hw {
pthread_t irq_thread_id;
struct hns3_mac mac;
unsigned int secondary_cnt; /* Number of secondary processes init'd. */
struct hns3_tqp_stats tqp_stats;
/* Include Mac stats | Rx stats | Tx stats */
struct hns3_mac_stats mac_stats;
uint32_t fw_version;

uint16_t num_msi;
Expand Down
8 changes: 8 additions & 0 deletions drivers/net/hns3/hns3_ethdev_vf.c
Expand Up @@ -952,6 +952,7 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev)

hns3_set_default_rss_args(hw);

(void)hns3_stats_reset(eth_dev);
return 0;

err_get_config:
Expand Down Expand Up @@ -1123,6 +1124,13 @@ static const struct eth_dev_ops hns3vf_eth_dev_ops = {
.dev_stop = hns3vf_dev_stop,
.dev_close = hns3vf_dev_close,
.mtu_set = hns3vf_dev_mtu_set,
.stats_get = hns3_stats_get,
.stats_reset = hns3_stats_reset,
.xstats_get = hns3_dev_xstats_get,
.xstats_get_names = hns3_dev_xstats_get_names,
.xstats_reset = hns3_dev_xstats_reset,
.xstats_get_by_id = hns3_dev_xstats_get_by_id,
.xstats_get_names_by_id = hns3_dev_xstats_get_names_by_id,
.dev_infos_get = hns3vf_dev_infos_get,
.rx_queue_setup = hns3_rx_queue_setup,
.tx_queue_setup = hns3_tx_queue_setup,
Expand Down

0 comments on commit 8839c5e

Please sign in to comment.