Commit 5726a154 authored by Edward Cree's avatar Edward Cree Committed by Jakub Kicinski
Browse files

sfc: support X4 devlink flash



Unlike X2 and EF100, we do not attempt to parse the firmware file to
 find an image within it; we simply hand the entire file to the MC,
 which is responsible for understanding any container formats we might
 use and validating that the firmware file is applicable to this NIC.

Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
Link: https://patch.msgid.link/9a72a74002a7819c780b0a18ce9294c9d4e1db12.1742493017.git.ecree.xilinx@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 25d0c8e6
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,
+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);
+3 −0
Original line number Diff line number Diff line
@@ -1381,6 +1381,8 @@ struct efx_udp_tunnel {
 * @can_rx_scatter: NIC is able to scatter packets to multiple buffers
 * @always_rx_scatter: NIC will always scatter packets to multiple buffers
 * @option_descriptors: NIC supports TX option descriptors
 * @flash_auto_partition: firmware flash uses AUTO partition, driver does
 *	not need to perform image parsing
 * @min_interrupt_mode: Lowest capability interrupt mode supported
 *	from &enum efx_int_mode.
 * @timer_period_max: Maximum period of interrupt timer (in ticks)
@@ -1557,6 +1559,7 @@ struct efx_nic_type {
	bool can_rx_scatter;
	bool always_rx_scatter;
	bool option_descriptors;
	bool flash_auto_partition;
	unsigned int min_interrupt_mode;
	unsigned int timer_period_max;
	netdev_features_t offload_features;