Skip to contentSkip to conversation

net/mlx5: misc changes 2025-05-25

PATCH In review Tariq Toukan 4 participants 7 messages May 25, 2025 – Jun 4, 2025

Subsystems (7)
lore
Share & tools
lore

Tariq Toukan

author maintainer
#0 lore raw

cover net/mlx5: misc changes 2025-05-25

Hi,

This small series contains misc enhancements to the mlx5 driver.

Regards,
Tariq

Maor Gottlieb (1):
net/mlx5: Warn when write combining is not supported

Yael Chemla (1):
net/mlx5e: Log error messages when extack is not present

 .../net/ethernet/mellanox/mlx5/core/devlink.c |  40 ++--
 .../net/ethernet/mellanox/mlx5/core/dpll.c    |   3 +-
 .../net/ethernet/mellanox/mlx5/core/en/htb.c  |  24 +--
 .../net/ethernet/mellanox/mlx5/core/en/qos.c  |   8 +-
 .../mellanox/mlx5/core/en/rep/bridge.c        |   2 +-
 .../mellanox/mlx5/core/en/tc/act/csum.c       |   8 +-
 .../mellanox/mlx5/core/en/tc/act/goto.c       |  16 +-
 .../mellanox/mlx5/core/en/tc/act/mark.c       |   2 +-
 .../mellanox/mlx5/core/en/tc/act/mirred.c     |  28 +--
 .../mellanox/mlx5/core/en/tc/act/mirred_nic.c |   4 +-
 .../mellanox/mlx5/core/en/tc/act/mpls.c       |   6 +-
 .../mellanox/mlx5/core/en/tc/act/pedit.c      |   8 +-
 .../mellanox/mlx5/core/en/tc/act/police.c     |  14 +-
 .../mellanox/mlx5/core/en/tc/act/ptype.c      |   2 +-
 .../mlx5/core/en/tc/act/redirect_ingress.c    |  16 +-
 .../mellanox/mlx5/core/en/tc/act/tun.c        |   4 +-
 .../mellanox/mlx5/core/en/tc/act/vlan.c       |   6 +-
 .../mlx5/core/en/tc/act/vlan_mangle.c         |   4 +-
 .../ethernet/mellanox/mlx5/core/en/tc_ct.c    |  20 +-
 .../ethernet/mellanox/mlx5/core/en/tc_ct.h    |   4 +-
 .../ethernet/mellanox/mlx5/core/en/tc_tun.c   |  12 +-
 .../mellanox/mlx5/core/en/tc_tun_encap.c      |  14 +-
 .../mellanox/mlx5/core/en/tc_tun_geneve.c     |  34 ++--
 .../mellanox/mlx5/core/en/tc_tun_vxlan.c      |  20 +-
 .../mellanox/mlx5/core/en_accel/ipsec.c       |  82 ++++----
 .../ethernet/mellanox/mlx5/core/en_ethtool.c  |  45 ++---
 .../net/ethernet/mellanox/mlx5/core/en_main.c |   4 +-
 .../net/ethernet/mellanox/mlx5/core/en_tc.c   | 188 +++++++++---------
 .../ethernet/mellanox/mlx5/core/esw/bridge.c  |  28 +--
 .../net/ethernet/mellanox/mlx5/core/esw/qos.c |  24 +--
 .../mellanox/mlx5/core/eswitch_offloads.c     | 120 +++++------
 .../net/ethernet/mellanox/mlx5/core/fs_core.c |  16 +-
 .../ethernet/mellanox/mlx5/core/fw_reset.c    |  14 +-
 .../net/ethernet/mellanox/mlx5/core/lag/lag.c |   8 +-
 .../ethernet/mellanox/mlx5/core/lag/mpesw.c   |   2 +-
 .../ethernet/mellanox/mlx5/core/mlx5_core.h   |  14 ++
 .../ethernet/mellanox/mlx5/core/sf/devlink.c  |  25 ++-
 drivers/net/ethernet/mellanox/mlx5/core/wc.c  |   3 +
 38 files changed, 444 insertions(+), 428 deletions(-)

base-commit: 33e1b1b3991ba8c0d02b2324a582e084272205d6

Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 1/2 net/mlx5: Warn when write combining is not supported

From: Maor Gottlieb <[email protected]>

Warn if write combining is not supported, as it can impact latency. Add the warning message to be printed only when the driver actually run the test and detect unsupported state, rather than when inheriting parent's result for SFs.

---
 drivers/net/ethernet/mellanox/mlx5/core/wc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/wc.c +3 -0
index 740b719e7072..2f0316616fa4 100644
@@ -378,6 +378,9 @@ static void mlx5_core_test_wc(struct mlx5_core_dev *mdev)
 	mlx5_free_bfreg(mdev, &sq->bfreg);
 err_alloc_bfreg:
 	kfree(sq);
+
+	if (mdev->wc_state == MLX5_WC_STATE_UNSUPPORTED)
+		mlx5_core_warn(mdev, "Write combining is not supported\n");
 }
 
 bool mlx5_wc_support_get(struct mlx5_core_dev *mdev)
Signature · 1 line
2.31.1
author maintainer
#2 lore raw

PATCH 2/2 net/mlx5e: Log error messages when extack is not present

In reply to Tariq Toukan

From: Yael Chemla <[email protected]>

Encapsulate netlink error message macros to ensure error message remain visible in dmesg when the userspace does not support netlink.

This allows drivers to continue providing meaningful error messages even when netlink is available in kernel but not in userspace.

Replace direct extack macro calls with new wrapper macros to support this fallback behavior.

---
 .../net/ethernet/mellanox/mlx5/core/devlink.c |  40 ++--
 .../net/ethernet/mellanox/mlx5/core/dpll.c    |   3 +-
 .../net/ethernet/mellanox/mlx5/core/en/htb.c  |  24 +--
 .../net/ethernet/mellanox/mlx5/core/en/qos.c  |   8 +-
 .../mellanox/mlx5/core/en/rep/bridge.c        |   2 +-
 .../mellanox/mlx5/core/en/tc/act/csum.c       |   8 +-
 .../mellanox/mlx5/core/en/tc/act/goto.c       |  16 +-
 .../mellanox/mlx5/core/en/tc/act/mark.c       |   2 +-
 .../mellanox/mlx5/core/en/tc/act/mirred.c     |  28 +--
 .../mellanox/mlx5/core/en/tc/act/mirred_nic.c |   4 +-
 .../mellanox/mlx5/core/en/tc/act/mpls.c       |   6 +-
 .../mellanox/mlx5/core/en/tc/act/pedit.c      |   8 +-
 .../mellanox/mlx5/core/en/tc/act/police.c     |  14 +-
 .../mellanox/mlx5/core/en/tc/act/ptype.c      |   2 +-
 .../mlx5/core/en/tc/act/redirect_ingress.c    |  16 +-
 .../mellanox/mlx5/core/en/tc/act/tun.c        |   4 +-
 .../mellanox/mlx5/core/en/tc/act/vlan.c       |   6 +-
 .../mlx5/core/en/tc/act/vlan_mangle.c         |   4 +-
 .../ethernet/mellanox/mlx5/core/en/tc_ct.c    |  20 +-
 .../ethernet/mellanox/mlx5/core/en/tc_ct.h    |   4 +-
 .../ethernet/mellanox/mlx5/core/en/tc_tun.c   |  12 +-
 .../mellanox/mlx5/core/en/tc_tun_encap.c      |  14 +-
 .../mellanox/mlx5/core/en/tc_tun_geneve.c     |  34 ++--
 .../mellanox/mlx5/core/en/tc_tun_vxlan.c      |  20 +-
 .../mellanox/mlx5/core/en_accel/ipsec.c       |  82 ++++----
 .../ethernet/mellanox/mlx5/core/en_ethtool.c  |  45 ++---
 .../net/ethernet/mellanox/mlx5/core/en_main.c |   4 +-
 .../net/ethernet/mellanox/mlx5/core/en_tc.c   | 188 +++++++++---------
 .../ethernet/mellanox/mlx5/core/esw/bridge.c  |  28 +--
 .../net/ethernet/mellanox/mlx5/core/esw/qos.c |  24 +--
 .../mellanox/mlx5/core/eswitch_offloads.c     | 120 +++++------
 .../net/ethernet/mellanox/mlx5/core/fs_core.c |  16 +-
 .../ethernet/mellanox/mlx5/core/fw_reset.c    |  14 +-
 .../net/ethernet/mellanox/mlx5/core/lag/lag.c |   8 +-
 .../ethernet/mellanox/mlx5/core/lag/mpesw.c   |   2 +-
 .../ethernet/mellanox/mlx5/core/mlx5_core.h   |  14 ++
 .../ethernet/mellanox/mlx5/core/sf/devlink.c  |  25 ++-
 37 files changed, 441 insertions(+), 428 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +20 -20
index 73cd74644378..ebcd07c75722 100644
@@ -94,7 +94,7 @@ static int mlx5_devlink_reload_fw_activate(struct devlink *devlink, struct netli
 	if (err)
 		return err;
 	if (!(reset_level & MLX5_MFRL_REG_RESET_LEVEL3)) {
-		NL_SET_ERR_MSG_MOD(extack, "FW activate requires reboot");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "FW activate requires reboot");
 		return -EINVAL;
 	}
 
@@ -110,7 +110,7 @@ static int mlx5_devlink_reload_fw_activate(struct devlink *devlink, struct netli
 	mlx5_unload_one_devl_locked(dev, true);
 	err = mlx5_health_wait_pci_up(dev);
 	if (err)
-		NL_SET_ERR_MSG_MOD(extack, "FW activate aborted, PCI reads fail after reset");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "FW activate aborted, PCI reads fail after reset");
 
 	return err;
 }
@@ -126,8 +126,8 @@ static int mlx5_devlink_trigger_fw_live_patch(struct devlink *devlink,
 	if (err)
 		return err;
 	if (!(reset_level & MLX5_MFRL_REG_RESET_LEVEL0)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "FW upgrade to the stored FW can't be done by FW live patching");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"FW upgrade to the stored FW can't be done by FW live patching");
 		return -EINVAL;
 	}
 
