From owner-svn-src-head@freebsd.org Fri Nov 10 14:14:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34D72E6EF67; Fri, 10 Nov 2017 14:14:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E8E775433; Fri, 10 Nov 2017 14:14:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAAEEtlE022561; Fri, 10 Nov 2017 14:14:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAAEEsOk022559; Fri, 10 Nov 2017 14:14:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711101414.vAAEEsOk022559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 10 Nov 2017 14:14:54 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 325660 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 14:14:56 -0000 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,