aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-10-01 15:58:35 -0400
committerBen Hutchings <bhutchings@solarflare.com>2012-11-30 21:00:10 -0500
commit876be083b669c43203c0ee8709d749896e1d8d60 (patch)
treef88727f3f84df9fd33caa69fb36c2ec6ca039f4f
parentc3771a35bebeea16c4fd94d1116010cc02b1f75e (diff)
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: Ben Hutchings <bhutchings@solarflare.com>
-rw-r--r--drivers/net/ethernet/sfc/mcdi.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index e1967fbad161..3ef71a0f99a8 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -207,7 +207,9 @@ out:
207 return 0; 207 return 0;
208} 208}
209 209
210/* Test and clear MC-rebooted flag for this port/function */ 210/* Test and clear MC-rebooted flag for this port/function; reset
211 * software state as necessary.
212 */
211int efx_mcdi_poll_reboot(struct efx_nic *efx) 213int efx_mcdi_poll_reboot(struct efx_nic *efx)
212{ 214{
213 unsigned int addr = FR_CZ_MC_TREG_SMEM + MCDI_STATUS(efx); 215 unsigned int addr = FR_CZ_MC_TREG_SMEM + MCDI_STATUS(efx);
@@ -223,6 +225,11 @@ int efx_mcdi_poll_reboot(struct efx_nic *efx)
223 if (value == 0) 225 if (value == 0)
224 return 0; 226 return 0;
225 227
228 /* MAC statistics have been cleared on the NIC; clear our copy
229 * so that efx_update_diff_stat() can continue to work.
230 */
231 memset(&efx->mac_stats, 0, sizeof(efx->mac_stats));
232
226 EFX_ZERO_DWORD(reg); 233 EFX_ZERO_DWORD(reg);
227 efx_writed(efx, &reg, addr); 234 efx_writed(efx, &reg, addr);
228 235