Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'mlx5e-support-recovery-counter-in-reset'

Tariq Toukan says:

====================
mlx5e: Support recovery counter in reset

This series by Yael adds a recovery counter in ethtool, for any recovery
type during port reset cycle.
Series starts with some cleanup and refactoring patches.
New counter is added and exposed to ethtool stats in patch #4.
====================

Link: https://patch.msgid.link/1742112876-2890-1-git-send-email-tariqt@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

+91 -37
+5
Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst
··· 1082 1082 need to replace the cable/transceiver. 1083 1083 - Error 1084 1084 1085 + * - `total_success_recovery_phy` 1086 + - The number of total successful recovery events of any type during 1087 + ports reset cycle. 1088 + - Error 1089 + 1085 1090 * - `rx_out_of_buffer` 1086 1091 - Number of times receive queue had no software buffers allocated for the 1087 1092 adapter's incoming traffic.
+82 -37
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
··· 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) ··· 1250 1243 { "rx_err_lane_3_phy", PPORT_PHY_STATISTICAL_OFF(phy_corrected_bits_lane3) }, 1251 1244 }; 1252 1245 1246 + #define PPORT_PHY_RECOVERY_OFF(c) \ 1247 + MLX5_BYTE_OFF(ppcnt_reg, counter_set.phys_layer_recovery_cntrs.c) 1248 + static const struct counter_desc 1249 + pport_phy_recovery_cntrs_stats_desc[] = { 1250 + { "total_success_recovery_phy", 1251 + PPORT_PHY_RECOVERY_OFF(total_successful_recovery_events) } 1252 + }; 1253 + 1254 + #define NUM_PPORT_PHY_LAYER_COUNTERS \ 1255 + ARRAY_SIZE(pport_phy_layer_cntrs_stats_desc) 1253 1256 #define NUM_PPORT_PHY_STATISTICAL_COUNTERS \ 1254 1257 ARRAY_SIZE(pport_phy_statistical_stats_desc) 1255 1258 #define NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS \ 1256 1259 ARRAY_SIZE(pport_phy_statistical_err_lanes_stats_desc) 1260 + #define NUM_PPORT_PHY_RECOVERY_COUNTERS \ 1261 + ARRAY_SIZE(pport_phy_recovery_cntrs_stats_desc) 1262 + 1263 + #define NUM_PPORT_PHY_STATISTICAL_LOOPBACK_COUNTERS(dev) \ 1264 + (MLX5_CAP_PCAM_FEATURE(dev, ppcnt_statistical_group) ? \ 1265 + NUM_PPORT_PHY_STATISTICAL_COUNTERS : 0) 1266 + #define NUM_PPORT_PHY_STATISTICAL_PER_LANE_LOOPBACK_COUNTERS(dev) \ 1267 + (MLX5_CAP_PCAM_FEATURE(dev, per_lane_error_counters) ? \ 1268 + NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS : 0) 1269 + #define NUM_PPORT_PHY_RECOVERY_LOOPBACK_COUNTERS(dev) \ 1270 + (MLX5_CAP_PCAM_FEATURE(dev, ppcnt_recovery_counters) ? \ 1271 + NUM_PPORT_PHY_RECOVERY_COUNTERS : 0) 1257 1272 1258 1273 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(phy) 1259 1274 { 1260 1275 struct mlx5_core_dev *mdev = priv->mdev; 1261 1276 int num_stats; 1262 1277 1263 - /* "1" for link_down_events special counter */ 1264 - num_stats = 1; 1278 + num_stats = NUM_PPORT_PHY_LAYER_COUNTERS; 1265 1279 1266 - num_stats += MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group) ? 1267 - NUM_PPORT_PHY_STATISTICAL_COUNTERS : 0; 1280 + num_stats += NUM_PPORT_PHY_STATISTICAL_LOOPBACK_COUNTERS(mdev); 1268 1281 1269 - num_stats += MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters) ? 1270 - NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS : 0; 1282 + num_stats += NUM_PPORT_PHY_STATISTICAL_PER_LANE_LOOPBACK_COUNTERS(mdev); 1271 1283 1284 + num_stats += NUM_PPORT_PHY_RECOVERY_LOOPBACK_COUNTERS(mdev); 1272 1285 return num_stats; 1273 1286 } 1274 1287 ··· 1297 1270 struct mlx5_core_dev *mdev = priv->mdev; 1298 1271 int i; 1299 1272 1300 - ethtool_puts(data, "link_down_events_phy"); 1273 + for (i = 0; i < NUM_PPORT_PHY_LAYER_COUNTERS; i++) 1274 + ethtool_puts(data, pport_phy_layer_cntrs_stats_desc[i].format); 1301 1275 1302 - if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group)) 1303 - return; 1304 - 1305 - for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++) 1276 + for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_LOOPBACK_COUNTERS(mdev); i++) 1306 1277 ethtool_puts(data, pport_phy_statistical_stats_desc[i].format); 1307 1278 1308 - if (MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters)) 1309 - for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS; i++) 1310 - ethtool_puts(data, 1311 - pport_phy_statistical_err_lanes_stats_desc[i].format); 1279 + for (i = 0; 1280 + i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_LOOPBACK_COUNTERS(mdev); 1281 + i++) 1282 + ethtool_puts(data, 1283 + pport_phy_statistical_err_lanes_stats_desc[i] 1284 + .format); 1285 + 1286 + for (i = 0; i < NUM_PPORT_PHY_RECOVERY_LOOPBACK_COUNTERS(mdev); i++) 1287 + ethtool_puts(data, 1288 + pport_phy_recovery_cntrs_stats_desc[i].format); 1312 1289 } 1313 1290 1314 1291 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(phy) ··· 1320 1289 struct mlx5_core_dev *mdev = priv->mdev; 1321 1290 int i; 1322 1291 1323 - /* link_down_events_phy has special handling since it is not stored in __be64 format */ 1324 - mlx5e_ethtool_put_stat( 1325 - data, MLX5_GET(ppcnt_reg, priv->stats.pport.phy_counters, 1326 - counter_set.phys_layer_cntrs.link_down_events)); 1292 + for (i = 0; i < NUM_PPORT_PHY_LAYER_COUNTERS; i++) 1293 + mlx5e_ethtool_put_stat( 1294 + data, 1295 + MLX5E_READ_CTR32_BE(&priv->stats.pport 1296 + .phy_counters, 1297 + pport_phy_layer_cntrs_stats_desc, i)); 1327 1298 1328 - if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group)) 1329 - return; 1330 - 1331 - for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++) 1299 + for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_LOOPBACK_COUNTERS(mdev); i++) 1332 1300 mlx5e_ethtool_put_stat( 1333 1301 data, 1334 1302 MLX5E_READ_CTR64_BE( 1335 1303 &priv->stats.pport.phy_statistical_counters, 1336 1304 pport_phy_statistical_stats_desc, i)); 1337 1305 1338 - if (MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters)) 1339 - for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS; i++) 1340 - mlx5e_ethtool_put_stat( 1341 - data, 1342 - MLX5E_READ_CTR64_BE( 1343 - &priv->stats.pport 1344 - .phy_statistical_counters, 1345 - pport_phy_statistical_err_lanes_stats_desc, 1346 - i)); 1306 + for (i = 0; 1307 + i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_LOOPBACK_COUNTERS(mdev); 1308 + i++) 1309 + mlx5e_ethtool_put_stat( 1310 + data, 1311 + MLX5E_READ_CTR64_BE( 1312 + &priv->stats.pport.phy_statistical_counters, 1313 + pport_phy_statistical_err_lanes_stats_desc, i)); 1314 + 1315 + for (i = 0; i < NUM_PPORT_PHY_RECOVERY_LOOPBACK_COUNTERS(mdev); i++) 1316 + mlx5e_ethtool_put_stat( 1317 + data, 1318 + MLX5E_READ_CTR32_BE( 1319 + &priv->stats.pport.phy_recovery_counters, 1320 + pport_phy_recovery_cntrs_stats_desc, i)); 1347 1321 } 1348 1322 1349 1323 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(phy) ··· 1364 1328 MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_COUNTERS_GROUP); 1365 1329 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); 1366 1330 1367 - if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group)) 1368 - return; 1331 + if (MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group)) { 1332 + out = pstats->phy_statistical_counters; 1333 + MLX5_SET(ppcnt_reg, in, grp, 1334 + MLX5_PHYSICAL_LAYER_STATISTICAL_GROUP); 1335 + mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 1336 + 0); 1337 + } 1369 1338 1370 - out = pstats->phy_statistical_counters; 1371 - MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_STATISTICAL_GROUP); 1372 - mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); 1339 + if (MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_recovery_counters)) { 1340 + out = pstats->phy_recovery_counters; 1341 + MLX5_SET(ppcnt_reg, in, grp, 1342 + MLX5_PHYSICAL_LAYER_RECOVERY_GROUP); 1343 + mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 1344 + 0); 1345 + } 1373 1346 } 1374 1347 1375 1348 void mlx5e_get_link_ext_stats(struct net_device *dev,
+4
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
··· 309 309 #define PPORT_PHY_STATISTICAL_GET(pstats, c) \ 310 310 MLX5_GET64(ppcnt_reg, (pstats)->phy_statistical_counters, \ 311 311 counter_set.phys_layer_statistical_cntrs.c##_high) 312 + #define PPORT_PHY_RECOVERY_GET(pstats, c) \ 313 + MLX5_GET64(ppcnt_reg, (pstats)->phy_recovery_counters, \ 314 + counter_set.phys_layer_recovery_cntrs.c) 312 315 #define PPORT_PER_PRIO_GET(pstats, prio, c) \ 313 316 MLX5_GET64(ppcnt_reg, pstats->per_prio_counters[prio], \ 314 317 counter_set.eth_per_prio_grp_data_layout.c##_high) ··· 327 324 __be64 per_prio_counters[NUM_PPORT_PRIO][MLX5_ST_SZ_QW(ppcnt_reg)]; 328 325 __be64 phy_counters[MLX5_ST_SZ_QW(ppcnt_reg)]; 329 326 __be64 phy_statistical_counters[MLX5_ST_SZ_QW(ppcnt_reg)]; 327 + __be64 phy_recovery_counters[MLX5_ST_SZ_QW(ppcnt_reg)]; 330 328 __be64 eth_ext_counters[MLX5_ST_SZ_QW(ppcnt_reg)]; 331 329 __be64 per_tc_prio_counters[NUM_PPORT_PRIO][MLX5_ST_SZ_QW(ppcnt_reg)]; 332 330 __be64 per_tc_congest_prio_counters[NUM_PPORT_PRIO][MLX5_ST_SZ_QW(ppcnt_reg)];