From nobody Tue Feb 08 15:14:11 2022 X-Original-To: dev-commits-src-all@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 7B37719C410E; Tue, 8 Feb 2022 15:14:14 +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 4JtRPJ6DnBz4dj9; Tue, 8 Feb 2022 15:14:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644333254; 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=YUCzWgOgPtSaeLzfhTVGqTh4BJdkN0Dh/3hyH20P/Zk=; b=gfvDDO634xDpwHW7dPMpJrg0cTQfjL2WMNPB6n8Nx6gQV65AlgkPdJhhhaOTeitrjeE64T U2iDQvhdoA4yKs7fQO1RGiiB1jvLxC+xRo4jQmoZUJkEfuNwLHqXnv4J1DGLTJ/ReDUAB5 23Co+JF1uIZdiAUIZSSZQ5Ov5sAP8LY58nF/LknSlfyaUd2dJf6ue3J95RDBRthZRnJriM 23f08r0xiNyHjsr7Mc/1XEBuEKq8NRrTkMzLBMdcd4U99FuXWYAy7DD4CNQp0BIhfhUjvn 4LRskDfVRWdbNvsFLBga7pBs4uVe88kRNMvyOFoNaTG54td4VGS04fcUmwByvQ== 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 10BF71BB96; Tue, 8 Feb 2022 15:14:12 +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 218FEB00020962; Tue, 8 Feb 2022 15:14:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 218FEBEb020961; Tue, 8 Feb 2022 15:14:11 GMT (envelope-from git) Date: Tue, 8 Feb 2022 15:14:11 GMT Message-Id: <202202081514.218FEBEb020961@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 7fb8dd15fa24 - stable/13 - mlx5: Implement mlx5_nic_vport_update_local_lb() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7fb8dd15fa241f35c99b7f1c0b7582067cee0776 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644333254; 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=YUCzWgOgPtSaeLzfhTVGqTh4BJdkN0Dh/3hyH20P/Zk=; b=QGNfp6VDSG2PeZ0PAI4fwoDlEvPqVm7783Fil8PR8Tv9p43zbc3F8vt8cJpUu6MxQcdVuc ZUc1pjcRxIX4R7fklAy6+7QOAUcWvSckmWwuUDRxqRAldWYY4w6Fy1QKstXCuOTo9DH1mV VQrm3clmbVowaGAL2AvJOOgSZdV/G7AdKLEy48VbpbHUBNZcxMJ4Bq6THsNoujmcOmW+UF D/KS8AVbNdpnGk4NmffsmTv8PzucDqLV4ojAo1QOff1jqX11l8jUy0/8Qq1Nz8mZYM8QnN TjjcAW0poVfdWYrbaR2f/c265lM53nXjJc0AoEE3QsUdGxUl4EqhhOilovGFMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644333254; a=rsa-sha256; cv=none; b=JDdCJfBKVVBxSACraGTqO5giRmlbHcvwrubxYZnyPZxn51nY3rPX0P1aoUQ9Tj81jekKaB AIH00mBjdwy7f8ZfqWt/buQPQc1gzwDN7gFkLaAAyS2p683GsD/Y9a45iHs/7Dlsn4BqFY 0S0b9CLasyERQN7EKMwt7eS5i/EUgepyIfZVouwG8BP68hO8Zia9f1fzgD7mpzdbg1HYrE tpQUU950Wbkz0kv6PV5Nd7IrMhzc16YgDt+uGLisKRYx4Z4ZktyXX1p9paxxGOTB6/Iyof 0JNUpWJFnWpu/W2hR1y3YlVMvTJLLhYNnT94eVD29lDLVgG4PuXL2e5aFSFoTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=7fb8dd15fa241f35c99b7f1c0b7582067cee0776 commit 7fb8dd15fa241f35c99b7f1c0b7582067cee0776 Author: Hans Petter Selasky AuthorDate: 2022-02-08 15:08:54 +0000 Commit: Hans Petter Selasky CommitDate: 2022-02-08 15:08:54 +0000 mlx5: Implement mlx5_nic_vport_update_local_lb() Sponsored by: NVIDIA Networking (cherry picked from commit c1b76119cbf91e0698e2c6264be5f85ebfeea652) --- 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 bea12c63a3a4..627c367eace5 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -1287,8 +1287,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);