@@ -151,23 +151,23 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change,
 	}
 
 	if (mlx5_lag_is_active(dev)) {
-		NL_SET_ERR_MSG_MOD(extack, "reload is unsupported in Lag mode");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "reload is unsupported in Lag mode");
 		return -EOPNOTSUPP;
 	}
 
 	if (mlx5_core_is_mp_slave(dev)) {
-		NL_SET_ERR_MSG_MOD(extack, "reload is unsupported for multi port slave");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "reload is unsupported for multi port slave");
 		return -EOPNOTSUPP;
 	}
 
 	if (action == DEVLINK_RELOAD_ACTION_FW_ACTIVATE &&
 	    !dev->priv.fw_reset) {
-		NL_SET_ERR_MSG_MOD(extack, "FW activate is unsupported for this function");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "FW activate is unsupported for this function");
 		return -EOPNOTSUPP;
 	}
 
 	if (mlx5_core_is_pf(dev) && pci_num_vf(pdev))
-		NL_SET_ERR_MSG_MOD(extack, "reload while VFs are present is unfavorable");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "reload while VFs are present is unfavorable");
 
 	switch (action) {
 	case DEVLINK_RELOAD_ACTION_DRIVER_REINIT:
@@ -285,7 +285,7 @@ static int mlx5_devlink_trap_action_set(struct devlink *devlink,
 	int err;
 
 	if (is_mdev_switchdev_mode(dev)) {
-		NL_SET_ERR_MSG_MOD(extack, "Devlink traps can't be set in switchdev mode");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Devlink traps can't be set in switchdev mode");
 		return -EOPNOTSUPP;
 	}
 
@@ -413,11 +413,11 @@ static int mlx5_devlink_enable_roce_validate(struct devlink *devlink, u32 id,
 
 	if (new_state && !MLX5_CAP_GEN(dev, roce) &&
 	    !(MLX5_CAP_GEN(dev, roce_rw_supported) && MLX5_CAP_GEN_MAX(dev, roce))) {
-		NL_SET_ERR_MSG_MOD(extack, "Device doesn't support RoCE");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Device doesn't support RoCE");
 		return -EOPNOTSUPP;
 	}
 	if (mlx5_core_is_mp_slave(dev) || mlx5_lag_is_active(dev)) {
-		NL_SET_ERR_MSG_MOD(extack, "Multi port slave/Lag device can't configure RoCE");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Multi port slave/Lag device can't configure RoCE");
 		return -EOPNOTSUPP;
 	}
 
@@ -432,8 +432,8 @@ static int mlx5_devlink_large_group_num_validate(struct devlink *devlink, u32 id
 	int group_num = val.vu32;
 
 	if (group_num < 1 || group_num > 1024) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Unsupported group number, supported range is 1-1024");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Unsupported group number, supported range is 1-1024");
 		return -EOPNOTSUPP;
 	}
 
@@ -465,14 +465,14 @@ mlx5_devlink_hairpin_queue_size_validate(struct devlink *devlink, u32 id,
 	u32 val32 = val.vu32;
 
 	if (!is_power_of_2(val32)) {
-		NL_SET_ERR_MSG_MOD(extack, "Value is not power of two");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Value is not power of two");
 		return -EINVAL;
 	}
 
 	if (val32 > BIT(MLX5_CAP_GEN(dev, log_max_hairpin_num_packets))) {
-		NL_SET_ERR_MSG_FMT_MOD(
-			extack, "Maximum hairpin queue size is %lu",
-			BIT(MLX5_CAP_GEN(dev, log_max_hairpin_num_packets)));
+		MLX5_NL_SET_ERR_MSG_FMT_MOD(extack,
+					    "Maximum hairpin queue size is %lu",
+					    BIT(MLX5_CAP_GEN(dev, log_max_hairpin_num_packets)));
 		return -EINVAL;
 	}
 
@@ -717,18 +717,18 @@ static int mlx5_devlink_max_uc_list_validate(struct devlink *devlink, u32 id,
 	struct mlx5_core_dev *dev = devlink_priv(devlink);
 
 	if (val.vu32 == 0) {
-		NL_SET_ERR_MSG_MOD(extack, "max_macs value must be greater than 0");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "max_macs value must be greater than 0");
 		return -EINVAL;
 	}
 
 	if (!is_power_of_2(val.vu32)) {
-		NL_SET_ERR_MSG_MOD(extack, "Only power of 2 values are supported for max_macs");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Only power of 2 values are supported for max_macs");
 		return -EINVAL;
 	}
 
 	if (ilog2(val.vu32) >
 	    MLX5_CAP_GEN_MAX(dev, log_max_current_uc_list)) {
-		NL_SET_ERR_MSG_MOD(extack, "max_macs value is out of the supported range");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "max_macs value is out of the supported range");
 		return -EINVAL;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/dpll.c +2 -1
index 1e5522a19483..66e47ccacda6 100644
@@ -3,6 +3,7 @@
 
 #include <linux/dpll.h>
 #include <linux/mlx5/driver.h>
+#include "mlx5_core.h"
 
 /* This structure represents a reference to DPLL, one is created
  * per mdev instance.
@@ -242,7 +243,7 @@ static int mlx5_dpll_clock_quality_level_get(const struct dpll_device *dpll,
 		return 0;
 	}
 errout:
-	NL_SET_ERR_MSG_MOD(extack, "Invalid clock quality level obtained from firmware");
+	MLX5_NL_SET_ERR_MSG_MOD(extack, "Invalid clock quality level obtained from firmware");
 	return -EINVAL;
 }
 
drivers/net/ethernet/mellanox/mlx5/core/en/htb.c +12 -12
index 09d441ecb9f6..17f2400c3c96 100644
@@ -199,7 +199,7 @@ mlx5e_htb_root_add(struct mlx5e_htb *htb, u16 htb_maj_id, u16 htb_defcls,
 
 	err = mlx5_qos_create_root_node(htb->mdev, &root->hw_id);
 	if (err) {
-		NL_SET_ERR_MSG_MOD(extack, "Firmware error. Try upgrading firmware.");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Firmware error. Try upgrading firmware.");
 		goto err_sw_node_delete;
 	}
 
@@ -297,7 +297,7 @@ mlx5e_htb_leaf_alloc_queue(struct mlx5e_htb *htb, u16 classid,
 
 	qid = mlx5e_htb_find_unused_qos_qid(htb);
 	if (qid < 0) {
-		NL_SET_ERR_MSG_MOD(extack, "Maximum amount of leaf classes is reached.");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Maximum amount of leaf classes is reached.");
 		return qid;
 	}
 
@@ -317,7 +317,7 @@ mlx5e_htb_leaf_alloc_queue(struct mlx5e_htb *htb, u16 classid,
 					node->bw_share, node->max_average_bw,
 					&node->hw_id);
 	if (err) {
-		NL_SET_ERR_MSG_MOD(extack, "Firmware error when creating a leaf node.");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Firmware error when creating a leaf node.");
 		qos_err(htb->mdev, "Failed to create a leaf node (class %04x), err = %d\n",
 			classid, err);
 		mlx5e_htb_node_delete(htb, node);
@@ -327,7 +327,7 @@ mlx5e_htb_leaf_alloc_queue(struct mlx5e_htb *htb, u16 classid,
 	if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
 		err = mlx5e_open_qos_sq(priv, &priv->channels, node->qid, node->hw_id);
 		if (err) {
-			NL_SET_ERR_MSG_MOD(extack, "Error creating an SQ.");
+			MLX5_NL_SET_ERR_MSG_MOD(extack, "Error creating an SQ.");
 			qos_warn(htb->mdev, "Failed to create a QoS SQ (class %04x), err = %d\n",
 				 classid, err);
 		} else {
@@ -359,7 +359,7 @@ mlx5e_htb_leaf_to_inner(struct mlx5e_htb *htb, u16 classid, u16 child_classid,
 					 node->bw_share, node->max_average_bw,
 					 &new_hw_id);
 	if (err) {
-		NL_SET_ERR_MSG_MOD(extack, "Firmware error when creating an inner node.");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Firmware error when creating an inner node.");
 		qos_err(htb->mdev, "Failed to create an inner node (class %04x), err = %d\n",
 			classid, err);
 		return err;
@@ -379,7 +379,7 @@ mlx5e_htb_leaf_to_inner(struct mlx5e_htb *htb, u16 classid, u16 child_classid,
 	err = mlx5_qos_create_leaf_node(htb->mdev, new_hw_id, child->bw_share,
 					child->max_average_bw, &child->hw_id);
 	if (err) {
-		NL_SET_ERR_MSG_MOD(extack, "Firmware error when creating a leaf node.");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Firmware error when creating a leaf node.");
 		qos_err(htb->mdev, "Failed to create a leaf node (class %04x), err = %d\n",
 			classid, err);
 		goto err_delete_sw_node;
@@ -406,7 +406,7 @@ mlx5e_htb_leaf_to_inner(struct mlx5e_htb *htb, u16 classid, u16 child_classid,
 	if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
 		err = mlx5e_open_qos_sq(priv, &priv->channels, child->qid, child->hw_id);
 		if (err) {
-			NL_SET_ERR_MSG_MOD(extack, "Error creating an SQ.");
+			MLX5_NL_SET_ERR_MSG_MOD(extack, "Error creating an SQ.");
 			qos_warn(htb->mdev, "Failed to create a QoS SQ (class %04x), err = %d\n",
 				 classid, err);
 		} else {
@@ -520,7 +520,7 @@ int mlx5e_htb_leaf_del(struct mlx5e_htb *htb, u16 *classid,
 	if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
 		err = mlx5e_open_qos_sq(priv, &priv->channels, node->qid, node->hw_id);
 		if (err) {
-			NL_SET_ERR_MSG_MOD(extack, "Error creating an SQ.");
+			MLX5_NL_SET_ERR_MSG_MOD(extack, "Error creating an SQ.");
 			qos_warn(htb->mdev, "Failed to create a QoS SQ (class %04x) while moving qid %u to %u, err = %d\n",
 				 node->classid, moved_qid, qid, err);
 		} else {
@@ -558,7 +558,7 @@ mlx5e_htb_leaf_del_last(struct mlx5e_htb *htb, u16 classid, bool force,
 					node->parent->max_average_bw,
 					&new_hw_id);
 	if (err) {
-		NL_SET_ERR_MSG_MOD(extack, "Firmware error when creating a leaf node.");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Firmware error when creating a leaf node.");
 		qos_err(htb->mdev, "Failed to create a leaf node (class %04x), err = %d\n",
 			classid, err);
 		if (!force)
@@ -602,7 +602,7 @@ mlx5e_htb_leaf_del_last(struct mlx5e_htb *htb, u16 classid, bool force,
 	if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
 		err = mlx5e_open_qos_sq(priv, &priv->channels, node->qid, node->hw_id);
 		if (err) {
-			NL_SET_ERR_MSG_MOD(extack, "Error creating an SQ.");
+			MLX5_NL_SET_ERR_MSG_MOD(extack, "Error creating an SQ.");
 			qos_warn(htb->mdev, "Failed to create a QoS SQ (class %04x), err = %d\n",
 				 classid, err);
 		} else {
@@ -642,7 +642,7 @@ mlx5e_htb_update_children(struct mlx5e_htb *htb, struct mlx5e_qos_node *node,
 		if (!err && err_one) {
 			err = err_one;
 
-			NL_SET_ERR_MSG_MOD(extack, "Firmware error when modifying a child node.");
+			MLX5_NL_SET_ERR_MSG_MOD(extack, "Firmware error when modifying a child node.");
 			qos_err(htb->mdev, "Failed to modify a child node (class %04x), err = %d\n",
 				node->classid, err);
 		}
@@ -674,7 +674,7 @@ mlx5e_htb_node_modify(struct mlx5e_htb *htb, u16 classid, u64 rate, u64 ceil,
 	err = mlx5_qos_update_node(htb->mdev, bw_share,
 				   max_average_bw, node->hw_id);
 	if (err) {
-		NL_SET_ERR_MSG_MOD(extack, "Firmware error when modifying a node.");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Firmware error when modifying a node.");
 		qos_err(htb->mdev, "Failed to modify a node (class %04x), err = %d\n",
 			classid, err);
 		return err;
drivers/net/ethernet/mellanox/mlx5/core/en/qos.c +4 -4
index f0744a45db92..2a100cd25f10 100644
@@ -393,16 +393,16 @@ int mlx5e_htb_setup_tc(struct mlx5e_priv *priv, struct tc_htb_qopt_offload *htb_
 		return -EINVAL;
 
 	if (htb_qopt->prio || htb_qopt->quantum) {
-		NL_SET_ERR_MSG_MOD(htb_qopt->extack,
-				   "prio and quantum parameters are not supported by device with HTB offload enabled.");
+		MLX5_NL_SET_ERR_MSG_MOD(htb_qopt->extack,
+					"prio and quantum parameters are not supported by device with HTB offload enabled.");
 		return -EOPNOTSUPP;
 	}
 
 	switch (htb_qopt->command) {
 	case TC_HTB_CREATE:
 		if (!mlx5_qos_is_supported(priv->mdev)) {
-			NL_SET_ERR_MSG_MOD(htb_qopt->extack,
-					   "Missing QoS capabilities. Try disabling SRIOV or use a supported device.");
+			MLX5_NL_SET_ERR_MSG_MOD(htb_qopt->extack,
+						"Missing QoS capabilities. Try disabling SRIOV or use a supported device.");
 			return -EOPNOTSUPP;
 		}
 		priv->htb = mlx5e_htb_alloc();
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c +1 -1
index 0f5d7ea8956f..e47779cda005 100644
@@ -296,7 +296,7 @@ mlx5_esw_bridge_port_obj_attr_set(struct net_device *dev,
 	switch (attr->id) {
 	case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
 		if (attr->u.brport_flags.mask & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD)) {
-			NL_SET_ERR_MSG_MOD(extack, "Flag is not supported");
+			MLX5_NL_SET_ERR_MSG_MOD(extack, "Flag is not supported");
 			err = -EINVAL;
 		}
 		break;
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/csum.c +4 -4
index c0f08ae6a57f..3fc468832894 100644
@@ -16,16 +16,16 @@ csum_offload_supported(struct mlx5e_priv *priv,
 
 	/*  The HW recalcs checksums only if re-writing headers */
 	if (!(action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "TC csum action is only offloaded with pedit");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"TC csum action is only offloaded with pedit");
 		netdev_warn(priv->netdev,
 			    "TC csum action is only offloaded with pedit\n");
 		return false;
 	}
 
 	if (update_flags & ~prot_flags) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "can't offload TC csum action for some header/s");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"can't offload TC csum action for some header/s");
 		netdev_warn(priv->netdev,
 			    "can't offload TC csum action for some header/s - flags %#x\n",
 			    update_flags);
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/goto.c +8 -8
index 0923e6db2d0a..cf2bb9d28894 100644
@@ -29,27 +29,27 @@ validate_goto_chain(struct mlx5e_priv *priv,
 			   MLX5_CAP_FLOWTABLE_NIC_RX(priv->mdev, reformat_and_fwd_to_table);
 
 	if (ft_flow) {
-		NL_SET_ERR_MSG_MOD(extack, "Goto action is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Goto action is not supported");
 		return -EOPNOTSUPP;
 	}
 
 	if (!mlx5_chains_backwards_supported(chains) &&
 	    dest_chain <= attr->chain) {
-		NL_SET_ERR_MSG_MOD(extack, "Goto lower numbered chain isn't supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Goto lower numbered chain isn't supported");
 		return -EOPNOTSUPP;
 	}
 
 	if (dest_chain > max_chain) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Requested destination chain is out of supported range");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Requested destination chain is out of supported range");
 		return -EOPNOTSUPP;
 	}
 
 	if (attr->action & (MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT |
 			    MLX5_FLOW_CONTEXT_ACTION_DECAP) &&
 	    !reformat_and_fwd) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Goto chain is not allowed if action has reformat or decap");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Goto chain is not allowed if action has reformat or decap");
 		return -EOPNOTSUPP;
 	}
 
