|
|
|
@ -156,174 +156,210 @@ static const char hns3_nic_test_strs[][ETH_GSTRING_LEN] = {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const struct hclge_comm_stats_str g_mac_stats_string[] = {
|
|
|
|
|
{"mac_tx_mac_pause_num",
|
|
|
|
|
{"mac_tx_mac_pause_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_mac_pause_num)},
|
|
|
|
|
{"mac_rx_mac_pause_num",
|
|
|
|
|
{"mac_rx_mac_pause_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_mac_pause_num)},
|
|
|
|
|
{"mac_tx_control_pkt_num",
|
|
|
|
|
{"mac_tx_pause_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pause_xoff_time)},
|
|
|
|
|
{"mac_rx_pause_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pause_xoff_time)},
|
|
|
|
|
{"mac_tx_control_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_ctrl_pkt_num)},
|
|
|
|
|
{"mac_rx_control_pkt_num",
|
|
|
|
|
{"mac_rx_control_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_ctrl_pkt_num)},
|
|
|
|
|
{"mac_tx_pfc_pkt_num",
|
|
|
|
|
{"mac_tx_pfc_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pause_pkt_num)},
|
|
|
|
|
{"mac_tx_pfc_pri0_pkt_num",
|
|
|
|
|
{"mac_tx_pfc_pri0_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri0_pkt_num)},
|
|
|
|
|
{"mac_tx_pfc_pri1_pkt_num",
|
|
|
|
|
{"mac_tx_pfc_pri1_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri1_pkt_num)},
|
|
|
|
|
{"mac_tx_pfc_pri2_pkt_num",
|
|
|
|
|
{"mac_tx_pfc_pri2_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri2_pkt_num)},
|
|
|
|
|
{"mac_tx_pfc_pri3_pkt_num",
|
|
|
|
|
{"mac_tx_pfc_pri3_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri3_pkt_num)},
|
|
|
|
|
{"mac_tx_pfc_pri4_pkt_num",
|
|
|
|
|
{"mac_tx_pfc_pri4_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri4_pkt_num)},
|
|
|
|
|
{"mac_tx_pfc_pri5_pkt_num",
|
|
|
|
|
{"mac_tx_pfc_pri5_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri5_pkt_num)},
|
|
|
|
|
{"mac_tx_pfc_pri6_pkt_num",
|
|
|
|
|
{"mac_tx_pfc_pri6_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri6_pkt_num)},
|
|
|
|
|
{"mac_tx_pfc_pri7_pkt_num",
|
|
|
|
|
{"mac_tx_pfc_pri7_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri7_pkt_num)},
|
|
|
|
|
{"mac_rx_pfc_pkt_num",
|
|
|
|
|
{"mac_tx_pfc_pri0_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri0_xoff_time)},
|
|
|
|
|
{"mac_tx_pfc_pri1_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri1_xoff_time)},
|
|
|
|
|
{"mac_tx_pfc_pri2_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri2_xoff_time)},
|
|
|
|
|
{"mac_tx_pfc_pri3_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri3_xoff_time)},
|
|
|
|
|
{"mac_tx_pfc_pri4_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri4_xoff_time)},
|
|
|
|
|
{"mac_tx_pfc_pri5_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri5_xoff_time)},
|
|
|
|
|
{"mac_tx_pfc_pri6_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri6_xoff_time)},
|
|
|
|
|
{"mac_tx_pfc_pri7_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_pfc_pri7_xoff_time)},
|
|
|
|
|
{"mac_rx_pfc_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pause_pkt_num)},
|
|
|
|
|
{"mac_rx_pfc_pri0_pkt_num",
|
|
|
|
|
{"mac_rx_pfc_pri0_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri0_pkt_num)},
|
|
|
|
|
{"mac_rx_pfc_pri1_pkt_num",
|
|
|
|
|
{"mac_rx_pfc_pri1_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri1_pkt_num)},
|
|
|
|
|
{"mac_rx_pfc_pri2_pkt_num",
|
|
|
|
|
{"mac_rx_pfc_pri2_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri2_pkt_num)},
|
|
|
|
|
{"mac_rx_pfc_pri3_pkt_num",
|
|
|
|
|
{"mac_rx_pfc_pri3_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri3_pkt_num)},
|
|
|
|
|
{"mac_rx_pfc_pri4_pkt_num",
|
|
|
|
|
{"mac_rx_pfc_pri4_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri4_pkt_num)},
|
|
|
|
|
{"mac_rx_pfc_pri5_pkt_num",
|
|
|
|
|
{"mac_rx_pfc_pri5_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri5_pkt_num)},
|
|
|
|
|
{"mac_rx_pfc_pri6_pkt_num",
|
|
|
|
|
{"mac_rx_pfc_pri6_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri6_pkt_num)},
|
|
|
|
|
{"mac_rx_pfc_pri7_pkt_num",
|
|
|
|
|
{"mac_rx_pfc_pri7_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri7_pkt_num)},
|
|
|
|
|
{"mac_tx_total_pkt_num",
|
|
|
|
|
{"mac_rx_pfc_pri0_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri0_xoff_time)},
|
|
|
|
|
{"mac_rx_pfc_pri1_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri1_xoff_time)},
|
|
|
|
|
{"mac_rx_pfc_pri2_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri2_xoff_time)},
|
|
|
|
|
{"mac_rx_pfc_pri3_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri3_xoff_time)},
|
|
|
|
|
{"mac_rx_pfc_pri4_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri4_xoff_time)},
|
|
|
|
|
{"mac_rx_pfc_pri5_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri5_xoff_time)},
|
|
|
|
|
{"mac_rx_pfc_pri6_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri6_xoff_time)},
|
|
|
|
|
{"mac_rx_pfc_pri7_xoff_time", HCLGE_MAC_STATS_MAX_NUM_V2,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_pfc_pri7_xoff_time)},
|
|
|
|
|
{"mac_tx_total_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_total_pkt_num)},
|
|
|
|
|
{"mac_tx_total_oct_num",
|
|
|
|
|
{"mac_tx_total_oct_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_total_oct_num)},
|
|
|
|
|
{"mac_tx_good_pkt_num",
|
|
|
|
|
{"mac_tx_good_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_good_pkt_num)},
|
|
|
|
|
{"mac_tx_bad_pkt_num",
|
|
|
|
|
{"mac_tx_bad_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_bad_pkt_num)},
|
|
|
|
|
{"mac_tx_good_oct_num",
|
|
|
|
|
{"mac_tx_good_oct_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_good_oct_num)},
|
|
|
|
|
{"mac_tx_bad_oct_num",
|
|
|
|
|
{"mac_tx_bad_oct_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_bad_oct_num)},
|
|
|
|
|
{"mac_tx_uni_pkt_num",
|
|
|
|
|
{"mac_tx_uni_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_uni_pkt_num)},
|
|
|
|
|
{"mac_tx_multi_pkt_num",
|
|
|
|
|
{"mac_tx_multi_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_multi_pkt_num)},
|
|
|
|
|
{"mac_tx_broad_pkt_num",
|
|
|
|
|
{"mac_tx_broad_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_broad_pkt_num)},
|
|
|
|
|
{"mac_tx_undersize_pkt_num",
|
|
|
|
|
{"mac_tx_undersize_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_undersize_pkt_num)},
|
|
|
|
|
{"mac_tx_oversize_pkt_num",
|
|
|
|
|
{"mac_tx_oversize_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_oversize_pkt_num)},
|
|
|
|
|
{"mac_tx_64_oct_pkt_num",
|
|
|
|
|
{"mac_tx_64_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_64_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_65_127_oct_pkt_num",
|
|
|
|
|
{"mac_tx_65_127_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_65_127_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_128_255_oct_pkt_num",
|
|
|
|
|
{"mac_tx_128_255_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_128_255_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_256_511_oct_pkt_num",
|
|
|
|
|
{"mac_tx_256_511_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_256_511_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_512_1023_oct_pkt_num",
|
|
|
|
|
{"mac_tx_512_1023_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_512_1023_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_1024_1518_oct_pkt_num",
|
|
|
|
|
{"mac_tx_1024_1518_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_1024_1518_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_1519_2047_oct_pkt_num",
|
|
|
|
|
{"mac_tx_1519_2047_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_1519_2047_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_2048_4095_oct_pkt_num",
|
|
|
|
|
{"mac_tx_2048_4095_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_2048_4095_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_4096_8191_oct_pkt_num",
|
|
|
|
|
{"mac_tx_4096_8191_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_4096_8191_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_8192_9216_oct_pkt_num",
|
|
|
|
|
{"mac_tx_8192_9216_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_8192_9216_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_9217_12287_oct_pkt_num",
|
|
|
|
|
{"mac_tx_9217_12287_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_9217_12287_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_12288_16383_oct_pkt_num",
|
|
|
|
|
{"mac_tx_12288_16383_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_12288_16383_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_1519_max_good_pkt_num",
|
|
|
|
|
{"mac_tx_1519_max_good_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_1519_max_good_oct_pkt_num)},
|
|
|
|
|
{"mac_tx_1519_max_bad_pkt_num",
|
|
|
|
|
{"mac_tx_1519_max_bad_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_1519_max_bad_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_total_pkt_num",
|
|
|
|
|
{"mac_rx_total_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_total_pkt_num)},
|
|
|
|
|
{"mac_rx_total_oct_num",
|
|
|
|
|
{"mac_rx_total_oct_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_total_oct_num)},
|
|
|
|
|
{"mac_rx_good_pkt_num",
|
|
|
|
|
{"mac_rx_good_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_good_pkt_num)},
|
|
|
|
|
{"mac_rx_bad_pkt_num",
|
|
|
|
|
{"mac_rx_bad_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_bad_pkt_num)},
|
|
|
|
|
{"mac_rx_good_oct_num",
|
|
|
|
|
{"mac_rx_good_oct_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_good_oct_num)},
|
|
|
|
|
{"mac_rx_bad_oct_num",
|
|
|
|
|
{"mac_rx_bad_oct_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_bad_oct_num)},
|
|
|
|
|
{"mac_rx_uni_pkt_num",
|
|
|
|
|
{"mac_rx_uni_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_uni_pkt_num)},
|
|
|
|
|
{"mac_rx_multi_pkt_num",
|
|
|
|
|
{"mac_rx_multi_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_multi_pkt_num)},
|
|
|
|
|
{"mac_rx_broad_pkt_num",
|
|
|
|
|
{"mac_rx_broad_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_broad_pkt_num)},
|
|
|
|
|
{"mac_rx_undersize_pkt_num",
|
|
|
|
|
{"mac_rx_undersize_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_undersize_pkt_num)},
|
|
|
|
|
{"mac_rx_oversize_pkt_num",
|
|
|
|
|
{"mac_rx_oversize_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_oversize_pkt_num)},
|
|
|
|
|
{"mac_rx_64_oct_pkt_num",
|
|
|
|
|
{"mac_rx_64_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_64_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_65_127_oct_pkt_num",
|
|
|
|
|
{"mac_rx_65_127_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_65_127_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_128_255_oct_pkt_num",
|
|
|
|
|
{"mac_rx_128_255_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_128_255_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_256_511_oct_pkt_num",
|
|
|
|
|
{"mac_rx_256_511_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_256_511_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_512_1023_oct_pkt_num",
|
|
|
|
|
{"mac_rx_512_1023_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_512_1023_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_1024_1518_oct_pkt_num",
|
|
|
|
|
{"mac_rx_1024_1518_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_1024_1518_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_1519_2047_oct_pkt_num",
|
|
|
|
|
{"mac_rx_1519_2047_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_1519_2047_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_2048_4095_oct_pkt_num",
|
|
|
|
|
{"mac_rx_2048_4095_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_2048_4095_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_4096_8191_oct_pkt_num",
|
|
|
|
|
{"mac_rx_4096_8191_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_4096_8191_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_8192_9216_oct_pkt_num",
|
|
|
|
|
{"mac_rx_8192_9216_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_8192_9216_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_9217_12287_oct_pkt_num",
|
|
|
|
|
{"mac_rx_9217_12287_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_9217_12287_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_12288_16383_oct_pkt_num",
|
|
|
|
|
{"mac_rx_12288_16383_oct_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_12288_16383_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_1519_max_good_pkt_num",
|
|
|
|
|
{"mac_rx_1519_max_good_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_1519_max_good_oct_pkt_num)},
|
|
|
|
|
{"mac_rx_1519_max_bad_pkt_num",
|
|
|
|
|
{"mac_rx_1519_max_bad_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_1519_max_bad_oct_pkt_num)},
|
|
|
|
|
|
|
|
|
|
{"mac_tx_fragment_pkt_num",
|
|
|
|
|
{"mac_tx_fragment_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_fragment_pkt_num)},
|
|
|
|
|
{"mac_tx_undermin_pkt_num",
|
|
|
|
|
{"mac_tx_undermin_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_undermin_pkt_num)},
|
|
|
|
|
{"mac_tx_jabber_pkt_num",
|
|
|
|
|
{"mac_tx_jabber_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_jabber_pkt_num)},
|
|
|
|
|
{"mac_tx_err_all_pkt_num",
|
|
|
|
|
{"mac_tx_err_all_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_err_all_pkt_num)},
|
|
|
|
|
{"mac_tx_from_app_good_pkt_num",
|
|
|
|
|
{"mac_tx_from_app_good_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_from_app_good_pkt_num)},
|
|
|
|
|
{"mac_tx_from_app_bad_pkt_num",
|
|
|
|
|
{"mac_tx_from_app_bad_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_tx_from_app_bad_pkt_num)},
|
|
|
|
|
{"mac_rx_fragment_pkt_num",
|
|
|
|
|
{"mac_rx_fragment_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_fragment_pkt_num)},
|
|
|
|
|
{"mac_rx_undermin_pkt_num",
|
|
|
|
|
{"mac_rx_undermin_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_undermin_pkt_num)},
|
|
|
|
|
{"mac_rx_jabber_pkt_num",
|
|
|
|
|
{"mac_rx_jabber_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_jabber_pkt_num)},
|
|
|
|
|
{"mac_rx_fcs_err_pkt_num",
|
|
|
|
|
{"mac_rx_fcs_err_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_fcs_err_pkt_num)},
|
|
|
|
|
{"mac_rx_send_app_good_pkt_num",
|
|
|
|
|
{"mac_rx_send_app_good_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_send_app_good_pkt_num)},
|
|
|
|
|
{"mac_rx_send_app_bad_pkt_num",
|
|
|
|
|
{"mac_rx_send_app_bad_pkt_num", HCLGE_MAC_STATS_MAX_NUM_V1,
|
|
|
|
|
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_send_app_bad_pkt_num)}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -451,8 +487,9 @@ static int hclge_mac_update_stats_defective(struct hclge_dev *hdev)
|
|
|
|
|
u64 *data = (u64 *)(&hdev->mac_stats);
|
|
|
|
|
struct hclge_desc desc[HCLGE_MAC_CMD_NUM];
|
|
|
|
|
__le64 *desc_data;
|
|
|
|
|
int i, k, n;
|
|
|
|
|
u32 data_size;
|
|
|
|
|
int ret;
|
|
|
|
|
u32 i;
|
|
|
|
|
|
|
|
|
|
hclge_cmd_setup_basic_desc(&desc[0], HCLGE_OPC_STATS_MAC, true);
|
|
|
|
|
ret = hclge_cmd_send(&hdev->hw, desc, HCLGE_MAC_CMD_NUM);
|
|
|
|
@ -463,33 +500,37 @@ static int hclge_mac_update_stats_defective(struct hclge_dev *hdev)
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < HCLGE_MAC_CMD_NUM; i++) {
|
|
|
|
|
/* for special opcode 0032, only the first desc has the head */
|
|
|
|
|
if (unlikely(i == 0)) {
|
|
|
|
|
desc_data = (__le64 *)(&desc[i].data[0]);
|
|
|
|
|
n = HCLGE_RD_FIRST_STATS_NUM;
|
|
|
|
|
} else {
|
|
|
|
|
desc_data = (__le64 *)(&desc[i]);
|
|
|
|
|
n = HCLGE_RD_OTHER_STATS_NUM;
|
|
|
|
|
}
|
|
|
|
|
/* The first desc has a 64-bit header, so data size need to minus 1 */
|
|
|
|
|
data_size = sizeof(desc) / (sizeof(u64)) - 1;
|
|
|
|
|
|
|
|
|
|
for (k = 0; k < n; k++) {
|
|
|
|
|
*data += le64_to_cpu(*desc_data);
|
|
|
|
|
data++;
|
|
|
|
|
desc_data++;
|
|
|
|
|
}
|
|
|
|
|
desc_data = (__le64 *)(&desc[0].data[0]);
|
|
|
|
|
for (i = 0; i < data_size; i++) {
|
|
|
|
|
/* data memory is continuous becase only the first desc has a
|
|
|
|
|
* header in this command
|
|
|
|
|
*/
|
|
|
|
|
*data += le64_to_cpu(*desc_data);
|
|
|
|
|
data++;
|
|
|
|
|
desc_data++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int hclge_mac_update_stats_complete(struct hclge_dev *hdev, u32 desc_num)
|
|
|
|
|
static int hclge_mac_update_stats_complete(struct hclge_dev *hdev)
|
|
|
|
|
{
|
|
|
|
|
#define HCLGE_REG_NUM_PER_DESC 4
|
|
|
|
|
|
|
|
|
|
u32 reg_num = hdev->ae_dev->dev_specs.mac_stats_num;
|
|
|
|
|
u64 *data = (u64 *)(&hdev->mac_stats);
|
|
|
|
|
struct hclge_desc *desc;
|
|
|
|
|
__le64 *desc_data;
|
|
|
|
|
u16 i, k, n;
|
|
|
|
|
u32 data_size;
|
|
|
|
|
u32 desc_num;
|
|
|
|
|
int ret;
|
|
|
|
|
u32 i;
|
|
|
|
|
|
|
|
|
|
/* The first desc has a 64-bit header, so need to consider it */
|
|
|
|
|
desc_num = reg_num / HCLGE_REG_NUM_PER_DESC + 1;
|
|
|
|
|
|
|
|
|
|
/* This may be called inside atomic sections,
|
|
|
|
|
* so GFP_ATOMIC is more suitalbe here
|
|
|
|
@ -505,21 +546,16 @@ static int hclge_mac_update_stats_complete(struct hclge_dev *hdev, u32 desc_num)
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < desc_num; i++) {
|
|
|
|
|
/* for special opcode 0034, only the first desc has the head */
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
desc_data = (__le64 *)(&desc[i].data[0]);
|
|
|
|
|
n = HCLGE_RD_FIRST_STATS_NUM;
|
|
|
|
|
} else {
|
|
|
|
|
desc_data = (__le64 *)(&desc[i]);
|
|
|
|
|
n = HCLGE_RD_OTHER_STATS_NUM;
|
|
|
|
|
}
|
|
|
|
|
data_size = min_t(u32, sizeof(hdev->mac_stats) / sizeof(u64), reg_num);
|
|
|
|
|
|
|
|
|
|
for (k = 0; k < n; k++) {
|
|
|
|
|
*data += le64_to_cpu(*desc_data);
|
|
|
|
|
data++;
|
|
|
|
|
desc_data++;
|
|
|
|
|
}
|
|
|
|
|
desc_data = (__le64 *)(&desc[0].data[0]);
|
|
|
|
|
for (i = 0; i < data_size; i++) {
|
|
|
|
|
/* data memory is continuous becase only the first desc has a
|
|
|
|
|
* header in this command
|
|
|
|
|
*/
|
|
|
|
|
*data += le64_to_cpu(*desc_data);
|
|
|
|
|
data++;
|
|
|
|
|
desc_data++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
kfree(desc);
|
|
|
|
@ -527,42 +563,37 @@ static int hclge_mac_update_stats_complete(struct hclge_dev *hdev, u32 desc_num)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int hclge_mac_query_reg_num(struct hclge_dev *hdev, u32 *desc_num)
|
|
|
|
|
static int hclge_mac_query_reg_num(struct hclge_dev *hdev, u32 *reg_num)
|
|
|
|
|
{
|
|
|
|
|
struct hclge_desc desc;
|
|
|
|
|
__le32 *desc_data;
|
|
|
|
|
u32 reg_num;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_MAC_REG_NUM, true);
|
|
|
|
|
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
|
|
|
|
|
if (ret)
|
|
|
|
|
if (ret) {
|
|
|
|
|
dev_err(&hdev->pdev->dev,
|
|
|
|
|
"failed to query mac statistic reg number, ret = %d\n",
|
|
|
|
|
ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
desc_data = (__le32 *)(&desc.data[0]);
|
|
|
|
|
reg_num = le32_to_cpu(*desc_data);
|
|
|
|
|
|
|
|
|
|
*desc_num = 1 + ((reg_num - 3) >> 2) +
|
|
|
|
|
(u32)(((reg_num - 3) & 0x3) ? 1 : 0);
|
|
|
|
|
*reg_num = le32_to_cpu(desc.data[0]);
|
|
|
|
|
if (*reg_num == 0) {
|
|
|
|
|
dev_err(&hdev->pdev->dev,
|
|
|
|
|
"mac statistic reg number is invalid!\n");
|
|
|
|
|
return -ENODATA;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int hclge_mac_update_stats(struct hclge_dev *hdev)
|
|
|
|
|
{
|
|
|
|
|
u32 desc_num;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
ret = hclge_mac_query_reg_num(hdev, &desc_num);
|
|
|
|
|
/* The firmware supports the new statistics acquisition method */
|
|
|
|
|
if (!ret)
|
|
|
|
|
ret = hclge_mac_update_stats_complete(hdev, desc_num);
|
|
|
|
|
else if (ret == -EOPNOTSUPP)
|
|
|
|
|
ret = hclge_mac_update_stats_defective(hdev);
|
|
|
|
|
if (hdev->ae_dev->dev_specs.mac_stats_num)
|
|
|
|
|
return hclge_mac_update_stats_complete(hdev);
|
|
|
|
|
else
|
|
|
|
|
dev_err(&hdev->pdev->dev, "query mac reg num fail!\n");
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
return hclge_mac_update_stats_defective(hdev);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int hclge_tqps_update_stats(struct hnae3_handle *handle)
|
|
|
|
@ -670,20 +701,39 @@ static u8 *hclge_tqps_get_strings(struct hnae3_handle *handle, u8 *data)
|
|
|
|
|
return buff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static u64 *hclge_comm_get_stats(const void *comm_stats,
|
|
|
|
|
static int hclge_comm_get_count(struct hclge_dev *hdev,
|
|
|
|
|
const struct hclge_comm_stats_str strs[],
|
|
|
|
|
u32 size)
|
|
|
|
|
{
|
|
|
|
|
int count = 0;
|
|
|
|
|
u32 i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < size; i++)
|
|
|
|
|
if (strs[i].stats_num <= hdev->ae_dev->dev_specs.mac_stats_num)
|
|
|
|
|
count++;
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static u64 *hclge_comm_get_stats(struct hclge_dev *hdev,
|
|
|
|
|
const struct hclge_comm_stats_str strs[],
|
|
|
|
|
int size, u64 *data)
|
|
|
|
|
{
|
|
|
|
|
u64 *buf = data;
|
|
|
|
|
u32 i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < size; i++)
|
|
|
|
|
buf[i] = HCLGE_STATS_READ(comm_stats, strs[i].offset);
|
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
|
if (strs[i].stats_num > hdev->ae_dev->dev_specs.mac_stats_num)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
return buf + size;
|
|
|
|
|
*buf = HCLGE_STATS_READ(&hdev->mac_stats, strs[i].offset);
|
|
|
|
|
buf++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static u8 *hclge_comm_get_strings(u32 stringset,
|
|
|
|
|
static u8 *hclge_comm_get_strings(struct hclge_dev *hdev, u32 stringset,
|
|
|
|
|
const struct hclge_comm_stats_str strs[],
|
|
|
|
|
int size, u8 *data)
|
|
|
|
|
{
|
|
|
|
@ -694,6 +744,9 @@ static u8 *hclge_comm_get_strings(u32 stringset,
|
|
|
|
|
return buff;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
|
if (strs[i].stats_num > hdev->ae_dev->dev_specs.mac_stats_num)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
snprintf(buff, ETH_GSTRING_LEN, "%s", strs[i].desc);
|
|
|
|
|
buff = buff + ETH_GSTRING_LEN;
|
|
|
|
|
}
|
|
|
|
@ -785,7 +838,8 @@ static int hclge_get_sset_count(struct hnae3_handle *handle, int stringset)
|
|
|
|
|
handle->flags |= HNAE3_SUPPORT_PHY_LOOPBACK;
|
|
|
|
|
}
|
|
|
|
|
} else if (stringset == ETH_SS_STATS) {
|
|
|
|
|
count = ARRAY_SIZE(g_mac_stats_string) +
|
|
|
|
|
count = hclge_comm_get_count(hdev, g_mac_stats_string,
|
|
|
|
|
ARRAY_SIZE(g_mac_stats_string)) +
|
|
|
|
|
hclge_tqps_get_sset_count(handle, stringset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -795,12 +849,14 @@ static int hclge_get_sset_count(struct hnae3_handle *handle, int stringset)
|
|
|
|
|
static void hclge_get_strings(struct hnae3_handle *handle, u32 stringset,
|
|
|
|
|
u8 *data)
|
|
|
|
|
{
|
|
|
|
|
struct hclge_vport *vport = hclge_get_vport(handle);
|
|
|
|
|
struct hclge_dev *hdev = vport->back;
|
|
|
|
|
u8 *p = (char *)data;
|
|
|
|
|
int size;
|
|
|
|
|
|
|
|
|
|
if (stringset == ETH_SS_STATS) {
|
|
|
|
|
size = ARRAY_SIZE(g_mac_stats_string);
|
|
|
|
|
p = hclge_comm_get_strings(stringset, g_mac_stats_string,
|
|
|
|
|
p = hclge_comm_get_strings(hdev, stringset, g_mac_stats_string,
|
|
|
|
|
size, p);
|
|
|
|
|
p = hclge_tqps_get_strings(handle, p);
|
|
|
|
|
} else if (stringset == ETH_SS_TEST) {
|
|
|
|
@ -834,7 +890,7 @@ static void hclge_get_stats(struct hnae3_handle *handle, u64 *data)
|
|
|
|
|
struct hclge_dev *hdev = vport->back;
|
|
|
|
|
u64 *p;
|
|
|
|
|
|
|
|
|
|
p = hclge_comm_get_stats(&hdev->mac_stats, g_mac_stats_string,
|
|
|
|
|
p = hclge_comm_get_stats(hdev, g_mac_stats_string,
|
|
|
|
|
ARRAY_SIZE(g_mac_stats_string), data);
|
|
|
|
|
p = hclge_tqps_get_stats(handle, p);
|
|
|
|
|
}
|
|
|
|
@ -1037,96 +1093,100 @@ static int hclge_check_port_speed(struct hnae3_handle *handle, u32 speed)
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hclge_convert_setting_sr(struct hclge_mac *mac, u16 speed_ability)
|
|
|
|
|
static void hclge_convert_setting_sr(u16 speed_ability,
|
|
|
|
|
unsigned long *link_mode)
|
|
|
|
|
{
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_10G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseSR_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_25G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_25000baseSR_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_40G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_50G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_100G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_200G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_200000baseSR4_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hclge_convert_setting_lr(struct hclge_mac *mac, u16 speed_ability)
|
|
|
|
|
static void hclge_convert_setting_lr(u16 speed_ability,
|
|
|
|
|
unsigned long *link_mode)
|
|
|
|
|
{
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_10G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseLR_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_25G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_25000baseSR_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_50G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_40G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_100G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_200G_BIT)
|
|
|
|
|
linkmode_set_bit(
|
|
|
|
|
ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hclge_convert_setting_cr(struct hclge_mac *mac, u16 speed_ability)
|
|
|
|
|
static void hclge_convert_setting_cr(u16 speed_ability,
|
|
|
|
|
unsigned long *link_mode)
|
|
|
|
|
{
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_10G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseCR_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_25G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_25000baseCR_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_40G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_50G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_100G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_200G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hclge_convert_setting_kr(struct hclge_mac *mac, u16 speed_ability)
|
|
|
|
|
static void hclge_convert_setting_kr(u16 speed_ability,
|
|
|
|
|
unsigned long *link_mode)
|
|
|
|
|
{
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_1G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseKX_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_10G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseKR_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_25G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_25000baseKR_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_40G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_50G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_100G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
if (speed_ability & HCLGE_SUPPORT_200G_BIT)
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_200000baseKR4_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
link_mode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hclge_convert_setting_fec(struct hclge_mac *mac)
|
|
|
|
@ -1170,9 +1230,9 @@ static void hclge_parse_fiber_link_mode(struct hclge_dev *hdev,
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
|
|
|
|
|
hclge_convert_setting_sr(mac, speed_ability);
|
|
|
|
|
hclge_convert_setting_lr(mac, speed_ability);
|
|
|
|
|
hclge_convert_setting_cr(mac, speed_ability);
|
|
|
|
|
hclge_convert_setting_sr(speed_ability, mac->supported);
|
|
|
|
|
hclge_convert_setting_lr(speed_ability, mac->supported);
|
|
|
|
|
hclge_convert_setting_cr(speed_ability, mac->supported);
|
|
|
|
|
if (hnae3_dev_fec_supported(hdev))
|
|
|
|
|
hclge_convert_setting_fec(mac);
|
|
|
|
|
|
|
|
|
@ -1188,7 +1248,7 @@ static void hclge_parse_backplane_link_mode(struct hclge_dev *hdev,
|
|
|
|
|
{
|
|
|
|
|
struct hclge_mac *mac = &hdev->hw.mac;
|
|
|
|
|
|
|
|
|
|
hclge_convert_setting_kr(mac, speed_ability);
|
|
|
|
|
hclge_convert_setting_kr(speed_ability, mac->supported);
|
|
|
|
|
if (hnae3_dev_fec_supported(hdev))
|
|
|
|
|
hclge_convert_setting_fec(mac);
|
|
|
|
|
|
|
|
|
@ -1465,12 +1525,29 @@ static void hclge_check_dev_specs(struct hclge_dev *hdev)
|
|
|
|
|
dev_specs->umv_size = HCLGE_DEFAULT_UMV_SPACE_PER_PF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int hclge_query_mac_stats_num(struct hclge_dev *hdev)
|
|
|
|
|
{
|
|
|
|
|
u32 reg_num = 0;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
ret = hclge_mac_query_reg_num(hdev, ®_num);
|
|
|
|
|
if (ret && ret != -EOPNOTSUPP)
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
|
hdev->ae_dev->dev_specs.mac_stats_num = reg_num;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int hclge_query_dev_specs(struct hclge_dev *hdev)
|
|
|
|
|
{
|
|
|
|
|
struct hclge_desc desc[HCLGE_QUERY_DEV_SPECS_BD_NUM];
|
|
|
|
|
int ret;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
ret = hclge_query_mac_stats_num(hdev);
|
|
|
|
|
if (ret)
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
|
/* set default specifications as devices lower than version V3 do not
|
|
|
|
|
* support querying specifications from firmware.
|
|
|
|
|
*/
|
|
|
|
@ -2974,6 +3051,82 @@ static void hclge_update_link_status(struct hclge_dev *hdev)
|
|
|
|
|
clear_bit(HCLGE_STATE_LINK_UPDATING, &hdev->state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hclge_update_speed_advertising(struct hclge_mac *mac)
|
|
|
|
|
{
|
|
|
|
|
u32 speed_ability;
|
|
|
|
|
|
|
|
|
|
if (hclge_get_speed_bit(mac->speed, &speed_ability))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
switch (mac->module_type) {
|
|
|
|
|
case HNAE3_MODULE_TYPE_FIBRE_LR:
|
|
|
|
|
hclge_convert_setting_lr(speed_ability, mac->advertising);
|
|
|
|
|
break;
|
|
|
|
|
case HNAE3_MODULE_TYPE_FIBRE_SR:
|
|
|
|
|
case HNAE3_MODULE_TYPE_AOC:
|
|
|
|
|
hclge_convert_setting_sr(speed_ability, mac->advertising);
|
|
|
|
|
break;
|
|
|
|
|
case HNAE3_MODULE_TYPE_CR:
|
|
|
|
|
hclge_convert_setting_cr(speed_ability, mac->advertising);
|
|
|
|
|
break;
|
|
|
|
|
case HNAE3_MODULE_TYPE_KR:
|
|
|
|
|
hclge_convert_setting_kr(speed_ability, mac->advertising);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hclge_update_fec_advertising(struct hclge_mac *mac)
|
|
|
|
|
{
|
|
|
|
|
if (mac->fec_mode & BIT(HNAE3_FEC_RS))
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_RS_BIT,
|
|
|
|
|
mac->advertising);
|
|
|
|
|
else if (mac->fec_mode & BIT(HNAE3_FEC_BASER))
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_BASER_BIT,
|
|
|
|
|
mac->advertising);
|
|
|
|
|
else
|
|
|
|
|
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_NONE_BIT,
|
|
|
|
|
mac->advertising);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hclge_update_pause_advertising(struct hclge_dev *hdev)
|
|
|
|
|
{
|
|
|
|
|
struct hclge_mac *mac = &hdev->hw.mac;
|
|
|
|
|
bool rx_en, tx_en;
|
|
|
|
|
|
|
|
|
|
switch (hdev->fc_mode_last_time) {
|
|
|
|
|
case HCLGE_FC_RX_PAUSE:
|
|
|
|
|
rx_en = true;
|
|
|
|
|
tx_en = false;
|
|
|
|
|
break;
|
|
|
|
|
case HCLGE_FC_TX_PAUSE:
|
|
|
|
|
rx_en = false;
|
|
|
|
|
tx_en = true;
|
|
|
|
|
break;
|
|
|
|
|
case HCLGE_FC_FULL:
|
|
|
|
|
rx_en = true;
|
|
|
|
|
tx_en = true;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
rx_en = false;
|
|
|
|
|
tx_en = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
linkmode_set_pause(mac->advertising, tx_en, rx_en);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hclge_update_advertising(struct hclge_dev *hdev)
|
|
|
|
|
{
|
|
|
|
|
struct hclge_mac *mac = &hdev->hw.mac;
|
|
|
|
|
|
|
|
|
|
linkmode_zero(mac->advertising);
|
|
|
|
|
hclge_update_speed_advertising(mac);
|
|
|
|
|
hclge_update_fec_advertising(mac);
|
|
|
|
|
hclge_update_pause_advertising(hdev);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hclge_update_port_capability(struct hclge_dev *hdev,
|
|
|
|
|
struct hclge_mac *mac)
|
|
|
|
|
{
|
|
|
|
@ -2996,7 +3149,7 @@ static void hclge_update_port_capability(struct hclge_dev *hdev,
|
|
|
|
|
} else {
|
|
|
|
|
linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
|
|
|
|
|
mac->supported);
|
|
|
|
|
linkmode_zero(mac->advertising);
|
|
|
|
|
hclge_update_advertising(hdev);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|