Skip to content

Commit

Permalink
sfc: Reset driver's MAC stats after MC reboot seen
Browse files Browse the repository at this point in the history
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: Ben Hutchings <bhutchings@solarflare.com>
  • Loading branch information
Ben Hutchings committed Dec 1, 2012
1 parent c3771a3 commit 876be08
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/net/ethernet/sfc/mcdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ static int efx_mcdi_poll(struct efx_nic *efx)
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)
{
unsigned int addr = FR_CZ_MC_TREG_SMEM + MCDI_STATUS(efx);
Expand All @@ -223,6 +225,11 @@ int efx_mcdi_poll_reboot(struct efx_nic *efx)
if (value == 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_writed(efx, &reg, addr);

Expand Down

0 comments on commit 876be08

Please sign in to comment.