@@ -104,13 +104,13 @@ tc_act_post_parse_goto(struct mlx5e_tc_act_parse_state *parse_state,
 		 * device.
 		 */
 
-		NL_SET_ERR_MSG_MOD(extack, "Decap with goto isn't supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Decap with goto isn't supported");
 		netdev_warn(priv->netdev, "Decap with goto isn't supported");
 		return -EOPNOTSUPP;
 	}
 
 	if (!mlx5e_is_eswitch_flow(flow) && parse_attr->mirred_ifindex[0]) {
-		NL_SET_ERR_MSG_MOD(extack, "Mirroring goto chain rules isn't supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Mirroring goto chain rules isn't supported");
 		return -EOPNOTSUPP;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mark.c +1 -1
index e8d227595b3e..93c0a7f91e66 100644
@@ -11,7 +11,7 @@ tc_act_can_offload_mark(struct mlx5e_tc_act_parse_state *parse_state,
 			struct mlx5_flow_attr *attr)
 {
 	if (act->mark & ~MLX5E_TC_FLOW_ID_MASK) {
-		NL_SET_ERR_MSG_MOD(parse_state->extack, "Bad flow mark, only 16 bit supported");
+		MLX5_NL_SET_ERR_MSG_MOD(parse_state->extack, "Bad flow mark, only 16 bit supported");
 		return false;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c +14 -14
index 1b418095b79a..7fd225c3aefa 100644
@@ -44,12 +44,12 @@ verify_uplink_forwarding(struct mlx5e_priv *priv,
 
 	if (!MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev,
 					termination_table_raw_traffic)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "devices are both uplink, can't offload forwarding");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"devices are both uplink, can't offload forwarding");
 			return -EOPNOTSUPP;
 	} else if (out_dev != rep_priv->netdev) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "devices are not the same uplink, can't offload forwarding");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"devices are not the same uplink, can't offload forwarding");
 		return -EOPNOTSUPP;
 	}
 	return 0;
@@ -65,7 +65,7 @@ is_duplicated_output_device(struct net_device *dev,
 
 	for (i = 0; i < if_count; i++) {
 		if (ifindexes[i] == out_dev->ifindex) {
-			NL_SET_ERR_MSG_MOD(extack, "can't duplicate output to same device");
+			MLX5_NL_SET_ERR_MSG_MOD(extack, "can't duplicate output to same device");
 			netdev_err(dev, "can't duplicate output to same device: %s\n",
 				   out_dev->name);
 			return true;
@@ -122,17 +122,17 @@ tc_act_can_offload_mirred(struct mlx5e_tc_act_parse_state *parse_state,
 	}
 
 	if (parse_state->mpls_push && !netif_is_bareudp(out_dev)) {
-		NL_SET_ERR_MSG_MOD(extack, "mpls is supported only through a bareudp device");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "mpls is supported only through a bareudp device");
 		return false;
 	}
 
 	if (parse_state->eth_pop && !parse_state->mpls_push) {
-		NL_SET_ERR_MSG_MOD(extack, "vlan pop eth is supported only with mpls push");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "vlan pop eth is supported only with mpls push");
 		return false;
 	}
 
 	if (flow_flag_test(parse_state->flow, L3_TO_L2_DECAP) && !parse_state->eth_push) {
-		NL_SET_ERR_MSG_MOD(extack, "mpls pop is only supported with vlan eth push");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "mpls pop is only supported with vlan eth push");
 		return false;
 	}
 
@@ -145,8 +145,8 @@ tc_act_can_offload_mirred(struct mlx5e_tc_act_parse_state *parse_state,
 	}
 
 	if (esw_attr->out_count >= MLX5_MAX_FLOW_FWD_VPORTS) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "can't support more output ports, can't offload forwarding");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"can't support more output ports, can't offload forwarding");
 		netdev_warn(priv->netdev,
 			    "can't support more than %d output ports, can't offload forwarding\n",
 			    esw_attr->out_count);
@@ -167,7 +167,7 @@ tc_act_can_offload_mirred(struct mlx5e_tc_act_parse_state *parse_state,
 		return false;
 	}
 
-	NL_SET_ERR_MSG_MOD(extack, "devices are not on same switch HW, can't offload forwarding");
+	MLX5_NL_SET_ERR_MSG_MOD(extack, "devices are not on same switch HW, can't offload forwarding");
 
 	return false;
 }
@@ -258,13 +258,13 @@ parse_mirred(struct mlx5e_tc_act_parse_state *parse_state,
 		return err;
 
 	if (!mlx5e_is_valid_eswitch_fwd_dev(priv, out_dev)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "devices are not on same switch HW, can't offload forwarding");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"devices are not on same switch HW, can't offload forwarding");
 		return -EOPNOTSUPP;
 	}
 
 	if (same_vf_reps(priv, out_dev)) {
-		NL_SET_ERR_MSG_MOD(extack, "can't forward from a VF to itself");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "can't forward from a VF to itself");
 		return -EOPNOTSUPP;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred_nic.c +2 -2
