Commit 23746210 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

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: default avatarJakub Kicinski <kuba@kernel.org>
parents 652e2c77 5726a154
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4419,6 +4419,7 @@ const struct efx_nic_type efx_x4_nic_type = {
	.can_rx_scatter = true,
	.always_rx_scatter = true,
	.option_descriptors = true,
	.flash_auto_partition = true,
	.min_interrupt_mode = EFX_INT_MODE_MSIX,
	.timer_period_max = 1 << ERF_DD_EVQ_IND_TIMER_VAL_WIDTH,
	.offload_features = EF10_OFFLOAD_FEATURES,
+0 −1
Original line number Diff line number Diff line
@@ -452,7 +452,6 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data)
				  NETIF_F_HIGHDMA | NETIF_F_ALL_TSO;
	netif_set_tso_max_segs(net_dev,
			       ESE_EF100_DP_GZ_TSO_MAX_HDR_NUM_SEGS_DEFAULT);
	efx->mdio.dev = net_dev;

	rc = efx_ef100_init_datapath_caps(efx);
	if (rc < 0)
+0 −24
Original line number Diff line number Diff line
@@ -474,28 +474,6 @@ void efx_get_irq_moderation(struct efx_nic *efx, unsigned int *tx_usecs,
	}
}

/**************************************************************************
 *
 * ioctls
 *
 *************************************************************************/

/* Net device ioctl
 * Context: process, rtnl_lock() held.
 */
static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
{
	struct efx_nic *efx = efx_netdev_priv(net_dev);
	struct mii_ioctl_data *data = if_mii(ifr);

	/* Convert phy_id from older PRTAD/DEVAD format */
	if ((cmd == SIOCGMIIREG || cmd == SIOCSMIIREG) &&
	    (data->phy_id & 0xfc00) == 0x0400)
		data->phy_id ^= MDIO_PHY_ID_C45 | 0x0400;

	return mdio_mii_ioctl(&efx->mdio, data, cmd);
}

/**************************************************************************
 *
 * Kernel net device interface
@@ -593,7 +571,6 @@ static const struct net_device_ops efx_netdev_ops = {
	.ndo_tx_timeout		= efx_watchdog,
	.ndo_start_xmit		= efx_hard_start_xmit,
	.ndo_validate_addr	= eth_validate_addr,
	.ndo_eth_ioctl		= efx_ioctl,
	.ndo_change_mtu		= efx_change_mtu,
	.ndo_set_mac_address	= efx_set_mac_address,
	.ndo_set_rx_mode	= efx_set_rx_mode,
@@ -1201,7 +1178,6 @@ static int efx_pci_probe(struct pci_dev *pci_dev,
	rc = efx_init_struct(efx, pci_dev);
	if (rc)
		goto fail1;
	efx->mdio.dev = net_dev;

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

+30 −22
Original line number Diff line number Diff line
@@ -407,18 +407,26 @@ int efx_reflash_flash_firmware(struct efx_nic *efx, const struct firmware *fw,
		return -EOPNOTSUPP;
	}

	mutex_lock(&efx->reflash_mutex);

	devlink_flash_update_status_notify(devlink, "Checking update", NULL, 0, 0);

	if (efx->type->flash_auto_partition) {
		/* NIC wants entire FW file including headers;
		 * FW will validate 'subtype' if there is one
		 */
		type = NVRAM_PARTITION_TYPE_AUTO;
		data = fw->data;
		data_size = fw->size;
	} else {
		rc = efx_reflash_parse_firmware_data(fw, &type, &data_subtype, &data,
						     &data_size);
		if (rc) {
			NL_SET_ERR_MSG_MOD(extack,
					   "Firmware image validation check failed");
		goto out;
			goto out_unlock;
		}

	mutex_lock(&efx->reflash_mutex);

		rc = efx_mcdi_nvram_metadata(efx, type, &subtype, NULL, NULL, 0);
		if (rc) {
			NL_SET_ERR_MSG_FMT_MOD(extack,
@@ -433,6 +441,7 @@ int efx_reflash_flash_firmware(struct efx_nic *efx, const struct firmware *fw,
			rc = -EINVAL;
			goto out_unlock;
		}
	}

	rc = efx_mcdi_nvram_info(efx, type, &size, &erase_align, &write_align,
				 &protected);
@@ -506,7 +515,6 @@ int efx_reflash_flash_firmware(struct efx_nic *efx, const struct firmware *fw,
		rc = efx_mcdi_nvram_update_finish_polled(efx, type);
out_unlock:
	mutex_unlock(&efx->reflash_mutex);
out:
	devlink_flash_update_status_notify(devlink, rc ? "Update failed" :
							 "Update complete",
					   NULL, 0, 0);
+8186 −11972

File changed.

Preview size limit exceeded, changes collapsed.

Loading