net/mlx5e: Add pcie congestion event extras
Subsystems (6)
Tariq Toukan
maintainercover net/mlx5e: Add pcie congestion event extras
Hi,
This small series by Dragos covers gaps requested in the initial pcie congestion series [1]:
- Make pcie congestion thresholds configurable via devlink.
- Add a counter for stale pcie congestion events.
Regards,
Tariq
[1] https://lore.kernel.org/all/[email protected]/
Dragos Tatulea (2):
net/mlx5e: Make PCIe congestion event thresholds configurable net/mlx5e: Add stale counter for PCIe congestion events
.../ethernet/mellanox/mlx5/counters.rst | 7 +- Documentation/networking/devlink/mlx5.rst | 52 +++++++++ .../net/ethernet/mellanox/mlx5/core/devlink.c | 106 ++++++++++++++++++ .../net/ethernet/mellanox/mlx5/core/devlink.h | 4 + .../mellanox/mlx5/core/en/pcie_cong_event.c | 79 +++++++++++-- 5 files changed, 238 insertions(+), 10 deletions(-)
base-commit: c6142e1913de563ab772f7b0e4ae78d6de9cc5b1
Signature · 1 line
2.31.1
Tariq Toukan
maintainerPATCH 1/2 net/mlx5e: Make PCIe congestion event thresholds configurable
From: Dragos Tatulea <[email protected]>
Add devlink driverinit parameters for configuring the thresholds for PCIe congestion events. These parameters are registered only when the firmware supports this feature.
Update the mlx5 devlink docs as well on these new params.
--- Documentation/networking/devlink/mlx5.rst | 52 +++++++++ .../net/ethernet/mellanox/mlx5/core/devlink.c | 106 ++++++++++++++++++ .../net/ethernet/mellanox/mlx5/core/devlink.h | 4 + .../mellanox/mlx5/core/en/pcie_cong_event.c | 72 ++++++++++-- 4 files changed, 226 insertions(+), 8 deletions(-)
Documentation/networking/devlink/mlx5.rst +52 -0
@@ -116,6 +116,58 @@ parameters. - u32 - driverinit - Control the size (in packets) of the hairpin queues. + * - ``pcie_cong_inbound_high`` + - u16 + - driverinit + - High threshold configuration for PCIe congestion events. The firmware + will send an event once device side inbound PCIe traffic went + above the configured high threshold for a long enough period (at least + 200ms). + + See pci_bw_inbound_high ethtool stat. + + Units are 0.01 %. Accepted values are in range [0, 10000]. + pcie_cong_inbound_low < pcie_cong_inbound_high. + Default value: 9000 (Corresponds to 90%). + * - ``pcie_cong_inbound_low`` + - u16 + - driverinit + - Low threshold configuration for PCIe congestion events. The firmware + will send an event once device side inbound PCIe traffic went + below the configured low threshold, only after having been previously in + a congested state. + + See pci_bw_inbound_low ethtool stat. + + Units are 0.01 %. Accepted values are in range [0, 10000]. + pcie_cong_inbound_low < pcie_cong_inbound_high. + Default value: 7500. + * - ``pcie_cong_outbound_high`` + - u16 + - driverinit + - High threshold configuration for PCIe congestion events. The firmware + will send an event once device side outbound PCIe traffic went + above the configured high threshold for a long enough period (at least + 200ms). + + See pci_bw_outbound_high ethtool stat. + + Units are 0.01 %. Accepted values are in range [0, 10000]. + pcie_cong_outbound_low < pcie_cong_outbound_high. + Default value: 9000 (Corresponds to 90%). + * - ``pcie_cong_outbound_low`` + - u16 + - driverinit + - Low threshold configuration for PCIe congestion events. The firmware + will send an event once device side outbound PCIe traffic went + below the configured low threshold, only after having been previously in + a congested state. + + See pci_bw_outbound_low ethtool stat. + + Units are 0.01 %. Accepted values are in range [0, 10000]. + pcie_cong_outbound_low < pcie_cong_outbound_high. + Default value: 7500. The ``mlx5`` driver supports reloading via ``DEVLINK_CMD_RELOAD``
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +106 -0
126 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/devlink.h +4 -0
@@ -22,6 +22,10 @@ enum mlx5_devlink_param_id {MLX5_DEVLINK_PARAM_ID_ESW_MULTIPORT ,MLX5_DEVLINK_PARAM_ID_HAIRPIN_NUM_QUEUES ,MLX5_DEVLINK_PARAM_ID_HAIRPIN_QUEUE_SIZE , +MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_LOW , +MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_HIGH , +MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_LOW , + MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_HIGH, }; struct mlx5_trap_ctx {
drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c +64 -8
104 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH net-next 1/2] net/mlx5e: Make PCIe congestion event thresholds configurable
Quoted 10 lines · Tariq Toukan
From: Dragos Tatulea <[email protected]>
Add devlink driverinit parameters for configuring the thresholds for PCIe congestion events. These parameters are registered only when the firmware supports this feature.
Update the mlx5 devlink docs as well on these new params.
Signed-off-by Dragos Tatulea <[email protected]>Signed-off-by Tariq Toukan <[email protected]>
Thanks,
Nice to see devlink coverage growing.
Tariq Toukan
maintainerPATCH 2/2 net/mlx5e: Add stale counter for PCIe congestion events
In reply to Tariq ToukanFrom: Dragos Tatulea <[email protected]>
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.
--- .../device_drivers/ethernet/mellanox/mlx5/counters.rst | 7 ++++++- .../net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-)
Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst +6 -1
@@ -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
drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c +6 -1
@@ -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;
Signature · 1 line
2.31.1
Re: [PATCH net-next 2/2] net/mlx5e: Add stale counter for PCIe congestion events
Quoted 9 lines · Tariq Toukan
From: Dragos Tatulea <[email protected]>
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.
Quoted 5 lines
While at it, do a driveby typo fix in documentation for
pci_bw_inbound_high.Signed-off-by Dragos Tatulea <[email protected]>Signed-off-by Tariq Toukan <[email protected]>
Quoted 24 lines · Tariq Toukan
Hi,
This small series by Dragos covers gaps requested in the initial pcie congestion series [1]:
- Make pcie congestion thresholds configurable via devlink.
- Add a counter for stale pcie congestion events.Regards,
Tariq[1] https://lore.kernel.org/all/[email protected]/
Dragos Tatulea (2):
net/mlx5e: Make PCIe congestion event thresholds configurable net/mlx5e: Add stale counter for PCIe congestion events.../ethernet/mellanox/mlx5/counters.rst | 7 +- Documentation/networking/devlink/mlx5.rst | 52 +++++++++ .../net/ethernet/mellanox/mlx5/core/devlink.c | 106 ++++++++++++++++++ .../net/ethernet/mellanox/mlx5/core/devlink.h | 4 + .../mellanox/mlx5/core/en/pcie_cong_event.c | 79 +++++++++++-- 5 files changed, 238 insertions(+), 10 deletions(-)
Quoted 1 line
base-commit:
c6142e1913de563ab772f7b0e4ae78d6de9cc5b1
This has some trivial devlink conflicts with the other inflight series:
https://lore.kernel.org/all/[email protected]/
Submitted in parallel as no real features dependency or order.
We'll help in resolution if this gets relevant (i.e. in case current version of both series are accepted as-is).
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Sun, 7 Sep 2025 12:39:34 +0300 you wrote:
Hi,
This small series by Dragos covers gaps requested in the initial pcie congestion series [1]:
- Make pcie congestion thresholds configurable via devlink.
- Add a counter for stale pcie congestion events.[...]
Here is the summary with links:
- [net-next,1/2] net/mlx5e: Make PCIe congestion event thresholds configurable
https://git.kernel.org/netdev/net-next/c/f4053490a6f6 - [net-next,2/2] net/mlx5e: Add stale counter for PCIe congestion events https://git.kernel.org/netdev/net-next/c/cdc492746e3f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html