index 7f409692b18f..0f27f5bc0178 100644
@@ -20,8 +20,8 @@ tc_act_can_offload_mirred_nic(struct mlx5e_tc_act_parse_state *parse_state,
 
 	if (priv->netdev->netdev_ops != out_dev->netdev_ops ||
 	    !mlx5e_same_hw_devs(priv, netdev_priv(out_dev))) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "devices are not on same switch HW, can't offload forwarding");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"devices are not on same switch HW, can't offload forwarding");
 		netdev_warn(priv->netdev,
 			    "devices %s %s not on same switch HW, can't offload forwarding\n",
 			    netdev_name(priv->netdev),
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mpls.c +3 -3
index f106190bf37c..fd2acfd8cb33 100644
@@ -16,7 +16,7 @@ tc_act_can_offload_mpls_push(struct mlx5e_tc_act_parse_state *parse_state,
 
 	if (!MLX5_CAP_ESW_FLOWTABLE_FDB(priv->mdev, reformat_l2_to_l3_tunnel) ||
 	    act->mpls_push.proto != htons(ETH_P_MPLS_UC)) {
-		NL_SET_ERR_MSG_MOD(extack, "mpls push is supported only for mpls_uc protocol");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "mpls push is supported only for mpls_uc protocol");
 		return false;
 	}
 
@@ -63,12 +63,12 @@ tc_act_can_offload_mpls_pop(struct mlx5e_tc_act_parse_state *parse_state,
 	 * egress redirect.
 	 */
 	if ((act_index == 1 && !parse_state->decap) || act_index > 1) {
-		NL_SET_ERR_MSG_MOD(extack, "mpls pop supported only as first action or with decap");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "mpls pop supported only as first action or with decap");
 		return false;
 	}
 
 	if (!netif_is_bareudp(filter_dev)) {
-		NL_SET_ERR_MSG_MOD(extack, "mpls pop supported only on bareudp devices");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "mpls pop supported only on bareudp devices");
 		return false;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pedit.c +4 -4
index b14cd62edffc..6c8f7b804802 100644
@@ -28,8 +28,8 @@ set_pedit_val(u8 hdr_type, u32 mask, u32 val, u32 offset,
 	curr_pval  = (u32 *)(pedit_header(&hdrs->vals, hdr_type) + offset);
 
 	if (*curr_pmask & mask) { /* disallow acting twice on the same location */
-		NL_SET_ERR_MSG_MOD(extack,
-				   "curr_pmask and new mask same. Acting twice on same location");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"curr_pmask and new mask same. Acting twice on same location");
 		goto out_err;
 	}
 
@@ -55,12 +55,12 @@ mlx5e_tc_act_pedit_parse_action(struct mlx5e_priv *priv,
 	u32 mask, val, offset;
 
 	if (htype == FLOW_ACT_MANGLE_UNSPEC) {
-		NL_SET_ERR_MSG_MOD(extack, "legacy pedit isn't offloaded");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "legacy pedit isn't offloaded");
 		goto out_err;
 	}
 
 	if (!mlx5e_mod_hdr_max_actions(priv->mdev, namespace)) {
-		NL_SET_ERR_MSG_MOD(extack, "The pedit offload action is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "The pedit offload action is not supported");
 		goto out_err;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/police.c +7 -7
index 1bd1c94fb977..b48a7614e416 100644
@@ -12,8 +12,8 @@ static bool police_act_validate_control(enum flow_action_id act_id,
 	    act_id != FLOW_ACTION_ACCEPT &&
 	    act_id != FLOW_ACTION_JUMP &&
 	    act_id != FLOW_ACTION_DROP) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Offload not supported when conform-exceed action is not pipe, ok, jump or drop");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Offload not supported when conform-exceed action is not pipe, ok, jump or drop");
 		return false;
 	}
 
@@ -29,8 +29,8 @@ static int police_act_validate(const struct flow_action_entry *act,
 
 	if (act->police.peakrate_bytes_ps ||
 	    act->police.avrate || act->police.overhead) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Offload not supported when peakrate/avrate/overhead is configured");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Offload not supported when peakrate/avrate/overhead is configured");
 		return -EOPNOTSUPP;
 	}
 
@@ -138,7 +138,7 @@ tc_act_police_offload(struct mlx5e_priv *priv,
 	}
 
 	if (IS_ERR(meter)) {
-		NL_SET_ERR_MSG_MOD(fl_act->extack, "Failed to get flow meter");
+		MLX5_NL_SET_ERR_MSG_MOD(fl_act->extack, "Failed to get flow meter");
 		mlx5_core_err(priv->mdev, "Failed to get flow meter %d\n", params.index);
 		err = PTR_ERR(meter);
 	}
@@ -156,7 +156,7 @@ tc_act_police_destroy(struct mlx5e_priv *priv,
 	params.index = fl_act->index;
 	meter = mlx5e_tc_meter_get(priv->mdev, &params);
 	if (IS_ERR(meter)) {
-		NL_SET_ERR_MSG_MOD(fl_act->extack, "Failed to get flow meter");
+		MLX5_NL_SET_ERR_MSG_MOD(fl_act->extack, "Failed to get flow meter");
 		mlx5_core_err(priv->mdev, "Failed to get flow meter %d\n", params.index);
 		return PTR_ERR(meter);
 	}
@@ -177,7 +177,7 @@ tc_act_police_stats(struct mlx5e_priv *priv,
 	params.index = fl_act->index;
 	meter = mlx5e_tc_meter_get(priv->mdev, &params);
 	if (IS_ERR(meter)) {
-		NL_SET_ERR_MSG_MOD(fl_act->extack, "Failed to get flow meter");
+		MLX5_NL_SET_ERR_MSG_MOD(fl_act->extack, "Failed to get flow meter");
 		return PTR_ERR(meter);
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/ptype.c +1 -1
index 80b4bc64380a..7e09c05c4c96 100644
@@ -13,7 +13,7 @@ tc_act_parse_ptype(struct mlx5e_tc_act_parse_state *parse_state,
 	struct netlink_ext_ack *extack = parse_state->extack;
 
 	if (act->ptype != PACKET_HOST) {
-		NL_SET_ERR_MSG_MOD(extack, "skbedit ptype is only supported with type host");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "skbedit ptype is only supported with type host");
 		return -EOPNOTSUPP;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/redirect_ingress.c +8 -8
index 2d1d4a04501b..290f9180ce37 100644
@@ -22,26 +22,26 @@ tc_act_can_offload_redirect_ingress(struct mlx5e_tc_act_parse_state *parse_state
 		return false;
 
 	if (!netif_is_ovs_master(out_dev)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "redirect to ingress is supported only for OVS internal ports");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"redirect to ingress is supported only for OVS internal ports");
 		return false;
 	}
 
 	if (netif_is_ovs_master(parse_attr->filter_dev)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "redirect to ingress is not supported from internal port");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"redirect to ingress is not supported from internal port");
 		return false;
 	}
 
 	if (!parse_state->ptype_host) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "redirect to int port ingress requires ptype=host action");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"redirect to int port ingress requires ptype=host action");
 		return false;
 	}
 
 	if (esw_attr->out_count) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "redirect to int port ingress is supported only as single destination");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"redirect to int port ingress is supported only as single destination");
 		return false;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/tun.c +2 -2
index f1cae21c2c37..32c97a55345b 100644
@@ -12,8 +12,8 @@ tc_act_can_offload_tun_encap(struct mlx5e_tc_act_parse_state *parse_state,
 			     struct mlx5_flow_attr *attr)
 {
 	if (!act->tunnel) {
-		NL_SET_ERR_MSG_MOD(parse_state->extack,
-				   "Zero tunnel attributes is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(parse_state->extack,
+					"Zero tunnel attributes is not supported");
 		return false;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c +3 -3
index a13c5e707b83..e9ee242c9722 100644
@@ -40,12 +40,12 @@ parse_tc_vlan_action(struct mlx5e_priv *priv,
 	u8 vlan_idx = attr->total_vlan;
 
 	if (vlan_idx >= MLX5_FS_VLAN_DEPTH) {
-		NL_SET_ERR_MSG_MOD(extack, "Total vlans used is greater than supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Total vlans used is greater than supported");
 		return -EOPNOTSUPP;
 	}
 
 	if (!mlx5_eswitch_vlan_actions_supported(priv->mdev, vlan_idx)) {
-		NL_SET_ERR_MSG_MOD(extack, "firmware vlan actions is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "firmware vlan actions is not supported");
 		return -EOPNOTSUPP;
 	}
 
@@ -79,7 +79,7 @@ parse_tc_vlan_action(struct mlx5e_priv *priv,
 		memcpy(attr->eth.h_source, act->vlan_push_eth.src, ETH_ALEN);
 		break;
 	default:
-		NL_SET_ERR_MSG_MOD(extack, "Unexpected action id for VLAN");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Unexpected action id for VLAN");
 		return -EINVAL;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan_mangle.c +2 -2
index f17575b09788..60cbca0d5bcb 100644
@@ -32,14 +32,14 @@ mlx5e_tc_act_vlan_add_rewrite_action(struct mlx5e_priv *priv, int namespace,
 
 	if (!(MLX5_GET(fte_match_set_lyr_2_4, headers_c, cvlan_tag) &&
 	      MLX5_GET(fte_match_set_lyr_2_4, headers_v, cvlan_tag))) {
-		NL_SET_ERR_MSG_MOD(extack, "VLAN rewrite action must have VLAN protocol match");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "VLAN rewrite action must have VLAN protocol match");
 		return -EOPNOTSUPP;
 	}
 
 	match_prio_mask = MLX5_GET(fte_match_set_lyr_2_4, headers_c, first_prio);
 	match_prio_val = MLX5_GET(fte_match_set_lyr_2_4, headers_v, first_prio);
 	if (act->vlan.prio != (match_prio_val & match_prio_mask)) {
-		NL_SET_ERR_MSG_MOD(extack, "Changing VLAN prio is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Changing VLAN prio is not supported");
 		return -EOPNOTSUPP;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +10 -10
index 81332cd4a582..3dd14ffda7d5 100644
@@ -1493,8 +1493,8 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv,
 		return 0;
 
 	if (!priv) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "offload of ct matching isn't available");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"offload of ct matching isn't available");
 		return -EOPNOTSUPP;
 	}
 
@@ -1512,8 +1512,8 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv,
 			      TCA_FLOWER_KEY_CT_FLAGS_REPLY |
 			      TCA_FLOWER_KEY_CT_FLAGS_RELATED |
 			      TCA_FLOWER_KEY_CT_FLAGS_INVALID)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "only ct_state trk, est, new and rpl are supported for offload");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"only ct_state trk, est, new and rpl are supported for offload");
 		return -EOPNOTSUPP;
 	}
 
