net/mlx5: Check DTOR entry value is not zero
authorMoshe Shemesh <moshe@nvidia.com>
Wed, 14 Jun 2023 03:47:58 +0000 (06:47 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Fri, 16 Jun 2023 19:02:06 +0000 (12:02 -0700)
The Default Timeout Register (DTOR) provides timeout values to driver
for flows that are device dependent. Zero value for DTOR entry is not
valid and should not be used. In case of reading zero value from DTOR,
the driver should use the hard coded SW default value instead.

Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c

index a87d017..e223e0e 100644 (file)
@@ -119,7 +119,8 @@ u64 _mlx5_tout_ms(struct mlx5_core_dev *dev, enum mlx5_timeouts_types type)
 #define MLX5_TIMEOUT_FILL(fld, reg_out, dev, to_type, to_extra) \
        ({ \
        u64 fw_to = MLX5_TIMEOUT_QUERY(fld, reg_out); \
-       tout_set(dev, fw_to + (to_extra), to_type); \
+       if (fw_to) \
+               tout_set(dev, fw_to + (to_extra), to_type); \
        fw_to; \
        })