diff mbox series

[net,01/15] net/mlx5: Collect command failures data only for known commands

Message ID 20230523054242.21596-2-saeed@kernel.org (mailing list archive)
State Accepted
Commit 2a0a935fb64ee8af253b9c6133bb6702fb152ac2
Delegated to: Netdev Maintainers
Headers show
Series [net,01/15] net/mlx5: Collect command failures data only for known commands | expand

Checks

Context Check Description
netdev/series_format success Pull request is its own cover letter
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Saeed Mahameed May 23, 2023, 5:42 a.m. UTC
From: Shay Drory <shayd@nvidia.com>

DEVX can issue a general command, which is not used by mlx5 driver.
In case such command is failed, mlx5 is trying to collect the failure
data, However, mlx5 doesn't create a storage for this command, since
mlx5 doesn't use it. This lead to array-index-out-of-bounds error.

Fix it by checking whether the command is known before collecting the
failure data.

Fixes: 34f46ae0d4b3 ("net/mlx5: Add command failures data to debugfs")
Signed-off-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org May 24, 2023, 7:50 a.m. UTC | #1
Hello:

This series was applied to netdev/net.git (main)
by Saeed Mahameed <saeedm@nvidia.com>:

On Mon, 22 May 2023 22:42:28 -0700 you wrote:
> From: Shay Drory <shayd@nvidia.com>
> 
> DEVX can issue a general command, which is not used by mlx5 driver.
> In case such command is failed, mlx5 is trying to collect the failure
> data, However, mlx5 doesn't create a storage for this command, since
> mlx5 doesn't use it. This lead to array-index-out-of-bounds error.
> 
> [...]

Here is the summary with links:
  - [net,01/15] net/mlx5: Collect command failures data only for known commands
    https://git.kernel.org/netdev/net/c/2a0a935fb64e
  - [net,02/15] net/mlx5: Handle pairing of E-switch via uplink un/load APIs
    https://git.kernel.org/netdev/net/c/2be5bd42a5bb
  - [net,03/15] net/mlx5: DR, Fix crc32 calculation to work on big-endian (BE) CPUs
    https://git.kernel.org/netdev/net/c/1e5daf5565b6
  - [net,04/15] net/mlx5: DR, Check force-loopback RC QP capability independently from RoCE
    https://git.kernel.org/netdev/net/c/c7dd225bc224
  - [net,05/15] net/mlx5e: Use correct encap attribute during invalidation
    https://git.kernel.org/netdev/net/c/be071cdb167f
  - [net,06/15] net/mlx5: Fix error message when failing to allocate device memory
    https://git.kernel.org/netdev/net/c/a65735148e03
  - [net,07/15] net/mlx5e: Fix deadlock in tc route query code
    https://git.kernel.org/netdev/net/c/691c041bf208
  - [net,08/15] net/mlx5e: Fix SQ wake logic in ptp napi_poll context
    https://git.kernel.org/netdev/net/c/7aa503801916
  - [net,09/15] net/mlx5e: TC, Fix using eswitch mapping in nic mode
    https://git.kernel.org/netdev/net/c/dfa1e46d6093
  - [net,10/15] net/mlx5: E-switch, Devcom, sync devcom events and devcom comp register
    https://git.kernel.org/netdev/net/c/8c253dfc89ef
  - [net,11/15] net/mlx5: Devcom, fix error flow in mlx5_devcom_register_device
    https://git.kernel.org/netdev/net/c/af87194352ca
  - [net,12/15] net/mlx5: Devcom, serialize devcom registration
    https://git.kernel.org/netdev/net/c/1f893f57a3bf
  - [net,13/15] net/mlx5: Free irqs only on shutdown callback
    https://git.kernel.org/netdev/net/c/9c2d08010963
  - [net,14/15] net/mlx5: Fix irq affinity management
    https://git.kernel.org/netdev/net/c/ef8c063cf88e
  - [net,15/15] net/mlx5: Fix indexing of mlx5_irq
    https://git.kernel.org/netdev/net/c/1da438c0ae02

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index d53de39539a8..d532883b42d7 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -1920,9 +1920,10 @@  static void mlx5_cmd_err_trace(struct mlx5_core_dev *dev, u16 opcode, u16 op_mod
 static void cmd_status_log(struct mlx5_core_dev *dev, u16 opcode, u8 status,
 			   u32 syndrome, int err)
 {
+	const char *namep = mlx5_command_str(opcode);
 	struct mlx5_cmd_stats *stats;
 
-	if (!err)
+	if (!err || !(strcmp(namep, "unknown command opcode")))
 		return;
 
 	stats = &dev->cmd.stats[opcode];