Commit cdc49274 authored by Dragos Tatulea's avatar Dragos Tatulea Committed by Jakub Kicinski
Browse files

net/mlx5e: Add stale counter for PCIe congestion events



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: default avatarDragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://patch.msgid.link/1757237976-531416-3-git-send-email-tariqt@nvidia.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f4053490
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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
+6 −1
Original line number Diff line number Diff line
@@ -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;