Commit d8ae40dc authored by Aleksandr Loktionov's avatar Aleksandr Loktionov Committed by Tony Nguyen
Browse files

ixgbe: stop re-reading flash on every get_drvinfo for e610



ixgbe_get_drvinfo() calls ixgbe_refresh_fw_version() on every ethtool
query for e610 adapters.  That ends up in ixgbe_discover_flash_size(),
which bisects the full 16 MB NVM space issuing one ACI command per
step (~20 ms each, ~24 steps total = ~500 ms).

Profiling on an idle E610-XAT2 system with telegraf scraping ethtool
stats every 10 seconds:

  kretprobe:ixgbe_get_drvinfo took 527603 us
  kretprobe:ixgbe_get_drvinfo took 523978 us
  kretprobe:ixgbe_get_drvinfo took 552975 us
  kretprobe:ice_get_drvinfo   took       3 us
  kretprobe:igb_get_drvinfo   took       2 us
  kretprobe:i40e_get_drvinfo  took       5 us

The half-second stall happens under the RTNL lock, causing visible
latency on ip-link and friends.

The FW version can only change after an EMPR reset.  All flash data is
already populated at probe time and the cached adapter->eeprom_id is
what get_drvinfo should be returning.  The only place that needs to
trigger a re-read is ixgbe_devlink_reload_empr_finish(), right after
the EMPR completes and new firmware is running.  Additionally, refresh
the FW version in ixgbe_reinit_locked() so that any PF that undergoes a
reinit after an EMPR (e.g. triggered by another PF's devlink reload)
also picks up the new version in adapter->eeprom_id.

ixgbe_devlink_info_get() keeps its refresh call for explicit
"devlink dev info" queries, which is fine given those are user-initiated.

Fixes: c9e563ca ("ixgbe: add support for devlink reload")
Co-developed-by: default avatarJedrzej Jagielski <jedrzej.jagielski@intel.com>
Signed-off-by: default avatarJedrzej Jagielski <jedrzej.jagielski@intel.com>
Signed-off-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent bf6dbadb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -474,7 +474,7 @@ static int ixgbe_devlink_reload_empr_finish(struct devlink *devlink,
	adapter->flags2 &= ~(IXGBE_FLAG2_API_MISMATCH |
			     IXGBE_FLAG2_FW_ROLLBACK);

	return 0;
	return ixgbe_refresh_fw_version(adapter);
}

static const struct devlink_ops ixgbe_devlink_ops = {
+1 −1
Original line number Diff line number Diff line
@@ -973,7 +973,7 @@ int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter);
bool ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id,
			 u16 subdevice_id);
void ixgbe_set_fw_version_e610(struct ixgbe_adapter *adapter);
void ixgbe_refresh_fw_version(struct ixgbe_adapter *adapter);
int ixgbe_refresh_fw_version(struct ixgbe_adapter *adapter);
#ifdef CONFIG_PCI_IOV
void ixgbe_full_sync_mac_table(struct ixgbe_adapter *adapter);
#endif
+7 −6
Original line number Diff line number Diff line
@@ -1155,12 +1155,17 @@ static int ixgbe_set_eeprom(struct net_device *netdev,
	return ret_val;
}

void ixgbe_refresh_fw_version(struct ixgbe_adapter *adapter)
int ixgbe_refresh_fw_version(struct ixgbe_adapter *adapter)
{
	struct ixgbe_hw *hw = &adapter->hw;
	int err;

	err = ixgbe_get_flash_data(hw);
	if (err)
		return err;

	ixgbe_get_flash_data(hw);
	ixgbe_set_fw_version_e610(adapter);
	return 0;
}

static void ixgbe_get_drvinfo(struct net_device *netdev,
@@ -1168,10 +1173,6 @@ static void ixgbe_get_drvinfo(struct net_device *netdev,
{
	struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev);

	/* need to refresh info for e610 in case fw reloads in runtime */
	if (adapter->hw.mac.type == ixgbe_mac_e610)
		ixgbe_refresh_fw_version(adapter);

	strscpy(drvinfo->driver, ixgbe_driver_name, sizeof(drvinfo->driver));

	strscpy(drvinfo->fw_version, adapter->eeprom_id,
+10 −0
Original line number Diff line number Diff line
@@ -6289,6 +6289,16 @@ void ixgbe_reinit_locked(struct ixgbe_adapter *adapter)
	if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
		msleep(2000);
	ixgbe_up(adapter);

	/* E610 has no FW event to notify all PFs of an EMPR reset, so
	 * refresh the FW version here to pick up any new FW version after
	 * a hardware reset (e.g. EMPR triggered by another PF's devlink
	 * reload).  ixgbe_refresh_fw_version() updates both hw->flash and
	 * adapter->eeprom_id so ethtool -i reports the correct string.
	 */
	if (adapter->hw.mac.type == ixgbe_mac_e610)
		(void)ixgbe_refresh_fw_version(adapter);

	clear_bit(__IXGBE_RESETTING, &adapter->state);
}