Skip to content

Commit 0eca995

Browse files
Huy Nguyendavem330
authored andcommitted
net/mlx5e: Add DCBX control interface
Use setdcbx interface to set the DCBX mode to firmware or os. If setdcbx is called with mode value of zero, the DCBX mode is set to firmware. Signed-off-by: Huy Nguyen <huyn@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e207b7e commit 0eca995

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,34 @@ static int mlx5e_dcbnl_ieee_setpfc(struct net_device *dev,
287287

288288
static u8 mlx5e_dcbnl_getdcbx(struct net_device *dev)
289289
{
290-
return DCB_CAP_DCBX_HOST |
291-
DCB_CAP_DCBX_VER_IEEE |
292-
DCB_CAP_DCBX_VER_CEE;
290+
struct mlx5e_priv *priv = netdev_priv(dev);
291+
struct mlx5e_dcbx *dcbx = &priv->dcbx;
292+
u8 mode = DCB_CAP_DCBX_VER_IEEE | DCB_CAP_DCBX_VER_CEE;
293+
294+
if (dcbx->mode == MLX5E_DCBX_PARAM_VER_OPER_HOST)
295+
mode |= DCB_CAP_DCBX_HOST;
296+
297+
return mode;
293298
}
294299

295300
static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode)
296301
{
302+
struct mlx5e_priv *priv = netdev_priv(dev);
303+
struct mlx5e_dcbx *dcbx = &priv->dcbx;
304+
305+
if ((!mode) && MLX5_CAP_GEN(priv->mdev, dcbx)) {
306+
if (dcbx->mode == MLX5E_DCBX_PARAM_VER_OPER_AUTO)
307+
return 0;
308+
309+
/* set dcbx to fw controlled */
310+
if (!mlx5e_dcbnl_set_dcbx_mode(priv, MLX5E_DCBX_PARAM_VER_OPER_AUTO)) {
311+
dcbx->mode = MLX5E_DCBX_PARAM_VER_OPER_AUTO;
312+
return 0;
313+
}
314+
315+
return 1;
316+
}
317+
297318
if (mlx5e_dcbnl_switch_to_host_mode(netdev_priv(dev)))
298319
return 1;
299320

0 commit comments

Comments
 (0)