mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net/mlx5e: Align setdcbx with DCBX capability flags
@ 2026-10-11 11:28 Tariq Toukan
  2026-10-11 11:28 ` [PATCH net-next 1/2] net/mlx5e: Select DCBX HOST/AUTO from capability flags in setdcbx Tariq Toukan
  2026-10-11 11:29 ` [PATCH net-next 2/2] net/mlx5e: Add DCB_CAP_DCBX_LLD_MANAGED support " Tariq Toukan
  0 siblings, 2 replies; 3+ messages in thread
From: Tariq Toukan @ 2026-10-11 11:28 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni
  Cc: Alexei Lazar, Carolina Jubran, Dragos Tatulea, Gal Pressman,
	Leon Romanovsky, open list, linux-rdma, Mark Bloch,
	Saeed Mahameed, Tariq Toukan

Hi,

This series by Alexei aligns the mlx5e DCBX mode handling in the setdcbx
DCB callback with the DCBX capability flags.

Today mlx5e_dcbnl_setdcbx() applies two different policies: a request of
mode 0 switches the firmware to AUTO, while any other request is
accepted only if it carries DCB_CAP_DCBX_HOST. Requests with
DCB_CAP_DCBX_LLD_MANAGED are rejected outright, even though that flag
describes exactly the case where DCBX negotiation is done by the
firmware/LLD agent rather than by the host.

Patch 1 switches the firmware between HOST and AUTO modes based solely
on the DCB_CAP_DCBX_HOST bit, which folds the two code paths into one
and removes the dedicated switch-to-host helper. When moving to
firmware-controlled mode, CEE, IEEE and LLD_MANAGED are reported
together due to a firmware limitation.

Patch 2 drops the rejection of DCB_CAP_DCBX_LLD_MANAGED, so that
requesting it switches to firmware-controlled DCBX mode.

Regards,
Tariq

Alexei Lazar (2):
  net/mlx5e: Select DCBX HOST/AUTO from capability flags in setdcbx
  net/mlx5e: Add DCB_CAP_DCBX_LLD_MANAGED support in setdcbx

 .../ethernet/mellanox/mlx5/core/en_dcbnl.c    | 51 +++++--------------
 1 file changed, 14 insertions(+), 37 deletions(-)


base-commit: d8674294aefef02266c4d47ad10131f1bffbe534
-- 
2.44.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH net-next 1/2] net/mlx5e: Select DCBX HOST/AUTO from capability flags in setdcbx
  2026-10-11 11:28 [PATCH net-next 0/2] net/mlx5e: Align setdcbx with DCBX capability flags Tariq Toukan
@ 2026-10-11 11:28 ` Tariq Toukan
  2026-10-11 11:29 ` [PATCH net-next 2/2] net/mlx5e: Add DCB_CAP_DCBX_LLD_MANAGED support " Tariq Toukan
  1 sibling, 0 replies; 3+ messages in thread
From: Tariq Toukan @ 2026-10-11 11:28 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni
  Cc: Alexei Lazar, Carolina Jubran, Dragos Tatulea, Gal Pressman,
	Leon Romanovsky, open list, linux-rdma, Mark Bloch,
	Saeed Mahameed, Tariq Toukan

From: Alexei Lazar <alazar@nvidia.com>

mlx5e_dcbnl_setdcbx() used two different policies: mode 0 switched
firmware to AUTO, and any other request was accepted only with
DCB_CAP_DCBX_HOST.

Switch the firmware HOST/AUTO modes based on the DCB_CAP_DCBX_HOST
bit. This better aligns with the DCBX capability flags. It also
allows folding the two different code paths into one.

When switching to firmware-controlled (non-host) mode, report CEE,
IEEE and LLD_MANAGED together due to a FW limitation.

Signed-off-by: Alexei Lazar <alazar@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 .../ethernet/mellanox/mlx5/core/en_dcbnl.c    | 48 ++++++-------------
 1 file changed, 14 insertions(+), 34 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
index 741f75b5bfec..4eef929f5ae9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
@@ -99,25 +99,6 @@ static int mlx5e_dcbnl_set_dcbx_mode(struct mlx5e_priv *priv,
 	return mlx5_set_port_dcbx_param(mdev, param);
 }
 