@@ -1544,14 +1544,14 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv,
 	ctstate_mask |= uninv ? MLX5_CT_STATE_INVALID_BIT : 0;
 
 	if (rel) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "matching on ct_state +rel isn't supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"matching on ct_state +rel isn't supported");
 		return -EOPNOTSUPP;
 	}
 
 	if (inv) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "matching on ct_state +inv isn't supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"matching on ct_state +inv isn't supported");
 		return -EOPNOTSUPP;
 	}
 
@@ -1586,8 +1586,8 @@ mlx5_tc_ct_parse_action(struct mlx5_tc_ct_priv *priv,
 			struct netlink_ext_ack *extack)
 {
 	if (!priv) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "offload of ct action isn't available");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"offload of ct action isn't available");
 		return -EOPNOTSUPP;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h +2 -2
index 5e9dbdd4a5e9..bf0980909803 100644
@@ -162,7 +162,7 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv,
 	if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CT))
 		return 0;
 
-	NL_SET_ERR_MSG_MOD(extack, "mlx5 tc ct offload isn't enabled.");
+	MLX5_NL_SET_ERR_MSG_MOD(extack, "mlx5 tc ct offload isn't enabled.");
 	return -EOPNOTSUPP;
 }
 
@@ -178,7 +178,7 @@ mlx5_tc_ct_parse_action(struct mlx5_tc_ct_priv *priv,
 			const struct flow_action_entry *act,
 			struct netlink_ext_ack *extack)
 {
-	NL_SET_ERR_MSG_MOD(extack, "mlx5 tc ct offload isn't enabled.");
+	MLX5_NL_SET_ERR_MSG_MOD(extack, "mlx5 tc ct offload isn't enabled.");
 	return -EOPNOTSUPP;
 }
 
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +6 -6
index 2162d776fe35..167097ef8fab 100644
@@ -926,8 +926,8 @@ int mlx5e_tc_tun_parse(struct net_device *filter_dev,
 		    !MLX5_CAP_ESW_FLOWTABLE_FDB
 			(priv->mdev,
 			 ft_field_support.outer_ipv4_ttl)) {
-			NL_SET_ERR_MSG_MOD(extack,
-					   "Matching on TTL is not supported");
+			MLX5_NL_SET_ERR_MSG_MOD(extack,
+						"Matching on TTL is not supported");
 			err = -EOPNOTSUPP;
 			goto out;
 		}
@@ -956,8 +956,8 @@ int mlx5e_tc_tun_parse_udp_ports(struct mlx5e_priv *priv,
 	/* Full udp dst port must be given */
 
 	if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_PORTS)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "UDP tunnel decap filter must include enc_dst_port condition");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"UDP tunnel decap filter must include enc_dst_port condition");
 		netdev_warn(priv->netdev,
 			    "UDP tunnel decap filter must include enc_dst_port condition\n");
 		return -EOPNOTSUPP;
@@ -967,8 +967,8 @@ int mlx5e_tc_tun_parse_udp_ports(struct mlx5e_priv *priv,
 
 	if (memchr_inv(&enc_ports.mask->dst, 0xff,
 		       sizeof(enc_ports.mask->dst))) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "UDP tunnel decap filter must match enc_dst_port fully");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"UDP tunnel decap filter must match enc_dst_port fully");
 		netdev_warn(priv->netdev,
 			    "UDP tunnel decap filter must match enc_dst_port fully\n");
 		return -EOPNOTSUPP;
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +7 -7
index a0fc76a1bc08..cccb06e28ed6 100644
@@ -707,7 +707,7 @@ static bool is_duplicated_encap_entry(struct mlx5e_priv *priv,
 	for (i = 0; i < out_index; i++) {
 		if (flow->encaps[i].e != e)
 			continue;
-		NL_SET_ERR_MSG_MOD(extack, "can't duplicate encap action");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "can't duplicate encap action");
 		netdev_err(priv->netdev, "can't duplicate encap action\n");
 		return true;
 	}
