Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Nov 2017 14:14:54 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325660 - head/sys/dev/mlx5/mlx5_en
Message-ID:  <201711101414.vAAEEsOk022559@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Nov 10 14:14:54 2017
New Revision: 325660
URL: https://svnweb.freebsd.org/changeset/base/325660

Log:
  Add support for configuring local multicast and unicast data traffic loopback
  in mlx5en(4) driver via the sysctl interface.
  
  Sponsored by:	Mellanox Technologies
  MFC after:	1 week

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/en.h	Fri Nov 10 14:10:41 2017	(r325659)
+++ head/sys/dev/mlx5/mlx5_en/en.h	Fri Nov 10 14:14:54 2017	(r325660)
@@ -411,7 +411,9 @@ struct mlx5e_params {
   m(+1, u64 modify_tx_dma, "modify_tx_dma", "0: Enable TX 1: Disable TX") \
   m(+1, u64 modify_rx_dma, "modify_rx_dma", "0: Enable RX 1: Disable RX") \
   m(+1, u64 diag_pci_enable, "diag_pci_enable", "0: Disabled 1: Enabled") \
-  m(+1, u64 diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled")
+  m(+1, u64 diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled") \
+  m(+1, u64 mc_local_lb, "mc_local_lb", "0: Local multicast loopback enabled 1: Disabled") \
+  m(+1, u64 uc_local_lb, "uc_local_lb", "0: Local unicast loopback enabled 1: Disabled")
 
 #define	MLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT))
 

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c	Fri Nov 10 14:10:41 2017	(r325659)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c	Fri Nov 10 14:14:54 2017	(r325660)
@@ -421,6 +421,30 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
 		    priv->params_ethtool.diag_general_enable);
 		break;
 
+	case MLX5_PARAM_OFFSET(mc_local_lb):
+		priv->params_ethtool.mc_local_lb =
+		    priv->params_ethtool.mc_local_lb ? 1 : 0;
+
+		if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
+			error = mlx5_nic_vport_modify_local_lb(priv->mdev,
+			    MLX5_LOCAL_MC_LB, priv->params_ethtool.mc_local_lb);
+		} else {
+			error = EOPNOTSUPP;
+		}
+		break;
+
+	case MLX5_PARAM_OFFSET(uc_local_lb):
+		priv->params_ethtool.uc_local_lb =
+		    priv->params_ethtool.uc_local_lb ? 1 : 0;
+
+		if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
+			error = mlx5_nic_vport_modify_local_lb(priv->mdev,
+			    MLX5_LOCAL_UC_LB, priv->params_ethtool.uc_local_lb);
+		} else {
+			error = EOPNOTSUPP;
+		}
+		break;
+
 	default:
 		break;
 	}
@@ -731,6 +755,20 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv)
 	priv->params_ethtool.hw_lro = priv->params.hw_lro_en;
 	priv->params_ethtool.cqe_zipping = priv->params.cqe_zipping_en;
 	mlx5e_ethtool_sync_tx_completion_fact(priv);
+
+	/* get default values for local loopback, if any */
+	if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
+		int err;
+		u8 val;
+
+		err = mlx5_nic_vport_query_local_lb(priv->mdev, MLX5_LOCAL_MC_LB, &val);
+		if (err == 0)
+			priv->params_ethtool.mc_local_lb = val;
+
+		err = mlx5_nic_vport_query_local_lb(priv->mdev, MLX5_LOCAL_UC_LB, &val);
+		if (err == 0)
+			priv->params_ethtool.uc_local_lb = val;
+	}
 
 	/* create root node */
 	node = SYSCTL_ADD_NODE(&priv->sysctl_ctx,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711101414.vAAEEsOk022559>