netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Huy Nguyen <huyn@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [PATCH net-next V2 06/10] net/mlx5e: Add DCBX control interface
Date: Sun, 27 Nov 2016 17:02:08 +0200	[thread overview]
Message-ID: <1480258932-10302-7-git-send-email-saeedm@mellanox.com> (raw)
In-Reply-To: <1480258932-10302-1-git-send-email-saeedm@mellanox.com>

From: Huy Nguyen <huyn@mellanox.com>

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>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c | 27 +++++++++++++++++++---
 1 file changed, 24 insertions(+), 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 1753182..7f6c225 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
@@ -287,13 +287,34 @@ static int mlx5e_dcbnl_ieee_setpfc(struct net_device *dev,
 
 static u8 mlx5e_dcbnl_getdcbx(struct net_device *dev)
 {
-	return DCB_CAP_DCBX_HOST |
-	       DCB_CAP_DCBX_VER_IEEE |
-	       DCB_CAP_DCBX_VER_CEE;
+	struct mlx5e_priv *priv = netdev_priv(dev);
+	struct mlx5e_dcbx *dcbx = &priv->dcbx;
+	u8 mode = DCB_CAP_DCBX_VER_IEEE | DCB_CAP_DCBX_VER_CEE;
+
+	if (dcbx->mode == MLX5E_DCBX_PARAM_VER_OPER_HOST)
+		mode |= DCB_CAP_DCBX_HOST;
+
+	return mode;
 }
 
 static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode)
 {
+	struct mlx5e_priv *priv = netdev_priv(dev);
+	struct mlx5e_dcbx *dcbx = &priv->dcbx;
+
+	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;
+			return 0;
+		}
+
+		return 1;
+	}
+
 	if (mlx5e_dcbnl_switch_to_host_mode(netdev_priv(dev)))
 		return 1;
 
-- 
2.7.4

  parent reply	other threads:[~2016-11-27 15:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-27 15:02 [PATCH net-next V2 00/10] Mellanox 100G mlx5 DCBX and ethtool updates Saeed Mahameed
2016-11-27 15:02 ` [PATCH net-next V2 01/10] net/mlx5e: Add qos capability check Saeed Mahameed
2016-11-27 15:02 ` [PATCH net-next V2 02/10] net/mlx5e: Support DCBX CEE API Saeed Mahameed
2016-11-27 15:02 ` [PATCH net-next V2 03/10] net/mlx5e: Read ETS settings directly from firmware Saeed Mahameed
2016-11-27 15:02 ` [PATCH net-next V2 04/10] net/mlx5: Add DCBX firmware commands support Saeed Mahameed
2016-11-27 15:02 ` [PATCH net-next V2 05/10] net/mlx5e: ConnectX-4 firmware support for DCBX Saeed Mahameed
2016-11-27 15:02 ` Saeed Mahameed [this message]
2016-11-27 15:02 ` [PATCH net-next V2 07/10] net/mlx5e: Add support for ethtool self diagnostics test Saeed Mahameed
2016-11-27 15:02 ` [PATCH net-next V2 08/10] net/mlx5e: Add support for loopback selftest Saeed Mahameed
2016-11-27 15:02 ` [PATCH net-next V2 09/10] net/mlx5e: Moves pflags to priv->params Saeed Mahameed
2016-11-27 15:02 ` [PATCH net-next V2 10/10] net/mlx5e: Add CQE compression user control Saeed Mahameed
2016-11-28 20:10 ` [PATCH net-next V2 00/10] Mellanox 100G mlx5 DCBX and ethtool updates David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480258932-10302-7-git-send-email-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=huyn@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).