On 01/07/2020 20:03, Jakub Kicinski wrote: > On Wed, 1 Jul 2020 15:51:25 +0100 Edward Cree wrote: >> Unprivileged functions (such as VFs) may set their MTU by use of the >> 'control' field of MC_CMD_SET_MAC_EXT, as used in efx_mcdi_set_mtu(). >> If calling efx_ef10_mac_reconfigure() from efx_change_mtu(), the NIC >> supports the above (SET_MAC_ENHANCED capability), and regular >> efx_mcdi_set_mac() fails EPERM, then fall back to efx_mcdi_set_mtu(). > Is there no way of checking the permission the function has before > issuing the firmware call? We could condition on the LINKCTRL flag from the MC_CMD_DRV_ATTACH response we get at start of day; but usually in this driver we've tried to follow the EAFP principle rather than embedding knowledge of the firmware's permissions model into the driver. I suppose it might make sense to go straight to efx_mcdi_set_mtu() in the mtu_only && SET_MAC_ENHANCED case, use efx_mcdi_set_mac() otherwise, and thus never have a fallback from one to the other. WDYT?
-ed