-static int mlx5e_dcbnl_switch_to_host_mode(struct mlx5e_priv *priv)
-{
-	struct mlx5e_dcbx *dcbx = &priv->dcbx;
-	int err;
-
-	if (!MLX5_CAP_GEN(priv->mdev, dcbx))
-		return 0;
-
-	if (dcbx->mode == MLX5E_DCBX_PARAM_VER_OPER_HOST)
-		return 0;
-
-	err = mlx5e_dcbnl_set_dcbx_mode(priv, MLX5E_DCBX_PARAM_VER_OPER_HOST);
-	if (err)
-		return err;
-
-	dcbx->mode = MLX5E_DCBX_PARAM_VER_OPER_HOST;
-	return 0;
-}
-
 static int mlx5e_dcbnl_ieee_getets(struct net_device *netdev,
 				   struct ieee_ets *ets)
 {
@@ -453,32 +434,31 @@ static u8 mlx5e_dcbnl_getdcbx(struct net_device *dev)
 
 static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode)
 {
+	bool new_is_host = mode & DCB_CAP_DCBX_HOST;
 	struct mlx5e_priv *priv = netdev_priv(dev);
 	struct mlx5e_dcbx *dcbx = &priv->dcbx;
+	enum mlx5_dcbx_oper_mode target_mode;
 
 	if (mode & DCB_CAP_DCBX_LLD_MANAGED)
 		return 1;
 
-	if ((!mode) && MLX5_CAP_GEN(priv->mdev, dcbx)) {
-		if (dcbx->mode == MLX5E_DCBX_PARAM_VER_OPER_AUTO)
-			return 0;
-
-		/* set dcbx to fw controlled */
-		if (!mlx5e_dcbnl_set_dcbx_mode(priv, MLX5E_DCBX_PARAM_VER_OPER_AUTO)) {
-			dcbx->mode = MLX5E_DCBX_PARAM_VER_OPER_AUTO;
-			dcbx->cap &= ~DCB_CAP_DCBX_HOST;
-			return 0;
-		}
+	if (!MLX5_CAP_GEN(priv->mdev, dcbx))
+		return !new_is_host;
 
-		return 1;
-	}
+	target_mode = new_is_host ? MLX5E_DCBX_PARAM_VER_OPER_HOST :
+				    MLX5E_DCBX_PARAM_VER_OPER_AUTO;
+	if (dcbx->mode == target_mode)
+		return 0;
 
-	if (!(mode & DCB_CAP_DCBX_HOST))
+	if (mlx5e_dcbnl_set_dcbx_mode(priv, target_mode))
 		return 1;
 
-	if (mlx5e_dcbnl_switch_to_host_mode(netdev_priv(dev)))
-		return 1;
+	if (!new_is_host)
+		mode = DCB_CAP_DCBX_VER_CEE |
+		       DCB_CAP_DCBX_VER_IEEE |
+		       DCB_CAP_DCBX_LLD_MANAGED;
 
+	dcbx->mode = target_mode;
 	dcbx->cap = mode;
 
 	return 0;
-- 
2.44.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH net-next 2/2] net/mlx5e: Add DCB_CAP_DCBX_LLD_MANAGED support in setdcbx
  2026-10-11 11:28 [PATCH net-next 0/2] net/mlx5e: Align setdcbx with DCBX capability flags Tariq Toukan
  2026-10-11 11:28 ` [PATCH net-next 1/2] net/mlx5e: Select DCBX HOST/AUTO from capability flags in setdcbx Tariq Toukan
@ 2026-10-11 11:29 ` Tariq Toukan
  1 sibling, 0 replies; 3+ messages in thread
From: Tariq Toukan @ 2026-10-11 11:29 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni
  Cc: Alexei Lazar, Carolina Jubran, Dragos Tatulea, Gal Pressman,
	Leon Romanovsky, open list, linux-rdma, Mark Bloch,
	Saeed Mahameed, Tariq Toukan

From: Alexei Lazar <alazar@nvidia.com>

Add support for DCB_CAP_DCBX_LLD_MANAGED, which indicates that DCBX
negotiation is performed by the firmware/LLD agent rather than the host.

When DCB_CAP_DCBX_LLD_MANAGED is requested, switch to
firmware-controlled DCBX mode.

Signed-off-by: Alexei Lazar <alazar@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
index 4eef929f5ae9..68deedb6f82e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
@@ -439,9 +439,6 @@ static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode)
 	struct mlx5e_dcbx *dcbx = &priv->dcbx;
 	enum mlx5_dcbx_oper_mode target_mode;
 
-	if (mode & DCB_CAP_DCBX_LLD_MANAGED)
-		return 1;
-
 	if (!MLX5_CAP_GEN(priv->mdev, dcbx))
 		return !new_is_host;
 
-- 
2.44.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-11 11:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-11 11:28 [PATCH net-next 0/2] net/mlx5e: Align setdcbx with DCBX capability flags Tariq Toukan
2026-10-11 11:28 ` [PATCH net-next 1/2] net/mlx5e: Select DCBX HOST/AUTO from capability flags in setdcbx Tariq Toukan
2026-10-11 11:29 ` [PATCH net-next 2/2] net/mlx5e: Add DCB_CAP_DCBX_LLD_MANAGED support " Tariq Toukan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®