From owner-dev-commits-src-branches@freebsd.org Mon Sep 20 23:22:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FA376AF263; Mon, 20 Sep 2021 23:22: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 4HD0vv0vWFz3jrk; Mon, 20 Sep 2021 23:22:35 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EA31C19789; Mon, 20 Sep 2021 23:22: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 18KNMYXA061478; Mon, 20 Sep 2021 23:22:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KNMYco061477; Mon, 20 Sep 2021 23:22:34 GMT (envelope-from git) Date: Mon, 20 Sep 2021 23:22:34 GMT Message-Id: <202109202322.18KNMYco061477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: a89887d57b96 - stable/12 - ixl(4): Add tunable to override Flow Control settings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a89887d57b965e7749e05488f8e8dae7911b3fc3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 23:22:35 -0000 The branch stable/12 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=a89887d57b965e7749e05488f8e8dae7911b3fc3 commit a89887d57b965e7749e05488f8e8dae7911b3fc3 Author: Krzysztof Galazka AuthorDate: 2021-04-05 18:08:33 +0000 Commit: Eric Joyner CommitDate: 2021-09-20 22:11:14 +0000 ixl(4): Add tunable to override Flow Control settings Add flow_control to hw.ixl tunables tree to let override initial flow control configuration for all interfaces. Keep using configuration set by NVM by default. Reviewed by: erj@, gallatin@ Tested by: gowtham.kumar.ks_intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D29338 (cherry picked from commit 20a52706c814ccfd91c65586404abd2a1563a330) --- sys/dev/ixl/if_ixl.c | 19 +++++++++++++++++++ sys/dev/ixl/ixl_pf_iflib.c | 2 +- sys/dev/ixl/ixl_pf_main.c | 40 +++++++++++++++++++++++----------------- 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 09107dbaf2a5..0da7679ee6b3 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -305,6 +305,10 @@ TUNABLE_INT("hw.ixl.tx_itr", &ixl_tx_itr); SYSCTL_INT(_hw_ixl, OID_AUTO, tx_itr, CTLFLAG_RDTUN, &ixl_tx_itr, 0, "TX Interrupt Rate"); +static int ixl_flow_control = -1; +SYSCTL_INT(_hw_ixl, OID_AUTO, flow_control, CTLFLAG_RDTUN, + &ixl_flow_control, 0, "Initial Flow Control setting"); + #ifdef IXL_IW int ixl_enable_iwarp = 0; TUNABLE_INT("hw.ixl.enable_iwarp", &ixl_enable_iwarp); @@ -1881,5 +1885,20 @@ ixl_save_pf_tunables(struct ixl_pf *pf) pf->rx_itr = IXL_ITR_8K; } else pf->rx_itr = ixl_rx_itr; + + pf->fc = -1; + if (ixl_flow_control != -1) { + if (ixl_flow_control < 0 || ixl_flow_control > 3) { + device_printf(dev, + "Invalid flow_control value of %d set!\n", + ixl_flow_control); + device_printf(dev, + "flow_control must be between %d and %d, " + "inclusive\n", 0, 3); + device_printf(dev, + "Using default configuration instead\n"); + } else + pf->fc = ixl_flow_control; + } } diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c index 6d80bb472b72..bf3527bce4ba 100644 --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -1129,7 +1129,7 @@ ixl_sysctl_set_flowcntl(SYSCTL_HANDLER_ARGS) aq_error = i40e_set_fc(hw, &fc_aq_err, TRUE); if (aq_error) { device_printf(dev, - "%s: Error setting new fc mode %d; fc_err %#x\n", + "%s: Error setting Flow Control mode %d; fc_err %#x\n", __func__, aq_error, fc_aq_err); return (EIO); } diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 782d51ac696d..00ab9a84ce97 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -2946,27 +2946,28 @@ ixl_set_link(struct ixl_pf *pf, bool enable) config.phy_type = 0; config.phy_type_ext = 0; + config.abilities &= ~(I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX); + + switch (pf->fc) { + case I40E_FC_FULL: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_RX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_TX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX; + break; + default: + break; + } + if (enable) { config.phy_type = phy_type; config.phy_type_ext = phy_type_ext; - config.abilities &= ~(I40E_AQ_PHY_FLAG_PAUSE_TX | - I40E_AQ_PHY_FLAG_PAUSE_RX); - - switch (pf->fc) { - case I40E_FC_FULL: - config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX | - I40E_AQ_PHY_FLAG_PAUSE_RX; - break; - case I40E_FC_RX_PAUSE: - config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_RX; - break; - case I40E_FC_TX_PAUSE: - config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX; - break; - default: - break; - } } aq_error = i40e_aq_set_phy_config(hw, &config, NULL); @@ -4374,6 +4375,11 @@ ixl_attach_get_link_status(struct ixl_pf *pf) /* Determine link state */ hw->phy.get_link_info = TRUE; i40e_get_link_status(hw, &pf->link_up); + + /* Flow Control mode not set by user, read current FW settings */ + if (pf->fc == -1) + pf->fc = hw->fc.current_mode; + return (0); }