]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/mlx5e: Add stale counter for PCIe congestion events
authorDragos Tatulea <dtatulea@nvidia.com>
Sun, 7 Sep 2025 09:39:36 +0000 (12:39 +0300)
committerJakub Kicinski <kuba@kernel.org>
Wed, 10 Sep 2025 02:21:30 +0000 (19:21 -0700)
This ethtool counter is meant to help with observing how many times the
congestion event was triggered but on query there was no state change.

This would help to indicate when a work item was scheduled to run too
late and in the meantime the congestion state changed back to previous
state.

While at it, do a driveby typo fix in documentation for
pci_bw_inbound_high.

Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/1757237976-531416-3-git-send-email-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst
drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c

index 754c8143640854f661361e631d042b712bf52247..cc498895f92e1d4952296310045caec9e9f93bd0 100644 (file)
@@ -1348,7 +1348,7 @@ Device Counters
        is in a congested state.
        If pci_bw_inbound_high == pci_bw_inbound_low then the device is not congested.
        If pci_bw_inbound_high > pci_bw_inbound_low then the device is congested.
-     - Tnformative
+     - Informative
 
    * - `pci_bw_inbound_low`
      - The number of times the device crossed the low inbound PCIe bandwidth
@@ -1373,3 +1373,8 @@ Device Counters
        If pci_bw_outbound_high == pci_bw_outbound_low then the device is not congested.
        If pci_bw_outbound_high > pci_bw_outbound_low then the device is congested.
      - Informative
+
+   * - `pci_bw_stale_event`
+     - The number of times the device fired a PCIe congestion event but on query
+       there was no change in state.
+     - Informative
index 0cf142f71c094646b80a95c10bf595962ff582d3..2eb666a46f399b0b71c85259e11a6644dc0cf306 100644 (file)
@@ -24,6 +24,7 @@ struct mlx5e_pcie_cong_stats {
        u32 pci_bw_inbound_low;
        u32 pci_bw_outbound_high;
        u32 pci_bw_outbound_low;
+       u32 pci_bw_stale_event;
 };
 
 struct mlx5e_pcie_cong_event {
@@ -52,6 +53,8 @@ static const struct counter_desc mlx5e_pcie_cong_stats_desc[] = {
                             pci_bw_outbound_high) },
        { MLX5E_DECLARE_STAT(struct mlx5e_pcie_cong_stats,
                             pci_bw_outbound_low) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_pcie_cong_stats,
+                            pci_bw_stale_event) },
 };
 
 #define NUM_PCIE_CONG_COUNTERS ARRAY_SIZE(mlx5e_pcie_cong_stats_desc)
@@ -212,8 +215,10 @@ static void mlx5e_pcie_cong_event_work(struct work_struct *work)
        }
 
        changes = cong_event->state ^ new_cong_state;
-       if (!changes)
+       if (!changes) {
+               cong_event->stats.pci_bw_stale_event++;
                return;
+       }
 
        cong_event->state = new_cong_state;