Skip to content

Commit 2374621

Browse files
committed
Merge branch 'sfc-devlink-flash-for-x4'
Edward Cree says: ==================== sfc: devlink flash for X4 Updates to support devlink flash on X4 NICs. Patch #2 is needed for NVRAM_PARTITION_TYPE_AUTO, and patch #1 is needed because the latest MCDI headers from firmware no longer include MDIO read/write commands. v1: https://lore.kernel.org/cover.1742223233.git.ecree.xilinx@gmail.com ==================== Link: https://patch.msgid.link/cover.1742493016.git.ecree.xilinx@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 652e2c7 + 5726a15 commit 2374621

File tree

8 files changed

+8222
-12093
lines changed

8 files changed

+8222
-12093
lines changed

Diff for: drivers/net/ethernet/sfc/ef10.c

+1
Original file line numberDiff line numberDiff line change
@@ -4419,6 +4419,7 @@ const struct efx_nic_type efx_x4_nic_type = {
44194419
.can_rx_scatter = true,
44204420
.always_rx_scatter = true,
44214421
.option_descriptors = true,
4422+
.flash_auto_partition = true,
44224423
.min_interrupt_mode = EFX_INT_MODE_MSIX,
44234424
.timer_period_max = 1 << ERF_DD_EVQ_IND_TIMER_VAL_WIDTH,
44244425
.offload_features = EF10_OFFLOAD_FEATURES,

Diff for: drivers/net/ethernet/sfc/ef100_netdev.c

-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,6 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data)
452452
NETIF_F_HIGHDMA | NETIF_F_ALL_TSO;
453453
netif_set_tso_max_segs(net_dev,
454454
ESE_EF100_DP_GZ_TSO_MAX_HDR_NUM_SEGS_DEFAULT);
455-
efx->mdio.dev = net_dev;
456455

457456
rc = efx_ef100_init_datapath_caps(efx);
458457
if (rc < 0)

Diff for: drivers/net/ethernet/sfc/efx.c

-24
Original file line numberDiff line numberDiff line change
@@ -474,28 +474,6 @@ void efx_get_irq_moderation(struct efx_nic *efx, unsigned int *tx_usecs,
474474
}
475475
}
476476

477-
/**************************************************************************
478-
*
479-
* ioctls
480-
*
481-
*************************************************************************/
482-
483-
/* Net device ioctl
484-
* Context: process, rtnl_lock() held.
485-
*/
486-
static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
487-
{
488-
struct efx_nic *efx = efx_netdev_priv(net_dev);
489-
struct mii_ioctl_data *data = if_mii(ifr);
490-
491-
/* Convert phy_id from older PRTAD/DEVAD format */
492-
if ((cmd == SIOCGMIIREG || cmd == SIOCSMIIREG) &&
493-
(data->phy_id & 0xfc00) == 0x0400)
494-
data->phy_id ^= MDIO_PHY_ID_C45 | 0x0400;
495-
496-
return mdio_mii_ioctl(&efx->mdio, data, cmd);
497-
}
498-
499477
/**************************************************************************
500478
*
501479
* Kernel net device interface
@@ -593,7 +571,6 @@ static const struct net_device_ops efx_netdev_ops = {
593571
.ndo_tx_timeout = efx_watchdog,
594572
.ndo_start_xmit = efx_hard_start_xmit,
595573
.ndo_validate_addr = eth_validate_addr,
596-
.ndo_eth_ioctl = efx_ioctl,
597574
.ndo_change_mtu = efx_change_mtu,
598575
.ndo_set_mac_address = efx_set_mac_address,
599576
.ndo_set_rx_mode = efx_set_rx_mode,
@@ -1201,7 +1178,6 @@ static int efx_pci_probe(struct pci_dev *pci_dev,
12011178
rc = efx_init_struct(efx, pci_dev);
12021179
if (rc)
12031180
goto fail1;
1204-
efx->mdio.dev = net_dev;
12051181

12061182
pci_info(pci_dev, "Solarflare NIC detected\n");
12071183

Diff for: drivers/net/ethernet/sfc/efx_reflash.c

+30-22
Original file line numberDiff line numberDiff line change
@@ -407,31 +407,40 @@ int efx_reflash_flash_firmware(struct efx_nic *efx, const struct firmware *fw,
407407
return -EOPNOTSUPP;
408408
}
409409

410-
devlink_flash_update_status_notify(devlink, "Checking update", NULL, 0, 0);
410+
mutex_lock(&efx->reflash_mutex);
411411

412-
rc = efx_reflash_parse_firmware_data(fw, &type, &data_subtype, &data,
413-
&data_size);
414-
if (rc) {
415-
NL_SET_ERR_MSG_MOD(extack,
416-
"Firmware image validation check failed");
417-
goto out;
418-
}
412+
devlink_flash_update_status_notify(devlink, "Checking update", NULL, 0, 0);
419413

420-
mutex_lock(&efx->reflash_mutex);
414+
if (efx->type->flash_auto_partition) {
415+
/* NIC wants entire FW file including headers;
416+
* FW will validate 'subtype' if there is one
417+
*/
418+
type = NVRAM_PARTITION_TYPE_AUTO;
419+
data = fw->data;
420+
data_size = fw->size;
421+
} else {
422+
rc = efx_reflash_parse_firmware_data(fw, &type, &data_subtype, &data,
423+
&data_size);
424+
if (rc) {
425+
NL_SET_ERR_MSG_MOD(extack,
426+
"Firmware image validation check failed");
427+
goto out_unlock;
428+
}
421429

422-
rc = efx_mcdi_nvram_metadata(efx, type, &subtype, NULL, NULL, 0);
423-
if (rc) {
424-
NL_SET_ERR_MSG_FMT_MOD(extack,
425-
"Metadata query for NVRAM partition %#x failed",
426-
type);
427-
goto out_unlock;
428-
}
430+
rc = efx_mcdi_nvram_metadata(efx, type, &subtype, NULL, NULL, 0);
431+
if (rc) {
432+
NL_SET_ERR_MSG_FMT_MOD(extack,
433+
"Metadata query for NVRAM partition %#x failed",
434+
type);
435+
goto out_unlock;
436+
}
429437

430-
if (subtype != data_subtype) {
431-
NL_SET_ERR_MSG_MOD(extack,
432-
"Firmware image is not appropriate for this adapter");
433-
rc = -EINVAL;
434-
goto out_unlock;
438+
if (subtype != data_subtype) {
439+
NL_SET_ERR_MSG_MOD(extack,
440+
"Firmware image is not appropriate for this adapter");
441+
rc = -EINVAL;
442+
goto out_unlock;
443+
}
435444
}
436445

437446
rc = efx_mcdi_nvram_info(efx, type, &size, &erase_align, &write_align,
@@ -506,7 +515,6 @@ int efx_reflash_flash_firmware(struct efx_nic *efx, const struct firmware *fw,
506515
rc = efx_mcdi_nvram_update_finish_polled(efx, type);
507516
out_unlock:
508517
mutex_unlock(&efx->reflash_mutex);
509-
out:
510518
devlink_flash_update_status_notify(devlink, rc ? "Update failed" :
511519
"Update complete",
512520
NULL, 0, 0);

0 commit comments

Comments
 (0)