Commit c8af2887 authored by Guangbin Huang's avatar Guangbin Huang Committed by David S. Miller

net: hns3: add support pause/pfc durations for mac statistics

The mac statistics add pause/pfc durations in device version V3, we can
get total active cycle of pause/pfc from these durations.

As driver gets register number from firmware to calculate desc number to
query mac statistics, it needs to set mac statistics extended enable bit
in firmware command 0x701A to tell firmware that driver supports extended
mac statistics, otherwise firmware only returns register number of
version V1.

As pause/pfc durations are not supported by hardware of old version, they
should not been shown in command "ethtool -S ethX" in this case, so add
checking max register number of each mac statistic in their version.
If the max register number of one mac statistic is greater than register
number got from firmware, it means hardware does not support this mac
statistic, so ignore this statistic when get string and data of mac
statistic.
Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4e4c03f6
......@@ -482,6 +482,7 @@ static int hclge_firmware_compat_config(struct hclge_dev *hdev, bool en)
hnae3_set_bit(compat, HCLGE_NCSI_ERROR_REPORT_EN_B, 1);
if (hnae3_dev_phy_imp_supported(hdev))
hnae3_set_bit(compat, HCLGE_PHY_IMP_EN_B, 1);
hnae3_set_bit(compat, HCLGE_MAC_STATS_EXT_EN_B, 1);
req->compat = cpu_to_le32(compat);
}
......
......@@ -1150,6 +1150,7 @@ struct hclge_query_ppu_pf_other_int_dfx_cmd {
#define HCLGE_LINK_EVENT_REPORT_EN_B 0
#define HCLGE_NCSI_ERROR_REPORT_EN_B 1
#define HCLGE_PHY_IMP_EN_B 2
#define HCLGE_MAC_STATS_EXT_EN_B 3
struct hclge_firmware_compat_cmd {
__le32 compat;
u8 rsv[20];
......
......@@ -403,8 +403,13 @@ struct hclge_tm_info {
u8 pfc_en; /* PFC enabled or not for user priority */
};
/* max number of mac statistics on each version */
#define HCLGE_MAC_STATS_MAX_NUM_V1 84
#define HCLGE_MAC_STATS_MAX_NUM_V2 105
struct hclge_comm_stats_str {
char desc[ETH_GSTRING_LEN];
u32 stats_num;
unsigned long offset;
};
......@@ -499,6 +504,28 @@ struct hclge_mac_stats {
u64 mac_rx_pfc_pause_pkt_num;
u64 mac_tx_ctrl_pkt_num;
u64 mac_rx_ctrl_pkt_num;
/* duration of pfc */
u64 mac_tx_pfc_pri0_xoff_time;
u64 mac_tx_pfc_pri1_xoff_time;
u64 mac_tx_pfc_pri2_xoff_time;
u64 mac_tx_pfc_pri3_xoff_time;
u64 mac_tx_pfc_pri4_xoff_time;
u64 mac_tx_pfc_pri5_xoff_time;
u64 mac_tx_pfc_pri6_xoff_time;
u64 mac_tx_pfc_pri7_xoff_time;
u64 mac_rx_pfc_pri0_xoff_time;
u64 mac_rx_pfc_pri1_xoff_time;
u64 mac_rx_pfc_pri2_xoff_time;
u64 mac_rx_pfc_pri3_xoff_time;
u64 mac_rx_pfc_pri4_xoff_time;
u64 mac_rx_pfc_pri5_xoff_time;
u64 mac_rx_pfc_pri6_xoff_time;
u64 mac_rx_pfc_pri7_xoff_time;
/* duration of pause */
u64 mac_tx_pause_xoff_time;
u64 mac_rx_pause_xoff_time;
};
#define HCLGE_STATS_TIMER_INTERVAL 300UL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment