aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKrzysztof Galazka <krzysztof.galazka@intel.com>2021-04-05 18:08:33 +0000
committerEric Joyner <erj@FreeBSD.org>2021-04-05 18:17:55 +0000
commit20a52706c814ccfd91c65586404abd2a1563a330 (patch)
tree67a1125049ff40c7add28c430d59a7fd24892f8a /sys
parent741223a65cd1752360c44341b762295f633e21cf (diff)
downloadsrc-20a52706c814ccfd91c65586404abd2a1563a330.tar.gz
src-20a52706c814ccfd91c65586404abd2a1563a330.zip
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 MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D29338
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ixl/if_ixl.c19
-rw-r--r--sys/dev/ixl/ixl_pf_iflib.c2
-rw-r--r--sys/dev/ixl/ixl_pf_main.c40
3 files changed, 43 insertions, 18 deletions
diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c
index c700af889cf1..3b49da5d76b9 100644
--- a/sys/dev/ixl/if_ixl.c
+++ b/sys/dev/ixl/if_ixl.c
@@ -304,6 +304,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);
@@ -1892,5 +1896,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 23d9f30299a9..68a174889c41 100644
--- a/sys/dev/ixl/ixl_pf_iflib.c
+++ b/sys/dev/ixl/ixl_pf_iflib.c
@@ -1094,7 +1094,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 b546701608f1..896da955843a 100644
--- a/sys/dev/ixl/ixl_pf_main.c
+++ b/sys/dev/ixl/ixl_pf_main.c
@@ -3169,27 +3169,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);
@@ -4594,6 +4595,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);
}