]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sfc: cope with ENOSYS from efx_mcdi_get_workarounds()
authorEdward Cree <ecree@solarflare.com>
Tue, 21 Jul 2015 14:09:31 +0000 (15:09 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 Jul 2015 05:21:31 +0000 (22:21 -0700)
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: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sfc/ef10.c
drivers/net/ethernet/sfc/mcdi.c

index 119301769ddabdd09959622e5e02cee2d4bbda49..44071176859d1b99a248a99a005a47542ea68427 100644 (file)
@@ -2277,20 +2277,27 @@ 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;
-
-       nic_data->workaround_26807 =
-               !!(enabled & MC_CMD_GET_WORKAROUNDS_OUT_BUG26807);
-
-       if (implemented & MC_CMD_GET_WORKAROUNDS_OUT_BUG26807 &&
-           !nic_data->workaround_26807) {
-               rc = efx_mcdi_set_workaround(efx, MC_CMD_WORKAROUND_BUG26807,
-                                            true);
-               if (!rc)
-                       nic_data->workaround_26807 = true;
-               else if (rc == -EPERM)
-                       rc = 0;
+       } else {
+               nic_data->workaround_26807 =
+                       !!(enabled & MC_CMD_GET_WORKAROUNDS_OUT_BUG26807);
+
+               if (implemented & MC_CMD_GET_WORKAROUNDS_OUT_BUG26807 &&
+                   !nic_data->workaround_26807) {
+                       rc = efx_mcdi_set_workaround(efx, MC_CMD_WORKAROUND_BUG26807,
+                                                    true);
+                       if (!rc)
+                               nic_data->workaround_26807 = true;
+                       else if (rc == -EPERM)
+                               rc = 0;
+               }
        }
 
        if (!rc)
index 81640f8bb811b099f6b2afb55cbb55f004c1096e..58232e78feaae49c22fc35e22c2b66913d58dc68 100644 (file)
@@ -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;
 }