@@ -845,7 +845,7 @@ int mlx5e_attach_encap(struct mlx5e_priv *priv,
 	key.ip_tun_key = &tun_info->key;
 	key.tc_tunnel = mlx5e_get_tc_tun(mirred_dev);
 	if (!key.tc_tunnel) {
-		NL_SET_ERR_MSG_MOD(extack, "Unsupported tunnel");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Unsupported tunnel");
 		return -EOPNOTSUPP;
 	}
 
@@ -956,8 +956,8 @@ int mlx5e_attach_decap(struct mlx5e_priv *priv,
 	int err = 0;
 
 	if (sizeof(attr->eth) > MLX5_CAP_ESW(priv->mdev, max_encap_header_size)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "encap header larger than max supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"encap header larger than max supported");
 		return -EOPNOTSUPP;
 	}
 
@@ -1053,7 +1053,7 @@ int mlx5e_tc_tun_encap_dests_set(struct mlx5e_priv *priv,
 		mirred_ifindex = parse_attr->mirred_ifindex[out_index];
 		out_dev = dev_get_by_index(dev_net(priv->netdev), mirred_ifindex);
 		if (!out_dev) {
-			NL_SET_ERR_MSG_MOD(extack, "Requested mirred device not found");
+			MLX5_NL_SET_ERR_MSG_MOD(extack, "Requested mirred device not found");
 			err = -ENODEV;
 			goto out;
 		}
@@ -1076,7 +1076,7 @@ int mlx5e_tc_tun_encap_dests_set(struct mlx5e_priv *priv,
 	}
 
 	if (*vf_tun && esw_attr->out_count > 1) {
-		NL_SET_ERR_MSG_MOD(extack, "VF tunnel encap with mirroring is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "VF tunnel encap with mirroring is not supported");
 		err = -EOPNOTSUPP;
 		goto out;
 	}
@@ -1844,7 +1844,7 @@ static int mlx5e_tc_tun_fib_event(struct notifier_block *nb, unsigned long event
 		if (!IS_ERR_OR_NULL(fib_work)) {
 			queue_work(priv->wq, &fib_work->work);
 		} else if (IS_ERR(fib_work)) {
-			NL_SET_ERR_MSG_MOD(info->extack, "Failed to init fib work");
+			MLX5_NL_SET_ERR_MSG_MOD(info->extack, "Failed to init fib work");
 			mlx5_core_warn(priv->mdev, "Failed to init fib work, %ld\n",
 				       PTR_ERR(fib_work));
 		}
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_geneve.c +17 -17
index bf969212cc77..eebcedbaf9b6 100644
@@ -35,8 +35,8 @@ static int mlx5e_tc_tun_check_udp_dport_geneve(struct mlx5e_priv *priv,
 	 * port, so udp dst port must match.
 	 */
 	if (be16_to_cpu(enc_ports.key->dst) != GENEVE_UDP_PORT) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Matched UDP dst port is not registered as a GENEVE port");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Matched UDP dst port is not registered as a GENEVE port");
 		netdev_warn(priv->netdev,
 			    "UDP port %d is not registered as a GENEVE port\n",
 			    be16_to_cpu(enc_ports.key->dst));
@@ -142,7 +142,7 @@ static int mlx5e_tc_tun_parse_geneve_vni(struct mlx5e_priv *priv,
 		return 0;
 
 	if (!MLX5_CAP_ESW_FLOWTABLE_FDB(priv->mdev, ft_field_support.outer_geneve_vni)) {
-		NL_SET_ERR_MSG_MOD(extack, "Matching on GENEVE VNI is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Matching on GENEVE VNI is not supported");
 		netdev_warn(priv->netdev, "Matching on GENEVE VNI is not supported\n");
 		return -EOPNOTSUPP;
 	}
@@ -180,8 +180,8 @@ static int mlx5e_tc_tun_parse_geneve_options(struct mlx5e_priv *priv,
 	if (memchr_inv(&enc_opts.mask->data, 0, sizeof(enc_opts.mask->data)) &&
 	    !MLX5_CAP_ESW_FLOWTABLE_FDB(priv->mdev,
 					ft_field_support.geneve_tlv_option_0_data)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Matching on GENEVE options is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Matching on GENEVE options is not supported");
 		netdev_warn(priv->netdev,
 			    "Matching on GENEVE options is not supported\n");
 		return -EOPNOTSUPP;
@@ -190,8 +190,8 @@ static int mlx5e_tc_tun_parse_geneve_options(struct mlx5e_priv *priv,
 	/* make sure that we're talking about GENEVE options */
 
 	if (enc_opts.key->dst_opt_type != IP_TUNNEL_GENEVE_OPT_BIT) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Matching on GENEVE options: option type is not GENEVE");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Matching on GENEVE options: option type is not GENEVE");
 		netdev_warn(priv->netdev,
 			    "Matching on GENEVE options: option type is not GENEVE\n");
 		return -EOPNOTSUPP;
@@ -200,7 +200,7 @@ static int mlx5e_tc_tun_parse_geneve_options(struct mlx5e_priv *priv,
 	if (enc_opts.mask->len &&
 	    !MLX5_CAP_ESW_FLOWTABLE_FDB(priv->mdev,
 					ft_field_support.outer_geneve_opt_len)) {
-		NL_SET_ERR_MSG_MOD(extack, "Matching on GENEVE options len is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Matching on GENEVE options len is not supported");
 		netdev_warn(priv->netdev,
 			    "Matching on GENEVE options len is not supported\n");
 		return -EOPNOTSUPP;
@@ -213,8 +213,8 @@ static int mlx5e_tc_tun_parse_geneve_options(struct mlx5e_priv *priv,
 	 */
 
 	if ((enc_opts.key->len / 4) > ((max_tlv_option_data_len + 1) * max_tlv_options)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Matching on GENEVE options: unsupported options len");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Matching on GENEVE options: unsupported options len");
 		netdev_warn(priv->netdev,
 			    "Matching on GENEVE options: unsupported options len (len=%d)\n",
 			    enc_opts.key->len);
@@ -233,8 +233,8 @@ static int mlx5e_tc_tun_parse_geneve_options(struct mlx5e_priv *priv,
 		return 0;
 
 	if (option_key->length > max_tlv_option_data_len) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Matching on GENEVE options: unsupported option len");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Matching on GENEVE options: unsupported option len");
 		netdev_warn(priv->netdev,
 			    "Matching on GENEVE options: unsupported option len (key=%d, mask=%d)\n",
 			    option_key->length, option_mask->length);
@@ -243,8 +243,8 @@ static int mlx5e_tc_tun_parse_geneve_options(struct mlx5e_priv *priv,
 
 	/* data can't be all 0 - fail to offload such rule */
 	if (!memchr_inv(option_key->opt_data, 0, option_key->length * 4)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Matching on GENEVE options: can't match on 0 data field");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Matching on GENEVE options: can't match on 0 data field");
 		netdev_warn(priv->netdev,
 			    "Matching on GENEVE options: can't match on 0 data field\n");
 		return -EOPNOTSUPP;
@@ -253,8 +253,8 @@ static int mlx5e_tc_tun_parse_geneve_options(struct mlx5e_priv *priv,
 	/* add new GENEVE TLV options object */
 	res = mlx5_geneve_tlv_option_add(priv->mdev->geneve, option_key);
 	if (res) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Matching on GENEVE options: failed creating TLV opt object");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Matching on GENEVE options: failed creating TLV opt object");
 		netdev_warn(priv->netdev,
 			    "Matching on GENEVE options: failed creating TLV opt object (class:type:len = 0x%x:0x%x:%d)\n",
 			    be16_to_cpu(option_key->opt_class),
@@ -296,7 +296,7 @@ static int mlx5e_tc_tun_parse_geneve_params(struct mlx5e_priv *priv,
 	/* match on OAM - packets with OAM bit on should NOT be offloaded */
 
 	if (!MLX5_CAP_ESW_FLOWTABLE_FDB(priv->mdev, ft_field_support.outer_geneve_oam)) {
-		NL_SET_ERR_MSG_MOD(extack, "Matching on GENEVE OAM is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Matching on GENEVE OAM is not supported");
 		netdev_warn(priv->netdev, "Matching on GENEVE OAM is not supported\n");
 		return -EOPNOTSUPP;
 	}
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c +10 -10
index 7a18a469961d..0e432654d802 100644
@@ -32,8 +32,8 @@ static int mlx5e_tc_tun_check_udp_dport_vxlan(struct mlx5e_priv *priv,
 
 	if (!mlx5_vxlan_lookup_port(priv->mdev->vxlan,
 				    be16_to_cpu(enc_ports.key->dst))) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Matched UDP dst port is not registered as a VXLAN port");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Matched UDP dst port is not registered as a VXLAN port");
 		netdev_warn(priv->netdev,
 			    "UDP port %d is not registered as a VXLAN port\n",
 			    be16_to_cpu(enc_ports.key->dst));
@@ -68,8 +68,8 @@ static int mlx5e_tc_tun_init_encap_attr_vxlan(struct net_device *tunnel_dev,
 	e->tunnel = &vxlan_tunnel;
 
 	if (!mlx5_vxlan_lookup_port(priv->mdev->vxlan, dst_port)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "vxlan udp dport was not registered with the HW");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"vxlan udp dport was not registered with the HW");
 		netdev_warn(priv->netdev,
 			    "%d isn't an offloaded vxlan udp dport\n",
 			    dst_port);
@@ -121,18 +121,18 @@ static int mlx5e_tc_tun_parse_vxlan_gbp_option(struct mlx5e_priv *priv,
 
 	if (memchr_inv(&enc_opts.mask->data, 0, sizeof(enc_opts.mask->data)) &&
 	    !MLX5_CAP_ESW_FT_FIELD_SUPPORT_2(priv->mdev, tunnel_header_0_1)) {
-		NL_SET_ERR_MSG_MOD(extack, "Matching on VxLAN GBP is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Matching on VxLAN GBP is not supported");
 		return -EOPNOTSUPP;
 	}
 
 	if (enc_opts.key->dst_opt_type != IP_TUNNEL_VXLAN_OPT_BIT) {
-		NL_SET_ERR_MSG_MOD(extack, "Wrong VxLAN option type: not GBP");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Wrong VxLAN option type: not GBP");
 		return -EOPNOTSUPP;
 	}
 
 	if (enc_opts.key->len != sizeof(*gbp) ||
 	    enc_opts.mask->len != sizeof(*gbp_mask)) {
-		NL_SET_ERR_MSG_MOD(extack, "VxLAN GBP option/mask len is not 32 bits");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "VxLAN GBP option/mask len is not 32 bits");
 		return -EINVAL;
 	}
 
@@ -140,7 +140,7 @@ static int mlx5e_tc_tun_parse_vxlan_gbp_option(struct mlx5e_priv *priv,
 	gbp_mask = (u32 *)&enc_opts.mask->data[0];
 
 	if (*gbp_mask & ~VXLAN_GBP_MASK) {
-		NL_SET_ERR_MSG_FMT_MOD(extack, "Wrong VxLAN GBP mask(0x%08X)", *gbp_mask);
+		MLX5_NL_SET_ERR_MSG_FMT_MOD(extack, "Wrong VxLAN GBP mask(0x%08X)", *gbp_mask);
 		return -EINVAL;
 	}
 
@@ -209,8 +209,8 @@ static int mlx5e_tc_tun_parse_vxlan(struct mlx5e_priv *priv,
 
 	if (!MLX5_CAP_ESW_FLOWTABLE_FDB(priv->mdev,
 					ft_field_support.outer_vxlan_vni)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Matching on VXLAN VNI is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Matching on VXLAN VNI is not supported");
 		netdev_warn(priv->netdev,
 			    "Matching on VXLAN VNI is not supported\n");
 		return -EOPNOTSUPP;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +41 -41

265 lines not on this page · raw message

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +22 -23

88 lines not on this page · raw message

drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -2
index ea822c69d137..2e1060ae904a 100644
@@ -3804,8 +3804,8 @@ static int mlx5e_setup_tc_mqprio(struct mlx5e_priv *priv,
 	 * simultaneously with the offloaded HTB.
 	 */
 	if (mlx5e_selq_is_htb_enabled(&priv->selq)) {
-		NL_SET_ERR_MSG_MOD(mqprio->extack,
-				   "MQPRIO cannot be configured when HTB offload is enabled.");
+		MLX5_NL_SET_ERR_MSG_MOD(mqprio->extack,
+					"MQPRIO cannot be configured when HTB offload is enabled.");
 		return -EOPNOTSUPP;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +94 -94

526 lines not on this page · raw message

drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c +14 -14
index 76e35c827da0..934c7d738736 100644
@@ -1615,13 +1615,13 @@ static int mlx5_esw_bridge_vport_link_with_flags(struct net_device *br_netdev, u
 
 	bridge = mlx5_esw_bridge_lookup(br_netdev, br_offloads);
 	if (IS_ERR(bridge)) {
-		NL_SET_ERR_MSG_MOD(extack, "Error checking for existing bridge with same ifindex");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Error checking for existing bridge with same ifindex");
 		return PTR_ERR(bridge);
 	}
 
 	err = mlx5_esw_bridge_vport_init(vport_num, esw_owner_vhca_id, flags, br_offloads, bridge);
 	if (err) {
-		NL_SET_ERR_MSG_MOD(extack, "Error initializing port");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Error initializing port");
 		goto err_vport;
 	}
 	return 0;
@@ -1649,17 +1649,17 @@ int mlx5_esw_bridge_vport_unlink(struct net_device *br_netdev, u16 vport_num,
 
 	port = mlx5_esw_bridge_port_lookup(vport_num, esw_owner_vhca_id, br_offloads);
 	if (!port) {
-		NL_SET_ERR_MSG_MOD(extack, "Port is not attached to any bridge");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Port is not attached to any bridge");
 		return -EINVAL;
 	}
 	if (port->bridge->ifindex != br_netdev->ifindex) {
-		NL_SET_ERR_MSG_MOD(extack, "Port is attached to another bridge");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Port is attached to another bridge");
 		return -EINVAL;
 	}
 
 	err = mlx5_esw_bridge_vport_cleanup(br_offloads, port);
 	if (err)
-		NL_SET_ERR_MSG_MOD(extack, "Port cleanup failed");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Port cleanup failed");
 	return err;
 }
 
@@ -1706,7 +1706,7 @@ int mlx5_esw_bridge_port_vlan_add(u16 vport_num, u16 esw_owner_vhca_id, u16 vid,
 	vlan = mlx5_esw_bridge_vlan_create(port->bridge->vlan_proto, vid, flags, port,
 					   br_offloads->esw);
 	if (IS_ERR(vlan)) {
-		NL_SET_ERR_MSG_MOD(extack, "Failed to create VLAN entry");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Failed to create VLAN entry");
 		return PTR_ERR(vlan);
 	}
 	return 0;
@@ -1862,9 +1862,9 @@ int mlx5_esw_bridge_port_mdb_add(struct net_device *dev, u16 vport_num, u16 esw_
 		esw_warn(br_offloads->esw->dev,
 			 "Failed to lookup bridge port to add MDB (MAC=%pM,vport=%u)\n",
 			 addr, vport_num);
-		NL_SET_ERR_MSG_FMT_MOD(extack,
-				       "Failed to lookup bridge port to add MDB (MAC=%pM,vport=%u)",
-				       addr, vport_num);
+		MLX5_NL_SET_ERR_MSG_FMT_MOD(extack,
+					    "Failed to lookup bridge port to add MDB (MAC=%pM,vport=%u)",
+					    addr, vport_num);
 		return -EINVAL;
 	}
 
@@ -1875,17 +1875,17 @@ int mlx5_esw_bridge_port_mdb_add(struct net_device *dev, u16 vport_num, u16 esw_
 			esw_warn(br_offloads->esw->dev,
 				 "Failed to lookup bridge port vlan metadata to create MDB (MAC=%pM,vid=%u,vport=%u)\n",
 				 addr, vid, vport_num);
-			NL_SET_ERR_MSG_FMT_MOD(extack,
-					       "Failed to lookup vlan metadata for MDB (MAC=%pM,vid=%u,vport=%u)",
-					       addr, vid, vport_num);
+			MLX5_NL_SET_ERR_MSG_FMT_MOD(extack,
+						    "Failed to lookup vlan metadata for MDB (MAC=%pM,vid=%u,vport=%u)",
+						    addr, vid, vport_num);
 			return -EINVAL;
 		}
 	}
 
 	err = mlx5_esw_bridge_port_mdb_attach(dev, port, addr, vid);
 	if (err) {
-		NL_SET_ERR_MSG_FMT_MOD(extack, "Failed to add MDB (MAC=%pM,vid=%u,vport=%u)",
-				       addr, vid, vport_num);
+		MLX5_NL_SET_ERR_MSG_FMT_MOD(extack, "Failed to add MDB (MAC=%pM,vid=%u,vport=%u)",
+					    addr, vid, vport_num);
 		return err;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +12 -12
index b6ae384396b3..308fae6afc9f 100644
@@ -162,7 +162,7 @@ static int esw_qos_node_create_sched_element(struct mlx5_esw_sched_node *node, v
 						 &node->ix);
 	if (err) {
 		esw_qos_sched_elem_warn(node, err, "create");
-		NL_SET_ERR_MSG_MOD(extack, "E-Switch create scheduling element failed");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "E-Switch create scheduling element failed");
 	}
 
 	return err;
@@ -178,7 +178,7 @@ static int esw_qos_node_destroy_sched_element(struct mlx5_esw_sched_node *node,
 						  node->ix);
 	if (err) {
 		esw_qos_sched_elem_warn(node, err, "destroy");
-		NL_SET_ERR_MSG_MOD(extack, "E-Switch destroying scheduling element failed.");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "E-Switch destroying scheduling element failed.");
 	}
 
 	return err;
@@ -218,7 +218,7 @@ static int esw_qos_sched_elem_config(struct mlx5_esw_sched_node *node, u32 max_r
 						 bitmask);
 	if (err) {
 		esw_qos_sched_elem_warn(node, err, "modify");
-		NL_SET_ERR_MSG_MOD(extack, "E-Switch modify scheduling element failed");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "E-Switch modify scheduling element failed");
 
 		return err;
 	}
@@ -415,13 +415,13 @@ __esw_qos_create_vports_sched_node(struct mlx5_eswitch *esw, struct mlx5_esw_sch
 	err = esw_qos_create_node_sched_elem(esw->dev, esw->qos.root_tsar_ix, 0,
 					     0, &tsar_ix);
 	if (err) {
-		NL_SET_ERR_MSG_MOD(extack, "E-Switch create TSAR for node failed");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "E-Switch create TSAR for node failed");
 		return ERR_PTR(err);
 	}
 
 	node = __esw_qos_alloc_node(esw, tsar_ix, SCHED_NODE_TYPE_VPORTS_TSAR, parent);
 	if (!node) {
-		NL_SET_ERR_MSG_MOD(extack, "E-Switch alloc node failed");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "E-Switch alloc node failed");
 		err = -ENOMEM;
 		goto err_alloc_node;
 	}
@@ -435,7 +435,7 @@ __esw_qos_create_vports_sched_node(struct mlx5_eswitch *esw, struct mlx5_esw_sch
 	if (mlx5_destroy_scheduling_element_cmd(esw->dev,
 						SCHEDULING_HIERARCHY_E_SWITCH,
 						tsar_ix))
-		NL_SET_ERR_MSG_MOD(extack, "E-Switch destroy TSAR for node failed");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "E-Switch destroy TSAR for node failed");
 	return ERR_PTR(err);
 }
 
@@ -768,7 +768,7 @@ static int mlx5_esw_qos_max_link_speed_get(struct mlx5_core_dev *mdev, u32 *link
 skip_lag:
 	err = mlx5_port_max_linkspeed(mdev, link_speed_max);
 	if (err)
-		NL_SET_ERR_MSG_MOD(extack, "Failed to get link maximum speed");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Failed to get link maximum speed");
 
 	return err;
 }
@@ -780,7 +780,7 @@ static int mlx5_esw_qos_link_speed_verify(struct mlx5_core_dev *mdev,
 	if (value > link_speed_max) {
 		pr_err("%s rate value %lluMbps exceed link maximum speed %u.\n",
 		       name, value, link_speed_max);
-		NL_SET_ERR_MSG_MOD(extack, "TX rate value exceed link maximum speed");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "TX rate value exceed link maximum speed");
 		return -EINVAL;
 	}
 
@@ -832,7 +832,7 @@ static int esw_qos_devlink_rate_to_mbps(struct mlx5_core_dev *mdev, const char *
 	if (remainder) {
 		pr_err("%s rate value %lluBps not in link speed units of 1Mbps.\n",
 		       name, *rate);
-		NL_SET_ERR_MSG_MOD(extack, "TX rate value not in link speed units of 1Mbps");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "TX rate value not in link speed units of 1Mbps");
 		return -EINVAL;
 	}
 
@@ -953,8 +953,8 @@ int mlx5_esw_devlink_rate_node_new(struct devlink_rate *rate_node, void **priv,
 
 	esw_qos_lock(esw);
 	if (esw->mode != MLX5_ESWITCH_OFFLOADS) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Rate node creation supported only in switchdev mode");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Rate node creation supported only in switchdev mode");
 		err = -EOPNOTSUPP;
 		goto unlock;
 	}
@@ -991,7 +991,7 @@ int mlx5_esw_qos_vport_update_parent(struct mlx5_vport *vport, struct mlx5_esw_s
 	int err = 0;
 
 	if (parent && parent->esw != esw) {
-		NL_SET_ERR_MSG_MOD(extack, "Cross E-Switch scheduling is not supported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Cross E-Switch scheduling is not supported");
 		return -EOPNOTSUPP;
 	}
 
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +60 -60

355 lines not on this page · raw message

drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +8 -8
index 23a7e8e7adfa..cfaa9eeb5c6a 100644
@@ -3705,28 +3705,28 @@ static int mlx5_fs_mode_validate(struct devlink *devlink, u32 id,
 		bool smfs_cap = mlx5_fs_dr_is_supported(dev);
 
 		if (!smfs_cap) {
-			NL_SET_ERR_MSG_MOD(extack,
-					   "Software managed steering is not supported by current device");
+			MLX5_NL_SET_ERR_MSG_MOD(extack,
+						"Software managed steering is not supported by current device");
 			return -EOPNOTSUPP;
 		}
 	} else if (!strcmp(value, "hmfs")) {
 		bool hmfs_cap = mlx5_fs_hws_is_supported(dev);
 
 		if (!hmfs_cap) {
-			NL_SET_ERR_MSG_MOD(extack,
-					   "Hardware steering is not supported by current device");
+			MLX5_NL_SET_ERR_MSG_MOD(extack,
+						"Hardware steering is not supported by current device");
 			return -EOPNOTSUPP;
 		}
 	} else {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Bad parameter: supported values are [\"dmfs\", \"smfs\", \"hmfs\"]");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"Bad parameter: supported values are [\"dmfs\", \"smfs\", \"hmfs\"]");
 		return -EINVAL;
 	}
 
 	eswitch_mode = mlx5_eswitch_mode(dev);
 	if (eswitch_mode == MLX5_ESWITCH_OFFLOADS) {
-		NL_SET_ERR_MSG_FMT_MOD(extack,
-				       "Moving to %s is not supported when eswitch offloads enabled.",
+		MLX5_NL_SET_ERR_MSG_FMT_MOD(extack,
+					    "Moving to %s is not supported when eswitch offloads enabled.",
 				       value);
 		return -EOPNOTSUPP;
 	}
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +7 -7
index 5442a02c4097..12727ada6f86 100644
@@ -149,21 +149,21 @@ static int mlx5_fw_reset_get_reset_state_err(struct mlx5_core_dev *dev,
 	switch (reset_state) {
 	case MLX5_MFRL_REG_RESET_STATE_IN_NEGOTIATION:
 	case MLX5_MFRL_REG_RESET_STATE_RESET_IN_PROGRESS:
-		NL_SET_ERR_MSG_MOD(extack, "Sync reset still in progress");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Sync reset still in progress");
 		return -EBUSY;
 	case MLX5_MFRL_REG_RESET_STATE_NEG_TIMEOUT:
-		NL_SET_ERR_MSG_MOD(extack, "Sync reset negotiation timeout");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Sync reset negotiation timeout");
 		return -ETIMEDOUT;
 	case MLX5_MFRL_REG_RESET_STATE_NACK:
-		NL_SET_ERR_MSG_MOD(extack, "One of the hosts disabled reset");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "One of the hosts disabled reset");
 		return -EPERM;
 	case MLX5_MFRL_REG_RESET_STATE_UNLOAD_TIMEOUT:
-		NL_SET_ERR_MSG_MOD(extack, "Sync reset unload timeout");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Sync reset unload timeout");
 		return -ETIMEDOUT;
 	}
 
 out:
-	NL_SET_ERR_MSG_MOD(extack, "Sync reset failed");
+	MLX5_NL_SET_ERR_MSG_MOD(extack, "Sync reset failed");
 	return -EIO;
 }
 
@@ -191,7 +191,7 @@ int mlx5_fw_reset_set_reset_sync(struct mlx5_core_dev *dev, u8 reset_type_sel,
 		return rst_res ? rst_res : err;
 	}
 
-	NL_SET_ERR_MSG_MOD(extack, "Sync reset command failed");
+	MLX5_NL_SET_ERR_MSG_MOD(extack, "Sync reset command failed");
 	return mlx5_cmd_check(dev, err, in, out);
 }
 
@@ -210,7 +210,7 @@ int mlx5_fw_reset_verify_fw_complete(struct mlx5_core_dev *dev,
 		return 0;
 
 	mlx5_core_err(dev, "Sync reset did not complete, state=%d\n", rst_state);
-	NL_SET_ERR_MSG_MOD(extack, "Sync reset did not complete successfully");
+	MLX5_NL_SET_ERR_MSG_MOD(extack, "Sync reset did not complete successfully");
 	return rst_state;
 }
 
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +4 -4
index d058cbb4a00c..664158240afb 100644
@@ -1212,11 +1212,11 @@ static int mlx5_handle_changeupper_event(struct mlx5_lag *ldev,
 		return changed;
 
 	if (!mlx5_lag_is_ready(ldev))
-		NL_SET_ERR_MSG_MOD(info->info.extack,
-				   "Can't activate LAG offload, PF is configured with more than 64 VFs");
+		MLX5_NL_SET_ERR_MSG_MOD(info->info.extack,
+					"Can't activate LAG offload, PF is configured with more than 64 VFs");
 	else if (!mode_supported)
-		NL_SET_ERR_MSG_MOD(info->info.extack,
-				   "Can't activate LAG offload, TX type isn't supported");
+		MLX5_NL_SET_ERR_MSG_MOD(info->info.extack,
+					"Can't activate LAG offload, TX type isn't supported");
 
 	return changed;
 }
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c +1 -1
index aad52d3a90e6..98801269f1c2 100644
@@ -205,7 +205,7 @@ int mlx5_lag_mpesw_do_mirred(struct mlx5_core_dev *mdev,
 	if (ldev->mode != MLX5_LAG_MODE_MPESW)
 		return 0;
 
-	NL_SET_ERR_MSG_MOD(extack, "can't forward to bond in mpesw mode");
+	MLX5_NL_SET_ERR_MSG_MOD(extack, "can't forward to bond in mpesw mode");
 	return -EOPNOTSUPP;
 }
 
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +14 -0
index 2e02bdea8361..80256db6b5f9 100644
@@ -98,6 +98,20 @@ do {								\
 			     __func__, __LINE__, current->pid,	\
 			     ##__VA_ARGS__)
 
+#define MLX5_NL_SET_ERR_MSG_MOD(extack, msg) do {		\
+	if (extack)						\
+		NL_SET_ERR_MSG_MOD(extack, msg);		\
+	else							\
+		pr_err(KBUILD_MODNAME ": %s\n", msg);		\
+} while (0)
+
+#define MLX5_NL_SET_ERR_MSG_FMT_MOD(extack, fmt, ...) do {		\
+	if (extack)							\
+		NL_SET_ERR_MSG_FMT_MOD(extack, fmt, ##__VA_ARGS__);	\
+	else								\
+		pr_err(KBUILD_MODNAME ": " fmt "\n", ##__VA_ARGS__);	\
+} while (0)
+
 #define ACCESS_KEY_LEN  32
 #define FT_ID_FT_TYPE_OFFSET 24
 
drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c +12 -13
index 0864ba625c07..97ad445a6fdd 100644
@@ -63,7 +63,7 @@ mlx5_sf_alloc(struct mlx5_sf_table *table, struct mlx5_eswitch *esw,
 	int err;
 
 	if (!mlx5_esw_offloads_controller_valid(esw, controller)) {
-		NL_SET_ERR_MSG_MOD(extack, "Invalid controller number");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Invalid controller number");
 		return ERR_PTR(-EINVAL);
 	}
 
@@ -98,7 +98,7 @@ mlx5_sf_alloc(struct mlx5_sf_table *table, struct mlx5_eswitch *esw,
 	mlx5_sf_hw_table_sf_free(table->dev, controller, id_err);
 id_err:
 	if (err == -EEXIST)
-		NL_SET_ERR_MSG_MOD(extack, "SF already exist. Choose different sfnum");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "SF already exist. Choose different sfnum");
 	return ERR_PTR(err);
 }
 
@@ -167,7 +167,7 @@ static int mlx5_sf_activate(struct mlx5_core_dev *dev, struct mlx5_sf *sf,
 	if (mlx5_sf_is_active(sf))
 		return 0;
 	if (sf->hw_state != MLX5_VHCA_STATE_ALLOCATED) {
-		NL_SET_ERR_MSG_MOD(extack, "SF is inactivated but it is still attached");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "SF is inactivated but it is still attached");
 		return -EBUSY;
 	}
 
@@ -267,26 +267,25 @@ mlx5_sf_new_check_attr(struct mlx5_core_dev *dev, const struct devlink_port_new_
 		       struct netlink_ext_ack *extack)
 {
 	if (new_attr->flavour != DEVLINK_PORT_FLAVOUR_PCI_SF) {
-		NL_SET_ERR_MSG_MOD(extack, "Driver supports only SF port addition");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Driver supports only SF port addition");
 		return -EOPNOTSUPP;
 	}
 	if (new_attr->port_index_valid) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "Driver does not support user defined port index assignment");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Driver does not support user defined port index assignment");
 		return -EOPNOTSUPP;
 	}
 	if (!new_attr->sfnum_valid) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "User must provide unique sfnum. Driver does not support auto assignment");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"User must provide unique sfnum. Driver does not support auto assignment");
 		return -EOPNOTSUPP;
 	}
 	if (new_attr->controller_valid && new_attr->controller &&
 	    !mlx5_core_is_ecpf_esw_manager(dev)) {
-		NL_SET_ERR_MSG_MOD(extack, "External controller is unsupported");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "External controller is unsupported");
 		return -EOPNOTSUPP;
 	}
 	if (new_attr->pfnum != PCI_FUNC(dev->pdev->devfn)) {
-		NL_SET_ERR_MSG_MOD(extack, "Invalid pfnum supplied");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "Invalid pfnum supplied");
 		return -EOPNOTSUPP;
 	}
 	return 0;
@@ -312,13 +311,13 @@ int mlx5_devlink_sf_port_new(struct devlink *devlink,
 		return err;
 
 	if (!mlx5_sf_table_supported(dev)) {
-		NL_SET_ERR_MSG_MOD(extack, "SF ports are not supported.");
+		MLX5_NL_SET_ERR_MSG_MOD(extack, "SF ports are not supported.");
 		return -EOPNOTSUPP;
 	}
 
 	if (!is_mdev_switchdev_mode(dev)) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "SF ports are only supported in eswitch switchdev mode.");
+		MLX5_NL_SET_ERR_MSG_MOD(extack,
+					"SF ports are only supported in eswitch switchdev mode.");
 		return -EOPNOTSUPP;
 	}
 
Signature · 1 line
2.31.1
maintainer
#3 lore raw

Re: [PATCH net-next 2/2] net/mlx5e: Log error messages when extack is not present

Quoted 8 lines · On Sun, 25 May 2025 14:47:32 +0300 Tariq Toukan wrote:

Encapsulate netlink error message macros to ensure error message remain visible in dmesg when the userspace does not support netlink.

This allows drivers to continue providing meaningful error messages even when netlink is available in kernel but not in userspace.

Replace direct extack macro calls with new wrapper macros to support this fallback behavior.

Please break this down API by API and explain for each why user space can't use netlink. If we thought this was a good idea we would have added the pr_err() to the NL_SET_ERR_MSG_MOD() from the start.

Signature · 1 line
pw-bot: cr
#4 lore raw

Re: [PATCH net-next 2/2] net/mlx5e: Log error messages when extack is not present

Quoted 7 lines · Jakub Kicinski
Quoted 6 lines · On Sun, 25 May 2025 14:47:32 +0300 Tariq Toukan wrote:

Encapsulate netlink error message macros to ensure error message remain visible in dmesg when the userspace does not support netlink.

This allows drivers to continue providing meaningful error messages even when netlink is available in kernel but not in userspace.

Quoted 6 lines
Quoted 2 lines

Replace direct extack macro calls with new wrapper macros to support this fallback behavior.

Please break this down API by API and explain for each why user space can't use netlink. If we thought this was a good idea we would have added the pr_err() to the NL_SET_ERR_MSG_MOD() from the start.

Hi Jakub,

Thanks for the feedback.

To clarify: extack can be NULL when userspace tools (like ethtool, tc, or devlink) send Netlink messages without the NLM_F_ACK flag. In such cases, the kernel usually won’t send an NLMSG_ERROR unless the failure is immediate. For more complex or asynchronous operations (like hardware offloads), NLM_F_ACK enables meaningful error reporting; otherwise, userspace might see only a generic errno or nothing at all.

The NL_SET_ERR_MSG_MOD() and NL_SET_ERR_MSG_FMT_MOD() macros are safe in this context—they internally check for extack and no-op if it’s NULL.

Regarding the APIs modified in this patch:

Ethtool APIs: While Netlink support was introduced around versions 5.6–5.8, many LTS distributions (e.g., Ubuntu 20.04, CentOS 7) still ship with older userspace ethtool utilities that rely on ioctl for certain operations. In these ioctl-based paths, the extack pointer passed down to the driver may legitimately be NULL.

TC APIs: Even though TC is predominantly Netlink-based, extack can still be NULL in certain internal driver code, legacy handling, or specific test/debug scenarios.

If a narrower scope is preferred, I can revise the patch to include only the ethtool-related changes, which were the primary motivation behind this work.

Thanks again,
Yael Chemla

maintainer
#5 lore raw

Re: [PATCH net-next 2/2] net/mlx5e: Log error messages when extack is not present

Quoted 5 lines · On Wed, 4 Jun 2025 00:01:05 +0300 Yael Chemla wrote:

Ethtool APIs: While Netlink support was introduced around versions 5.6–5.8, many LTS distributions (e.g., Ubuntu 20.04, CentOS 7) still ship with older userspace ethtool utilities that rely on ioctl for certain operations. In these ioctl-based paths, the extack pointer passed down to the driver may legitimately be NULL.

Ubuntu 20.04 is EOL, and so is CentOS 7.

Quoted 7 lines

TC APIs: Even though TC is predominantly Netlink-based, extack can still be NULL in certain internal driver code, legacy handling, or specific test/debug scenarios.

If a narrower scope is preferred, I can revise the patch to include only the ethtool-related changes, which were the primary motivation behind this work.

Do you expect the users to update their kernels but not be able to update the CLI? Finding and migrating the stragglers to netlink is probably a better time investment. The "print to logs if extack is NULL" idea keeps coming back since the early days of extack. We filled the few remaining gaps since then (mostly the ability to use formatted strings). We should only break the general policy of "users should switch to netlink if they want meaningful errors" for really narrow, and well defined cases.

#6 lore raw

Re: [PATCH net-next 2/2] net/mlx5e: Log error messages when extack is not present

In reply to Yael Chemla
Quoted 5 lines · Yael Chemla

Ethtool APIs: While Netlink support was introduced around versions 5.6–5.8, many LTS distributions (e.g., Ubuntu 20.04, CentOS 7) still ship with older userspace ethtool utilities that rely on ioctl for certain operations. In these ioctl-based paths, the extack pointer passed down to the driver may legitimately be NULL.

[...]

Quoted 3 lines

If a narrower scope is preferred, I can revise the patch to include only the ethtool-related changes, which were the primary motivation behind this work.

FWIW, there is a netlink extack tracepoint that is always triggered from NL_SET_ERR_MSG(). Example:

ethtool$ ./configure --disable-netlink &> /dev/null ethtool$ make -j14 &> /dev/null

# echo "10 1" > /sys/bus/netdevsim/new_device
# echo 1 > /sys/kernel/tracing/events/netlink/netlink_extack/enable
# cat /sys/kernel/tracing/trace_pipe &
[1] 390
# ./ethtool --set-ring eni10np1 rx 1
         ethtool-413     [008] .....    80.588053: netlink_extack: msg=netdevsim: testing123

Used this dummy patch:

drivers/net/netdevsim/ethtool.c +1 -0
index 4d191a3293c7..38022e8e1f37 100644
@@ -85,6 +85,7 @@ static int nsim_set_ringparam(struct net_device *dev,
 {
 	struct netdevsim *ns = netdev_priv(dev);
 
+	NL_SET_ERR_MSG_MOD(extack, "testing123");
 	ns->ethtool.ring.rx_pending = ring->rx_pending;
 	ns->ethtool.ring.rx_jumbo_pending = ring->rx_jumbo_pending;
 	ns->ethtool.ring.rx_mini_pending = ring->rx_mini_pending;