@@ -1257,18 +1257,23 @@ pport_phy_statistical_err_lanes_stats_desc[] = {
1257
1257
#define NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS \
1258
1258
ARRAY_SIZE(pport_phy_statistical_err_lanes_stats_desc)
1259
1259
1260
+ #define NUM_PPORT_PHY_STATISTICAL_LOOPBACK_COUNTERS (dev ) \
1261
+ (MLX5_CAP_PCAM_FEATURE(dev, ppcnt_statistical_group) ? \
1262
+ NUM_PPORT_PHY_STATISTICAL_COUNTERS : 0)
1263
+ #define NUM_PPORT_PHY_STATISTICAL_PER_LANE_LOOPBACK_COUNTERS (dev ) \
1264
+ (MLX5_CAP_PCAM_FEATURE(dev, per_lane_error_counters) ? \
1265
+ NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS : 0)
1266
+
1260
1267
static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS (phy )
1261
1268
{
1262
1269
struct mlx5_core_dev * mdev = priv -> mdev ;
1263
1270
int num_stats ;
1264
1271
1265
1272
num_stats = NUM_PPORT_PHY_LAYER_COUNTERS ;
1266
1273
1267
- num_stats += MLX5_CAP_PCAM_FEATURE (mdev , ppcnt_statistical_group ) ?
1268
- NUM_PPORT_PHY_STATISTICAL_COUNTERS : 0 ;
1274
+ num_stats += NUM_PPORT_PHY_STATISTICAL_LOOPBACK_COUNTERS (mdev );
1269
1275
1270
- num_stats += MLX5_CAP_PCAM_FEATURE (mdev , per_lane_error_counters ) ?
1271
- NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS : 0 ;
1276
+ num_stats += NUM_PPORT_PHY_STATISTICAL_PER_LANE_LOOPBACK_COUNTERS (mdev );
1272
1277
1273
1278
return num_stats ;
1274
1279
}
@@ -1281,14 +1286,15 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(phy)
1281
1286
for (i = 0 ; i < NUM_PPORT_PHY_LAYER_COUNTERS ; i ++ )
1282
1287
ethtool_puts (data , pport_phy_layer_cntrs_stats_desc [i ].format );
1283
1288
1284
- if (MLX5_CAP_PCAM_FEATURE (mdev , ppcnt_statistical_group ))
1285
- for (i = 0 ; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS ; i ++ )
1286
- ethtool_puts (data , pport_phy_statistical_stats_desc [i ].format );
1289
+ for (i = 0 ; i < NUM_PPORT_PHY_STATISTICAL_LOOPBACK_COUNTERS (mdev ); i ++ )
1290
+ ethtool_puts (data , pport_phy_statistical_stats_desc [i ].format );
1287
1291
1288
- if (MLX5_CAP_PCAM_FEATURE (mdev , per_lane_error_counters ))
1289
- for (i = 0 ; i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS ; i ++ )
1290
- ethtool_puts (data ,
1291
- pport_phy_statistical_err_lanes_stats_desc [i ].format );
1292
+ for (i = 0 ;
1293
+ i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_LOOPBACK_COUNTERS (mdev );
1294
+ i ++ )
1295
+ ethtool_puts (data ,
1296
+ pport_phy_statistical_err_lanes_stats_desc [i ]
1297
+ .format );
1292
1298
}
1293
1299
1294
1300
static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS (phy )
@@ -1303,23 +1309,21 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(phy)
1303
1309
.phy_counters ,
1304
1310
pport_phy_layer_cntrs_stats_desc , i ));
1305
1311
1306
- if (MLX5_CAP_PCAM_FEATURE (mdev , ppcnt_statistical_group ))
1307
- for (i = 0 ; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS ; i ++ )
1308
- mlx5e_ethtool_put_stat (
1309
- data ,
1310
- MLX5E_READ_CTR64_BE (
1311
- & priv -> stats .pport .phy_statistical_counters ,
1312
- pport_phy_statistical_stats_desc , i ));
1312
+ for (i = 0 ; i < NUM_PPORT_PHY_STATISTICAL_LOOPBACK_COUNTERS (mdev ); i ++ )
1313
+ mlx5e_ethtool_put_stat (
1314
+ data ,
1315
+ MLX5E_READ_CTR64_BE (
1316
+ & priv -> stats .pport .phy_statistical_counters ,
1317
+ pport_phy_statistical_stats_desc , i ));
1313
1318
1314
- if (MLX5_CAP_PCAM_FEATURE (mdev , per_lane_error_counters ))
1315
- for (i = 0 ; i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS ; i ++ )
1316
- mlx5e_ethtool_put_stat (
1317
- data ,
1318
- MLX5E_READ_CTR64_BE (
1319
- & priv -> stats .pport
1320
- .phy_statistical_counters ,
1321
- pport_phy_statistical_err_lanes_stats_desc ,
1322
- i ));
1319
+ for (i = 0 ;
1320
+ i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_LOOPBACK_COUNTERS (mdev );
1321
+ i ++ )
1322
+ mlx5e_ethtool_put_stat (
1323
+ data ,
1324
+ MLX5E_READ_CTR64_BE (
1325
+ & priv -> stats .pport .phy_statistical_counters ,
1326
+ pport_phy_statistical_err_lanes_stats_desc , i ));
1323
1327
}
1324
1328
1325
1329
static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS (phy )
0 commit comments