From: Carolina Jubran <cjubran@nvidia.com>
Enhance error messages in MLX5 QoS scheduling depth validation by
including the actual values that caused the validation to fail.
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
index 5f2d6c35f1ad..8574eb96f606 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
@@ -971,8 +971,9 @@ esw_qos_vport_tc_enable(struct mlx5_vport *vport, enum sched_node_type type,
max_level = 1 << MLX5_CAP_QOS(vport_node->esw->dev,
log_esw_max_sched_depth);
if (new_level > max_level) {
- NL_SET_ERR_MSG_MOD(extack,
- "TC arbitration on leafs is not supported beyond max scheduling depth");
+ NL_SET_ERR_MSG_FMT_MOD(extack,
+ "TC arbitration on leafs is not supported beyond max scheduling depth %d",
+ max_level);
return -EOPNOTSUPP;
}
}
@@ -1444,8 +1445,9 @@ static int esw_qos_node_enable_tc_arbitration(struct mlx5_esw_sched_node *node,
new_level = node->level + 1;
max_level = 1 << MLX5_CAP_QOS(node->esw->dev, log_esw_max_sched_depth);
if (new_level > max_level) {
- NL_SET_ERR_MSG_MOD(extack,
- "TC arbitration on nodes is not supported beyond max scheduling depth");
+ NL_SET_ERR_MSG_FMT_MOD(extack,
+ "TC arbitration on nodes is not supported beyond max scheduling depth %d",
+ max_level);
return -EOPNOTSUPP;
}
@@ -1997,8 +1999,9 @@ mlx5_esw_qos_node_validate_set_parent(struct mlx5_esw_sched_node *node,
max_level = 1 << MLX5_CAP_QOS(node->esw->dev, log_esw_max_sched_depth);
if (new_level > max_level) {
- NL_SET_ERR_MSG_MOD(extack,
- "Node hierarchy depth exceeds the maximum supported level");
+ NL_SET_ERR_MSG_FMT_MOD(extack,
+ "Node hierarchy depth %d exceeds the maximum supported level %d",
+ new_level, max_level);
return -EOPNOTSUPP;
}
--
2.31.1
Hi Tariq, kernel test robot noticed the following build warnings: [auto build test WARNING on 312e6f7676e63bbb9b81e5c68e580a9f776cc6f0] url: https://github.com/intel-lab-lkp/linux/commits/Tariq-Toukan/net-mlx5-HWS-Generalize-complex-matchers/20250922-170716 base: 312e6f7676e63bbb9b81e5c68e580a9f776cc6f0 patch link: https://lore.kernel.org/r/1758531671-819655-4-git-send-email-tariqt%40nvidia.com patch subject: [PATCH net-next 3/7] net/mlx5: Improve QoS error messages with actual depth values config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20250923/202509230959.thBtcZnc-lkp@intel.com/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) rustc: rustc 1.88.0 (6b00bc388 2025-06-23) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250923/202509230959.thBtcZnc-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202509230959.thBtcZnc-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c:974:4: warning: 'snprintf' will always be truncated; specified size is 80, but format string expands to at least 82 [-Wformat-truncation] 974 | NL_SET_ERR_MSG_FMT_MOD(extack, | ^ include/linux/netlink.h:131:2: note: expanded from macro 'NL_SET_ERR_MSG_FMT_MOD' 131 | NL_SET_ERR_MSG_FMT((extack), KBUILD_MODNAME ": " fmt, ##args) | ^ include/linux/netlink.h:116:6: note: expanded from macro 'NL_SET_ERR_MSG_FMT' 116 | if (snprintf(__extack->_msg_buf, NETLINK_MAX_FMTMSG_LEN, \ | ^ drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c:1448:3: warning: 'snprintf' will always be truncated; specified size is 80, but format string expands to at least 82 [-Wformat-truncation] 1448 | NL_SET_ERR_MSG_FMT_MOD(extack, | ^ include/linux/netlink.h:131:2: note: expanded from macro 'NL_SET_ERR_MSG_FMT_MOD' 131 | NL_SET_ERR_MSG_FMT((extack), KBUILD_MODNAME ": " fmt, ##args) | ^ include/linux/netlink.h:116:6: note: expanded from macro 'NL_SET_ERR_MSG_FMT' 116 | if (snprintf(__extack->_msg_buf, NETLINK_MAX_FMTMSG_LEN, \ | ^ 2 warnings generated. vim +/snprintf +974 drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c 955 956 static int 957 esw_qos_vport_tc_enable(struct mlx5_vport *vport, enum sched_node_type type, 958 struct netlink_ext_ack *extack) 959 { 960 struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node; 961 struct mlx5_esw_sched_node *parent = vport_node->parent; 962 int err; 963 964 if (type == SCHED_NODE_TYPE_TC_ARBITER_TSAR) { 965 int new_level, max_level; 966 967 /* Increase the parent's level by 2 to account for both the 968 * TC arbiter and the vports TC scheduling element. 969 */ 970 new_level = (parent ? parent->level : 2) + 2; 971 max_level = 1 << MLX5_CAP_QOS(vport_node->esw->dev, 972 log_esw_max_sched_depth); 973 if (new_level > max_level) { > 974 NL_SET_ERR_MSG_FMT_MOD(extack, 975 "TC arbitration on leafs is not supported beyond max scheduling depth %d", 976 max_level); 977 return -EOPNOTSUPP; 978 } 979 } 980 981 esw_assert_qos_lock_held(vport->dev->priv.eswitch); 982 983 if (type == SCHED_NODE_TYPE_RATE_LIMITER) 984 err = esw_qos_create_rate_limit_element(vport_node, extack); 985 else 986 err = esw_qos_tc_arbiter_scheduling_setup(vport_node, extack); 987 if (err) 988 return err; 989 990 /* Rate limiters impact multiple nodes not directly connected to them 991 * and are not direct members of the QoS hierarchy. 992 * Unlink it from the parent to reflect that. 993 */ 994 if (type == SCHED_NODE_TYPE_RATE_LIMITER) { 995 list_del_init(&vport_node->entry); 996 vport_node->level = 0; 997 } 998 999 err = esw_qos_create_vport_tc_sched_elements(vport, type, extack); 1000 if (err) 1001 goto err_sched_nodes; 1002 1003 return 0; 1004 1005 err_sched_nodes: 1006 if (type == SCHED_NODE_TYPE_RATE_LIMITER) { 1007 esw_qos_node_destroy_sched_element(vport_node, NULL); 1008 esw_qos_node_attach_to_parent(vport_node); 1009 } else { 1010 esw_qos_tc_arbiter_scheduling_teardown(vport_node, NULL); 1011 } 1012 return err; 1013 } 1014 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
On Mon, 22 Sep 2025 12:01:07 +0300 Tariq Toukan wrote: > if (new_level > max_level) { > - NL_SET_ERR_MSG_MOD(extack, > - "TC arbitration on leafs is not supported beyond max scheduling depth"); > + NL_SET_ERR_MSG_FMT_MOD(extack, > + "TC arbitration on leafs is not supported beyond max scheduling depth %d", > + max_level); clang points out that these messages are too long to fit in extack -- pw-bot: cr
© 2016 - 2025 Red Hat, Inc.