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

Commit aabc5649 authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller
Browse files

sfc: Wait at most 10ms for the MC to finish reading out MAC statistics



The original code would wait indefinitely if MAC stats DMA failed.

Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Cc: stable@kernel.org
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c0786693
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -456,8 +456,17 @@ static int siena_try_update_nic_stats(struct efx_nic *efx)

static void siena_update_nic_stats(struct efx_nic *efx)
{
	while (siena_try_update_nic_stats(efx) == -EAGAIN)
		cpu_relax();
	int retry;

	/* If we're unlucky enough to read statistics wduring the DMA, wait
	 * up to 10ms for it to finish (typically takes <500us) */
	for (retry = 0; retry < 100; ++retry) {
		if (siena_try_update_nic_stats(efx) == 0)
			return;
		udelay(100);
	}

	/* Use the old values instead */
}

static void siena_start_nic_stats(struct efx_nic *efx)