Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 876be083 authored by Ben Hutchings's avatar Ben Hutchings
Browse files

sfc: Reset driver's MAC stats after MC reboot seen



If the MC reboots then the stats it reports to us will have been
reset.  We need to reset ours to get efx_update_diff_stat() working
properly.

(Ideally we would maintain stats across the reboot, but as this should
only happen immediately after a firmware upgrade it's not really worth
the trouble.)

Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
parent c3771a35
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -207,7 +207,9 @@ out:
	return 0;
	return 0;
}
}


/* Test and clear MC-rebooted flag for this port/function */
/* Test and clear MC-rebooted flag for this port/function; reset
 * software state as necessary.
 */
int efx_mcdi_poll_reboot(struct efx_nic *efx)
int efx_mcdi_poll_reboot(struct efx_nic *efx)
{
{
	unsigned int addr = FR_CZ_MC_TREG_SMEM + MCDI_STATUS(efx);
	unsigned int addr = FR_CZ_MC_TREG_SMEM + MCDI_STATUS(efx);
@@ -223,6 +225,11 @@ int efx_mcdi_poll_reboot(struct efx_nic *efx)
	if (value == 0)
	if (value == 0)
		return 0;
		return 0;


	/* MAC statistics have been cleared on the NIC; clear our copy
	 * so that efx_update_diff_stat() can continue to work.
	 */
	memset(&efx->mac_stats, 0, sizeof(efx->mac_stats));

	EFX_ZERO_DWORD(reg);
	EFX_ZERO_DWORD(reg);
	efx_writed(efx, &reg, addr);
	efx_writed(efx, &reg, addr);