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
This commit is contained in:
Krzysztof Galazka 2021-04-05 11:08:33 -07:00 committed by Eric Joyner
parent 741223a65c
commit 20a52706c8
3 changed files with 43 additions and 18 deletions

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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);
}