]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/mlx5e: Reduce stack use reading PCIe congestion thresholds
authorRatheesh Kannoth <rkannoth@marvell.com>
Thu, 21 May 2026 09:52:56 +0000 (15:22 +0530)
committerJakub Kicinski <kuba@kernel.org>
Mon, 25 May 2026 21:03:06 +0000 (14:03 -0700)
union devlink_param_value grew when U64 array parameters were added.
Keeping union devlink_param_value val[4] in
mlx5e_pcie_cong_get_thresh_config() exceeded the compiler's
-Wframe-larger-than limit.

Reuse one union: call devl_param_driverinit_value_get() once per
MLX5 PCIe congestion threshold and assign each vu16 to the
corresponding mlx5e_pcie_cong_thresh member.

Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
Link: https://patch.msgid.link/20260521095303.2395584-3-rkannoth@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c

index 2eb666a46f399b0b71c85259e11a6644dc0cf306..f4f2ecfc671920c7293191f1da4c4d1c92b03acc 100644 (file)
@@ -252,28 +252,37 @@ static int
 mlx5e_pcie_cong_get_thresh_config(struct mlx5_core_dev *dev,
                                  struct mlx5e_pcie_cong_thresh *config)
 {
-       u32 ids[4] = {
-               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 devlink *devlink = priv_to_devlink(dev);
-       union devlink_param_value val[4];
+       union devlink_param_value val;
+       int err;
 
-       for (int i = 0; i < 4; i++) {
-               u32 id = ids[i];
-               int err;
+       err = devl_param_driverinit_value_get(devlink,
+                                             MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_LOW,
+                                             &val);
+       if (err)
+               return err;
+       config->inbound_low = val.vu16;
 
-               err = devl_param_driverinit_value_get(devlink, id, &val[i]);
-               if (err)
-                       return err;
-       }
+       err = devl_param_driverinit_value_get(devlink,
+                                             MLX5_DEVLINK_PARAM_ID_PCIE_CONG_IN_HIGH,
+                                             &val);
+       if (err)
+               return err;
+       config->inbound_high = val.vu16;
 
-       config->inbound_low = val[0].vu16;
-       config->inbound_high = val[1].vu16;
-       config->outbound_low = val[2].vu16;
-       config->outbound_high = val[3].vu16;
+       err = devl_param_driverinit_value_get(devlink,
+                                             MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_LOW,
+                                             &val);
+       if (err)
+               return err;
+       config->outbound_low = val.vu16;
+
+       err = devl_param_driverinit_value_get(devlink,
+                                             MLX5_DEVLINK_PARAM_ID_PCIE_CONG_OUT_HIGH,
+                                             &val);
+       if (err)
+               return err;
+       config->outbound_high = val.vu16;
 
        return 0;
 }