Commit c4f78134 authored by Danielle Ratson's avatar Danielle Ratson Committed by David S. Miller

ethtool: cmis_fw_update: add a layer for supporting firmware update using CDB

According to the CMIS standard, the firmware update process is done using
a CDB commands sequence.

Implement a work that will be triggered from the module layer in the
next patch the will initiate and execute all the CDB commands in order, to
eventually complete the firmware update process.

This flashing process includes, writing the firmware image, running the new
firmware image and committing it after testing, so that it will run upon
reset.

This work will also notify user space about the progress of the firmware
update process.
Signed-off-by: default avatarDanielle Ratson <danieller@nvidia.com>
Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a39c84d7
......@@ -8,4 +8,4 @@ ethtool_nl-y := netlink.o bitset.o strset.o linkinfo.o linkmodes.o rss.o \
linkstate.o debug.o wol.o features.o privflags.o rings.o \
channels.o coalesce.o pause.o eee.o tsinfo.o cabletest.o \
tunnels.o fec.o eeprom.o stats.o phc_vclocks.o mm.o \
module.o cmis_cdb.o pse-pd.o plca.o mm.o
module.o cmis_fw_update.o cmis_cdb.o pse-pd.o plca.o mm.o
......@@ -20,6 +20,12 @@ struct ethtool_cmis_cdb {
enum ethtool_cmis_cdb_cmd_id {
ETHTOOL_CMIS_CDB_CMD_QUERY_STATUS = 0x0000,
ETHTOOL_CMIS_CDB_CMD_MODULE_FEATURES = 0x0040,
ETHTOOL_CMIS_CDB_CMD_FW_MANAGMENT_FEATURES = 0x0041,
ETHTOOL_CMIS_CDB_CMD_START_FW_DOWNLOAD = 0x0101,
ETHTOOL_CMIS_CDB_CMD_WRITE_FW_BLOCK_LPL = 0x0103,
ETHTOOL_CMIS_CDB_CMD_COMPLETE_FW_DOWNLOAD = 0x0107,
ETHTOOL_CMIS_CDB_CMD_RUN_FW_IMAGE = 0x0109,
ETHTOOL_CMIS_CDB_CMD_COMMIT_FW_IMAGE = 0x010A,
};
/**
......@@ -47,6 +53,7 @@ struct ethtool_cmis_cdb_request {
#define CDB_F_COMPLETION_VALID BIT(0)
#define CDB_F_STATUS_VALID BIT(1)
#define CDB_F_MODULE_STATE_VALID BIT(2)
/**
* struct ethtool_cmis_cdb_cmd_args - CDB commands execution arguments
......
This diff is collapsed.
......@@ -25,6 +25,35 @@ struct ethtool_module_fw_flash_params {
u8 password_valid:1;
};
/**
* struct ethtool_cmis_fw_update_params - CMIS firmware update specific
* parameters
* @dev: Pointer to the net_device to be flashed.
* @params: Module firmware flashing parameters.
* @ntf_params: Module firmware flashing notification parameters.
* @fw: Firmware to flash.
*/
struct ethtool_cmis_fw_update_params {
struct net_device *dev;
struct ethtool_module_fw_flash_params params;
struct ethnl_module_fw_flash_ntf_params ntf_params;
const struct firmware *fw;
};
/**
* struct ethtool_module_fw_flash - module firmware flashing
* @list: List node for &module_fw_flash_work_list.
* @dev_tracker: Refcount tracker for @dev.
* @work: The flashing firmware work.
* @fw_update: CMIS firmware update specific parameters.
*/
struct ethtool_module_fw_flash {
struct list_head list;
netdevice_tracker dev_tracker;
struct work_struct work;
struct ethtool_cmis_fw_update_params fw_update;
};
void
ethnl_module_fw_flash_ntf_err(struct net_device *dev,
struct ethnl_module_fw_flash_ntf_params *params,
......@@ -39,3 +68,5 @@ void
ethnl_module_fw_flash_ntf_in_progress(struct net_device *dev,
struct ethnl_module_fw_flash_ntf_params *params,
u64 done, u64 total);
void ethtool_cmis_fw_update(struct ethtool_cmis_fw_update_params *params);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment