diff options
author | Inbar Karmy <inbark@mellanox.com> | 2017-08-17 09:39:47 -0400 |
---|---|---|
committer | Saeed Mahameed <saeedm@mellanox.com> | 2018-03-26 16:42:19 -0400 |
commit | 2fcb12df7d2fa5a004fc3e7f589e58a08f7ed8c9 (patch) | |
tree | b5a9535c2a3e90e28f2faf76ce7dda9dcd982895 | |
parent | 336f2c038da1b7f3faf098f2f61bca51e19089ad (diff) |
net/mlx5e: Expose PFC stall prevention counters
Add the needed capability bit and counters to device spec description.
Expose the following two counters in ethtool:
tx_pause_storm_warning_events: when the device is stalled for a period
longer than a pre-configured watermark, the counter increase, allowing
the debug utility an insight into current device status.
tx_pause_storm_error_events: when the device is stalled for a period
longer than a pre-configured timeout, the pause transmission is disabled,
and the counter increase.
Signed-off-by: Inbar Karmy <inbark@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 19 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/fw.c | 3 | ||||
-rw-r--r-- | include/linux/mlx5/device.h | 4 | ||||
-rw-r--r-- | include/linux/mlx5/mlx5_ifc.h | 28 |
4 files changed, 50 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c index 5f0f3493d747..2553c58dcf1c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | |||
@@ -754,7 +754,15 @@ static const struct counter_desc pport_per_prio_pfc_stats_desc[] = { | |||
754 | { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) }, | 754 | { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) }, |
755 | }; | 755 | }; |
756 | 756 | ||
757 | static const struct counter_desc pport_pfc_stall_stats_desc[] = { | ||
758 | { "tx_pause_storm_warning_events ", PPORT_PER_PRIO_OFF(device_stall_minor_watermark_cnt) }, | ||
759 | { "tx_pause_storm_error_events", PPORT_PER_PRIO_OFF(device_stall_critical_watermark_cnt) }, | ||
760 | }; | ||
761 | |||
757 | #define NUM_PPORT_PER_PRIO_PFC_COUNTERS ARRAY_SIZE(pport_per_prio_pfc_stats_desc) | 762 | #define NUM_PPORT_PER_PRIO_PFC_COUNTERS ARRAY_SIZE(pport_per_prio_pfc_stats_desc) |
763 | #define NUM_PPORT_PFC_STALL_COUNTERS(priv) (ARRAY_SIZE(pport_pfc_stall_stats_desc) * \ | ||
764 | MLX5_CAP_PCAM_FEATURE((priv)->mdev, pfcc_mask) * \ | ||
765 | MLX5_CAP_DEBUG((priv)->mdev, stall_detect)) | ||
758 | 766 | ||
759 | static unsigned long mlx5e_query_pfc_combined(struct mlx5e_priv *priv) | 767 | static unsigned long mlx5e_query_pfc_combined(struct mlx5e_priv *priv) |
760 | { | 768 | { |
@@ -790,7 +798,8 @@ static int mlx5e_grp_per_prio_pfc_get_num_stats(struct mlx5e_priv *priv) | |||
790 | { | 798 | { |
791 | return (mlx5e_query_global_pause_combined(priv) + | 799 | return (mlx5e_query_global_pause_combined(priv) + |
792 | hweight8(mlx5e_query_pfc_combined(priv))) * | 800 | hweight8(mlx5e_query_pfc_combined(priv))) * |
793 | NUM_PPORT_PER_PRIO_PFC_COUNTERS; | 801 | NUM_PPORT_PER_PRIO_PFC_COUNTERS + |
802 | NUM_PPORT_PFC_STALL_COUNTERS(priv); | ||
794 | } | 803 | } |
795 | 804 | ||
796 | static int mlx5e_grp_per_prio_pfc_fill_strings(struct mlx5e_priv *priv, | 805 | static int mlx5e_grp_per_prio_pfc_fill_strings(struct mlx5e_priv *priv, |
@@ -818,6 +827,10 @@ static int mlx5e_grp_per_prio_pfc_fill_strings(struct mlx5e_priv *priv, | |||
818 | } | 827 | } |
819 | } | 828 | } |
820 | 829 | ||
830 | for (i = 0; i < NUM_PPORT_PFC_STALL_COUNTERS(priv); i++) | ||
831 | strcpy(data + (idx++) * ETH_GSTRING_LEN, | ||
832 | pport_pfc_stall_stats_desc[i].format); | ||
833 | |||
821 | return idx; | 834 | return idx; |
822 | } | 835 | } |
823 | 836 | ||
@@ -845,6 +858,10 @@ static int mlx5e_grp_per_prio_pfc_fill_stats(struct mlx5e_priv *priv, | |||
845 | } | 858 | } |
846 | } | 859 | } |
847 | 860 | ||
861 | for (i = 0; i < NUM_PPORT_PFC_STALL_COUNTERS(priv); i++) | ||
862 | data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[0], | ||
863 | pport_pfc_stall_stats_desc, i); | ||
864 | |||
848 | return idx; | 865 | return idx; |
849 | } | 866 | } |
850 | 867 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw.c b/drivers/net/ethernet/mellanox/mlx5/core/fw.c index 9d11e92fb541..d7bb10ab2173 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fw.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fw.c | |||
@@ -183,6 +183,9 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev) | |||
183 | return err; | 183 | return err; |
184 | } | 184 | } |
185 | 185 | ||
186 | if (MLX5_CAP_GEN(dev, debug)) | ||
187 | mlx5_core_get_caps(dev, MLX5_CAP_DEBUG); | ||
188 | |||
186 | if (MLX5_CAP_GEN(dev, pcam_reg)) | 189 | if (MLX5_CAP_GEN(dev, pcam_reg)) |
187 | mlx5_get_pcam_reg(dev); | 190 | mlx5_get_pcam_reg(dev); |
188 | 191 | ||
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index e5258ee4e38b..4b5939c78cdd 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
@@ -1013,6 +1013,7 @@ enum mlx5_cap_type { | |||
1013 | MLX5_CAP_RESERVED, | 1013 | MLX5_CAP_RESERVED, |
1014 | MLX5_CAP_VECTOR_CALC, | 1014 | MLX5_CAP_VECTOR_CALC, |
1015 | MLX5_CAP_QOS, | 1015 | MLX5_CAP_QOS, |
1016 | MLX5_CAP_DEBUG, | ||
1016 | /* NUM OF CAP Types */ | 1017 | /* NUM OF CAP Types */ |
1017 | MLX5_CAP_NUM | 1018 | MLX5_CAP_NUM |
1018 | }; | 1019 | }; |
@@ -1140,6 +1141,9 @@ enum mlx5_qcam_feature_groups { | |||
1140 | #define MLX5_CAP_QOS(mdev, cap)\ | 1141 | #define MLX5_CAP_QOS(mdev, cap)\ |
1141 | MLX5_GET(qos_cap, mdev->caps.hca_cur[MLX5_CAP_QOS], cap) | 1142 | MLX5_GET(qos_cap, mdev->caps.hca_cur[MLX5_CAP_QOS], cap) |
1142 | 1143 | ||
1144 | #define MLX5_CAP_DEBUG(mdev, cap)\ | ||
1145 | MLX5_GET(debug_cap, mdev->caps.hca_cur[MLX5_CAP_DEBUG], cap) | ||
1146 | |||
1143 | #define MLX5_CAP_PCAM_FEATURE(mdev, fld) \ | 1147 | #define MLX5_CAP_PCAM_FEATURE(mdev, fld) \ |
1144 | MLX5_GET(pcam_reg, (mdev)->caps.pcam, feature_cap_mask.enhanced_features.fld) | 1148 | MLX5_GET(pcam_reg, (mdev)->caps.pcam, feature_cap_mask.enhanced_features.fld) |
1145 | 1149 | ||
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 14ad84afe8ba..c7d50eccff9e 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h | |||
@@ -593,6 +593,16 @@ struct mlx5_ifc_qos_cap_bits { | |||
593 | u8 reserved_at_100[0x700]; | 593 | u8 reserved_at_100[0x700]; |
594 | }; | 594 | }; |
595 | 595 | ||
596 | struct mlx5_ifc_debug_cap_bits { | ||
597 | u8 reserved_at_0[0x20]; | ||
598 | |||
599 | u8 reserved_at_20[0x2]; | ||
600 | u8 stall_detect[0x1]; | ||
601 | u8 reserved_at_23[0x1d]; | ||
602 | |||
603 | u8 reserved_at_40[0x7c0]; | ||
604 | }; | ||
605 | |||
596 | struct mlx5_ifc_per_protocol_networking_offload_caps_bits { | 606 | struct mlx5_ifc_per_protocol_networking_offload_caps_bits { |
597 | u8 csum_cap[0x1]; | 607 | u8 csum_cap[0x1]; |
598 | u8 vlan_cap[0x1]; | 608 | u8 vlan_cap[0x1]; |
@@ -855,7 +865,7 @@ struct mlx5_ifc_cmd_hca_cap_bits { | |||
855 | u8 out_of_seq_cnt[0x1]; | 865 | u8 out_of_seq_cnt[0x1]; |
856 | u8 vport_counters[0x1]; | 866 | u8 vport_counters[0x1]; |
857 | u8 retransmission_q_counters[0x1]; | 867 | u8 retransmission_q_counters[0x1]; |
858 | u8 reserved_at_183[0x1]; | 868 | u8 debug[0x1]; |
859 | u8 modify_rq_counter_set_id[0x1]; | 869 | u8 modify_rq_counter_set_id[0x1]; |
860 | u8 rq_delay_drop[0x1]; | 870 | u8 rq_delay_drop[0x1]; |
861 | u8 max_qp_cnt[0xa]; | 871 | u8 max_qp_cnt[0xa]; |
@@ -1572,7 +1582,17 @@ struct mlx5_ifc_eth_per_prio_grp_data_layout_bits { | |||
1572 | 1582 | ||
1573 | u8 rx_pause_transition_low[0x20]; | 1583 | u8 rx_pause_transition_low[0x20]; |
1574 | 1584 | ||
1575 | u8 reserved_at_3c0[0x400]; | 1585 | u8 reserved_at_3c0[0x40]; |
1586 | |||
1587 | u8 device_stall_minor_watermark_cnt_high[0x20]; | ||
1588 | |||
1589 | u8 device_stall_minor_watermark_cnt_low[0x20]; | ||
1590 | |||
1591 | u8 device_stall_critical_watermark_cnt_high[0x20]; | ||
1592 | |||
1593 | u8 device_stall_critical_watermark_cnt_low[0x20]; | ||
1594 | |||
1595 | u8 reserved_at_480[0x340]; | ||
1576 | }; | 1596 | }; |
1577 | 1597 | ||
1578 | struct mlx5_ifc_eth_extended_cntrs_grp_data_layout_bits { | 1598 | struct mlx5_ifc_eth_extended_cntrs_grp_data_layout_bits { |
@@ -7874,8 +7894,10 @@ struct mlx5_ifc_peir_reg_bits { | |||
7874 | }; | 7894 | }; |
7875 | 7895 | ||
7876 | struct mlx5_ifc_pcam_enhanced_features_bits { | 7896 | struct mlx5_ifc_pcam_enhanced_features_bits { |
7877 | u8 reserved_at_0[0x7b]; | 7897 | u8 reserved_at_0[0x76]; |
7878 | 7898 | ||
7899 | u8 pfcc_mask[0x1]; | ||
7900 | u8 reserved_at_77[0x4]; | ||
7879 | u8 rx_buffer_fullness_counters[0x1]; | 7901 | u8 rx_buffer_fullness_counters[0x1]; |
7880 | u8 ptys_connector_type[0x1]; | 7902 | u8 ptys_connector_type[0x1]; |
7881 | u8 reserved_at_7d[0x1]; | 7903 | u8 reserved_at_7d[0x1]; |