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

Commit 832dc9ed authored by Edward Cree's avatar Edward Cree Committed by David S. Miller
Browse files

sfc: cope with ENOSYS from efx_mcdi_get_workarounds()



GET_WORKAROUNDS was only introduced in May 2014, not all firmware
 will have it.  So call sites need to handle ENOSYS.
In this case we're probing the bug26807 workaround, which is not
 implemented in any firmware that doesn't have GET_WORKAROUNDS.
 So interpret ENOSYS as 'false'.

Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 46e612b0
Loading
Loading
Loading
Loading
+20 −13
Original line number Diff line number Diff line
@@ -2277,9 +2277,15 @@ static int efx_ef10_ev_init(struct efx_channel *channel)

	/* Successfully created event queue on channel 0 */
	rc = efx_mcdi_get_workarounds(efx, &implemented, &enabled);
	if (rc)
	if (rc == -ENOSYS) {
		/* GET_WORKAROUNDS was implemented before the bug26807
		 * workaround, thus the latter must be unavailable in this fw
		 */
		nic_data->workaround_26807 = false;
		rc = 0;
	} else if (rc) {
		goto fail;

	} else {
		nic_data->workaround_26807 =
			!!(enabled & MC_CMD_GET_WORKAROUNDS_OUT_BUG26807);

@@ -2292,6 +2298,7 @@ static int efx_ef10_ev_init(struct efx_channel *channel)
			else if (rc == -EPERM)
				rc = 0;
		}
	}

	if (!rc)
		return 0;
+5 −1
Original line number Diff line number Diff line
@@ -1816,7 +1816,11 @@ int efx_mcdi_get_workarounds(struct efx_nic *efx, unsigned int *impl_out,
	return 0;

fail:
	netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
	/* Older firmware lacks GET_WORKAROUNDS and this isn't especially
	 * terrifying.  The call site will have to deal with it though.
	 */
	netif_printk(efx, hw, rc == -ENOSYS ? KERN_DEBUG : KERN_ERR,
		     efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
	return rc;
}