@@ -1227,6 +1227,13 @@ void mlx5e_stats_ts_get(struct mlx5e_priv *priv,
1227
1227
mutex_unlock (& priv -> state_lock );
1228
1228
}
1229
1229
1230
+ #define PPORT_PHY_LAYER_OFF (c ) \
1231
+ MLX5_BYTE_OFF(ppcnt_reg, \
1232
+ counter_set.phys_layer_cntrs.c)
1233
+ static const struct counter_desc pport_phy_layer_cntrs_stats_desc [] = {
1234
+ { "link_down_events_phy" , PPORT_PHY_LAYER_OFF (link_down_events ) }
1235
+ };
1236
+
1230
1237
#define PPORT_PHY_STATISTICAL_OFF (c ) \
1231
1238
MLX5_BYTE_OFF(ppcnt_reg, \
1232
1239
counter_set.phys_layer_statistical_cntrs.c##_high)
@@ -1243,6 +1250,8 @@ pport_phy_statistical_err_lanes_stats_desc[] = {
1243
1250
{ "rx_err_lane_3_phy" , PPORT_PHY_STATISTICAL_OFF (phy_corrected_bits_lane3 ) },
1244
1251
};
1245
1252
1253
+ #define NUM_PPORT_PHY_LAYER_COUNTERS \
1254
+ ARRAY_SIZE(pport_phy_layer_cntrs_stats_desc)
1246
1255
#define NUM_PPORT_PHY_STATISTICAL_COUNTERS \
1247
1256
ARRAY_SIZE(pport_phy_statistical_stats_desc)
1248
1257
#define NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS \
@@ -1253,8 +1262,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(phy)
1253
1262
struct mlx5_core_dev * mdev = priv -> mdev ;
1254
1263
int num_stats ;
1255
1264
1256
- /* "1" for link_down_events special counter */
1257
- num_stats = 1 ;
1265
+ num_stats = NUM_PPORT_PHY_LAYER_COUNTERS ;
1258
1266
1259
1267
num_stats += MLX5_CAP_PCAM_FEATURE (mdev , ppcnt_statistical_group ) ?
1260
1268
NUM_PPORT_PHY_STATISTICAL_COUNTERS : 0 ;
@@ -1270,7 +1278,8 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(phy)
1270
1278
struct mlx5_core_dev * mdev = priv -> mdev ;
1271
1279
int i ;
1272
1280
1273
- ethtool_puts (data , "link_down_events_phy" );
1281
+ for (i = 0 ; i < NUM_PPORT_PHY_LAYER_COUNTERS ; i ++ )
1282
+ ethtool_puts (data , pport_phy_layer_cntrs_stats_desc [i ].format );
1274
1283
1275
1284
if (MLX5_CAP_PCAM_FEATURE (mdev , ppcnt_statistical_group ))
1276
1285
for (i = 0 ; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS ; i ++ )
@@ -1287,10 +1296,12 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(phy)
1287
1296
struct mlx5_core_dev * mdev = priv -> mdev ;
1288
1297
int i ;
1289
1298
1290
- /* link_down_events_phy has special handling since it is not stored in __be64 format */
1291
- mlx5e_ethtool_put_stat (
1292
- data , MLX5_GET (ppcnt_reg , priv -> stats .pport .phy_counters ,
1293
- counter_set .phys_layer_cntrs .link_down_events ));
1299
+ for (i = 0 ; i < NUM_PPORT_PHY_LAYER_COUNTERS ; i ++ )
1300
+ mlx5e_ethtool_put_stat (
1301
+ data ,
1302
+ MLX5E_READ_CTR32_BE (& priv -> stats .pport
1303
+ .phy_counters ,
1304
+ pport_phy_layer_cntrs_stats_desc , i ));
1294
1305
1295
1306
if (MLX5_CAP_PCAM_FEATURE (mdev , ppcnt_statistical_group ))
1296
1307
for (i = 0 ; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS ; i ++ )
0 commit comments