Skip to content

Commit ecb1c9c

Browse files
author
Ben Hutchings
committed
sfc: Only bind to EF10 functions with the LinkCtrl and Trusted flags
Although we do not yet enable multiple PFs per port, it is possible that a board will be reconfigured to enable them while the driver has not yet been updated to fully support this. The most obvious problem is that multiple functions may try to set conflicting link settings. But we will also run into trouble if the firmware doesn't consider us fully trusted. So, abort probing unless both the LinkCtrl and Trusted flags are set for this function. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
1 parent 568d7a0 commit ecb1c9c

File tree

1 file changed

+17
-1
lines changed
  • drivers/net/ethernet/sfc

1 file changed

+17
-1
lines changed

drivers/net/ethernet/sfc/mcdi.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
963963
bool *was_attached)
964964
{
965965
MCDI_DECLARE_BUF(inbuf, MC_CMD_DRV_ATTACH_IN_LEN);
966-
MCDI_DECLARE_BUF(outbuf, MC_CMD_DRV_ATTACH_OUT_LEN);
966+
MCDI_DECLARE_BUF(outbuf, MC_CMD_DRV_ATTACH_EXT_OUT_LEN);
967967
size_t outlen;
968968
int rc;
969969

@@ -981,6 +981,22 @@ static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
981981
goto fail;
982982
}
983983

984+
/* We currently assume we have control of the external link
985+
* and are completely trusted by firmware. Abort probing
986+
* if that's not true for this function.
987+
*/
988+
if (driver_operating &&
989+
outlen >= MC_CMD_DRV_ATTACH_EXT_OUT_LEN &&
990+
(MCDI_DWORD(outbuf, DRV_ATTACH_EXT_OUT_FUNC_FLAGS) &
991+
(1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_LINKCTRL |
992+
1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_TRUSTED)) !=
993+
(1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_LINKCTRL |
994+
1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_TRUSTED)) {
995+
netif_err(efx, probe, efx->net_dev,
996+
"This driver version only supports one function per port\n");
997+
return -ENODEV;
998+
}
999+
9841000
if (was_attached != NULL)
9851001
*was_attached = MCDI_DWORD(outbuf, DRV_ATTACH_OUT_OLD_STATE);
9861002
return 0;

0 commit comments

Comments
 (0)