Skip to content

Commit dcdf4ce

Browse files
Zhu YanjunSaeed Mahameed
authored andcommitted
net/mlx5e: Get the latest values from counters in switchdev mode
In the switchdev mode, when running "cat /sys/class/net/NIC/statistics/tx_packets", the ppcnt register is accessed to get the latest values. But currently this command can not get the correct values from ppcnt. From firmware manual, before getting the 802_3 counters, the 802_3 data layout should be set to the ppcnt register. When the command "cat /sys/class/net/NIC/statistics/tx_packets" is run, before updating 802_3 data layout with ppcnt register, the monitor counters are tested. The test result will decide the 802_3 data layout is updated or not. Actually the monitor counters do not support to monitor rx/tx stats of 802_3 in switchdev mode. So the rx/tx counters change will not trigger monitor counters. So the 802_3 data layout will not be updated in ppcnt register. Finally this command can not get the latest values from ppcnt register with 802_3 data layout. Fixes: 5c7e8bb ("net/mlx5e: Use monitor counters for update stats") Signed-off-by: Zhu Yanjun <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 96c3415 commit dcdf4ce

File tree

1 file changed

+6
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+6
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3583,7 +3583,12 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
35833583
struct mlx5e_vport_stats *vstats = &priv->stats.vport;
35843584
struct mlx5e_pport_stats *pstats = &priv->stats.pport;
35853585

3586-
if (!mlx5e_monitor_counter_supported(priv)) {
3586+
/* In switchdev mode, monitor counters doesn't monitor
3587+
* rx/tx stats of 802_3. The update stats mechanism
3588+
* should keep the 802_3 layout counters updated
3589+
*/
3590+
if (!mlx5e_monitor_counter_supported(priv) ||
3591+
mlx5e_is_uplink_rep(priv)) {
35873592
/* update HW stats in background for next time */
35883593
mlx5e_queue_update_stats(priv);
35893594
}

0 commit comments

Comments
 (0)