From nobody Tue Feb 01 15:24:34 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A0FCC19169E7; Tue, 1 Feb 2022 15:24:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jp7yW1Xjjz3FlK; Tue, 1 Feb 2022 15:24:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643729075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YxR9l5l5LfZmYQY6ZqnL+oifIErN2Ds8wk7ChCateLA=; b=fRGHaGIBUAgaOFDe+UiE/Hclrj0SNcI9PlP3Pd6ggs0t6rx7uHE8IGDwj36Fi59f1I1jph ZMmoyKTk8qSonKN7EL8N/Ijmj8xwaFRrHv/etfxpBRyAhYDOMUimDSx5ZX8ZnOyJwZ4iAJ 8pT9F00OONcqCF8zWWROZanZiyau6hekqJYs5PEWg7bgzWNudb7VM/cvjuG9IW63dNx7Cs NHsxDz9C8uJm55YNfr3p5cl/vjg0gZ/OSxjWmN9JUcsBkfvJH/DXO9yTWq5SYc/Xg4wRuJ I1I3QB64vmxe6zjZ2I9Tag2YFEI2xnoBScoVlo1sVdqBEi05V26L6mkO4LGHIw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFBA813599; Tue, 1 Feb 2022 15:24:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 211FOYvf051322; Tue, 1 Feb 2022 15:24:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 211FOYVw051321; Tue, 1 Feb 2022 15:24:34 GMT (envelope-from git) Date: Tue, 1 Feb 2022 15:24:34 GMT Message-Id: <202202011524.211FOYVw051321@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: c1b76119cbf9 - main - mlx5: Implement mlx5_nic_vport_update_local_lb() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c1b76119cbf91e0698e2c6264be5f85ebfeea652 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643729075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YxR9l5l5LfZmYQY6ZqnL+oifIErN2Ds8wk7ChCateLA=; b=J99Fu/35jfE+BX7FljZHW/5iv96JvwIf0yhzZ0ou1t1h9yVlKzG1b2A05eCuiwJxDWiTeX VWvPhhZmojBZlTbeYiKxvKAFz4Nd0wZw13/T4Fu9KLc+i4YZ6IoMiUnZl2MX1Po8aY3GWg Dlm1DkqkV/LvWsgcNZHFr/2xHYtVHDS64Yo6RvFMazJVXTFhJMdhv9XJmN1K4x20zhKWdS HypUmc97w73mGxqYw0AfM2Tvv+qGIUkfXpma+XUw+dpcrNyTyULed4oitwCD26XsKGCGEY bJx8cqpH0YDh/BbW5Gnn+JQE7W89q6gk8e8778B7d9Micxn5WPOHIMSZzRMVDA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643729075; a=rsa-sha256; cv=none; b=Qq5MTKfpKBjdQgV3RrqRIvIFmIT09axKTfEK45vQ2LKB5ua/APnvnHS1qYvxnzj65hftQR jNiZ6+6g/CyyNwcbQfB9oES4mJ4lacHOxNKYSbhKn3bfzpXeDGGuPcuO+7GSfXrw5ZKxTP dN50N4IJ1D26yEhDIVSZou6LFL+pQXfBbthXf3IO2QKFR+leZB+41oTgUIC7fNKpSkKgeE N6sqbxX4YsUYaNH2ZMJmAbdaaRhPYZ1K/2imLK1BkOyUMUtX1K7d3ilqHOwreP0o1vgu1X Qhf9ChhsbTPqivU06XrSS78DB0M8YTaNnrc01oDlKBhnrTxbF86/3iskBBYxSg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c1b76119cbf91e0698e2c6264be5f85ebfeea652 commit c1b76119cbf91e0698e2c6264be5f85ebfeea652 Author: Hans Petter Selasky AuthorDate: 2022-02-01 15:20:15 +0000 Commit: Hans Petter Selasky CommitDate: 2022-02-01 15:21:16 +0000 mlx5: Implement mlx5_nic_vport_update_local_lb() MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_vport.c | 38 ++++++++++++++++++++++++++++++++++ sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c | 7 ++++--- sys/dev/mlx5/mlx5_ifc.h | 5 +++-- sys/dev/mlx5/vport.h | 1 + 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_vport.c b/sys/dev/mlx5/mlx5_core/mlx5_vport.c index 4c90c3ddf4b6..430d56125666 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_vport.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_vport.c @@ -1510,6 +1510,44 @@ int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev, } EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_promisc); +int mlx5_nic_vport_update_local_lb(struct mlx5_core_dev *mdev, bool enable) +{ + int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in); + void *in; + int err; + + if (!MLX5_CAP_GEN(mdev, disable_local_lb_mc) && + !MLX5_CAP_GEN(mdev, disable_local_lb_uc)) + return 0; + + in = kvzalloc(inlen, GFP_KERNEL); + if (!in) + return -ENOMEM; + + MLX5_SET(modify_nic_vport_context_in, in, + nic_vport_context.disable_mc_local_lb, !enable); + MLX5_SET(modify_nic_vport_context_in, in, + nic_vport_context.disable_uc_local_lb, !enable); + + if (MLX5_CAP_GEN(mdev, disable_local_lb_mc)) + MLX5_SET(modify_nic_vport_context_in, in, + field_select.disable_mc_local_lb, 1); + + if (MLX5_CAP_GEN(mdev, disable_local_lb_uc)) + MLX5_SET(modify_nic_vport_context_in, in, + field_select.disable_uc_local_lb, 1); + + err = mlx5_modify_nic_vport_context(mdev, in, inlen); + + if (!err) + mlx5_core_dbg(mdev, "%s local_lb\n", + enable ? "enable" : "disable"); + + kvfree(in); + return err; +} +EXPORT_SYMBOL_GPL(mlx5_nic_vport_update_local_lb); + int mlx5_nic_vport_modify_local_lb(struct mlx5_core_dev *mdev, enum mlx5_local_lb_selection selection, u8 value) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c index 654a2a15cd56..d07aee1f0793 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c @@ -1233,7 +1233,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) priv->params_ethtool.mc_local_lb = priv->params_ethtool.mc_local_lb ? 1 : 0; - if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) { + if (MLX5_CAP_GEN(priv->mdev, disable_local_lb_mc)) { error = mlx5_nic_vport_modify_local_lb(priv->mdev, MLX5_LOCAL_MC_LB, priv->params_ethtool.mc_local_lb); } else { @@ -1245,7 +1245,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) priv->params_ethtool.uc_local_lb = priv->params_ethtool.uc_local_lb ? 1 : 0; - if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) { + if (MLX5_CAP_GEN(priv->mdev, disable_local_lb_uc)) { error = mlx5_nic_vport_modify_local_lb(priv->mdev, MLX5_LOCAL_UC_LB, priv->params_ethtool.uc_local_lb); } else { @@ -1446,7 +1446,8 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) mlx5e_ethtool_sync_tx_completion_fact(priv); /* get default values for local loopback, if any */ - if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) { + if (MLX5_CAP_GEN(priv->mdev, disable_local_lb_mc) || + MLX5_CAP_GEN(priv->mdev, disable_local_lb_uc)) { int err; u8 val; diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index d128c9cb45cd..e9c7a86e862d 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -1342,8 +1342,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 log_max_wq_sz[0x5]; u8 nic_vport_change_event[0x1]; - u8 disable_local_lb[0x1]; - u8 reserved_59[0x9]; + u8 disable_local_lb_uc[0x1]; + u8 disable_local_lb_mc[0x1]; + u8 reserved_59[0x8]; u8 log_max_vlan_list[0x5]; u8 reserved_60[0x3]; u8 log_max_current_mc_list[0x5]; diff --git a/sys/dev/mlx5/vport.h b/sys/dev/mlx5/vport.h index 61dc9c4880cf..c8eabd1051d4 100644 --- a/sys/dev/mlx5/vport.h +++ b/sys/dev/mlx5/vport.h @@ -56,6 +56,7 @@ enum mlx5_local_lb_selection { int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev, enum mlx5_local_lb_selection selection, u8 *value); +int mlx5_nic_vport_update_local_lb(struct mlx5_core_dev *mdev, bool enable); int mlx5_nic_vport_modify_local_lb(struct mlx5_core_dev *mdev, enum mlx5_local_lb_selection selection, u8 value);