net/ethtool/cmis_fw_update.c
Source file repositories/reference/linux-study-clean/net/ethtool/cmis_fw_update.c
File Facts
- System
- Linux kernel
- Corpus path
net/ethtool/cmis_fw_update.c- Extension
.c- Size
- 14335 bytes
- Lines
- 498
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ethtool.hlinux/firmware.hnet/netdev_lock.hcommon.hmodule_fw.hcmis.h
Detected Declarations
struct cmis_fw_update_fw_mng_featuresstruct cmis_cdb_fw_mng_features_rplstruct cmis_cdb_start_fw_download_plstruct cmis_cdb_write_fw_block_lpl_plstruct cmis_cdb_write_fw_block_epl_plstruct cmis_cdb_run_fw_image_plenum cmis_cdb_fw_write_mechanismfunction cmis_fw_update_fw_mng_features_getfunction sizeof_fieldfunction cmis_fw_update_start_downloadfunction cmis_fw_update_write_image_lplfunction cmis_fw_update_write_image_eplfunction cmis_fw_update_complete_downloadfunction cmis_fw_update_download_imagefunction module_is_readyfunction cmis_fw_update_wait_for_module_statefunction cmis_fw_update_run_imagefunction cmis_fw_update_commit_imagefunction cmis_fw_update_resetfunction ethtool_cmis_fw_update
Annotated Snippet
struct cmis_fw_update_fw_mng_features {
u8 start_cmd_payload_size;
u8 write_mechanism;
u16 max_duration_start;
u16 max_duration_write;
u16 max_duration_complete;
};
/* See section 9.4.2 "CMD 0041h: Firmware Management Features" in CMIS standard
* revision 5.2.
* struct cmis_cdb_fw_mng_features_rpl is a structured layout of the flat
* array, ethtool_cmis_cdb_rpl::payload.
*/
struct cmis_cdb_fw_mng_features_rpl {
u8 resv1;
u8 resv2;
u8 start_cmd_payload_size;
u8 resv3;
u8 read_write_len_ext;
u8 write_mechanism;
u8 resv4;
u8 resv5;
__be16 max_duration_start;
__be16 resv6;
__be16 max_duration_write;
__be16 max_duration_complete;
__be16 resv7;
};
enum cmis_cdb_fw_write_mechanism {
CMIS_CDB_FW_WRITE_MECHANISM_NONE = 0x00,
CMIS_CDB_FW_WRITE_MECHANISM_LPL = 0x01,
CMIS_CDB_FW_WRITE_MECHANISM_EPL = 0x10,
CMIS_CDB_FW_WRITE_MECHANISM_BOTH = 0x11,
};
/* See section 9.7.2 "CMD 0101h: Start Firmware Download" in CMIS standard
* revision 5.2.
* struct cmis_cdb_start_fw_download_pl is a structured layout of the
* flat array, ethtool_cmis_cdb_request::payload.
*/
struct cmis_cdb_start_fw_download_pl {
__struct_group(cmis_cdb_start_fw_download_pl_h, head, /* no attrs */,
__be32 image_size;
__be32 resv1;
);
u8 vendor_data[ETHTOOL_CMIS_CDB_LPL_MAX_PL_LENGTH -
sizeof(struct cmis_cdb_start_fw_download_pl_h)];
};
static int
cmis_fw_update_fw_mng_features_get(struct ethtool_cmis_cdb *cdb,
struct net_device *dev,
struct cmis_fw_update_fw_mng_features *fw_mng,
struct ethnl_module_fw_flash_ntf_params *ntf_params)
{
struct ethtool_cmis_cdb_cmd_args args = {};
struct cmis_cdb_fw_mng_features_rpl *rpl;
u8 flags = CDB_F_STATUS_VALID;
int err;
ethtool_cmis_cdb_check_completion_flag(cdb->cmis_rev, &flags);
ethtool_cmis_cdb_compose_args(&args,
ETHTOOL_CMIS_CDB_CMD_FW_MANAGMENT_FEATURES,
NULL, 0, NULL, 0,
cdb->max_completion_time,
cdb->read_write_len_ext, 1000,
sizeof(*rpl), flags);
err = ethtool_cmis_cdb_execute_cmd(dev, &args);
if (err < 0) {
ethnl_module_fw_flash_ntf_err(dev, ntf_params,
"FW Management Features command failed",
args.err_msg);
return err;
}
rpl = (struct cmis_cdb_fw_mng_features_rpl *)args.req.payload;
if (rpl->write_mechanism == CMIS_CDB_FW_WRITE_MECHANISM_NONE) {
ethnl_module_fw_flash_ntf_err(dev, ntf_params,
"CDB write mechanism is not supported",
NULL);
return -EOPNOTSUPP;
}
/* Above, we used read_write_len_ext that we got from CDB
* advertisement. Update it with the value that we got from module
* features query, which is specific for Firmware Management Commands
* (IDs 0100h-01FFh).
*/
Annotation
- Immediate include surface: `linux/ethtool.h`, `linux/firmware.h`, `net/netdev_lock.h`, `common.h`, `module_fw.h`, `cmis.h`.
- Detected declarations: `struct cmis_fw_update_fw_mng_features`, `struct cmis_cdb_fw_mng_features_rpl`, `struct cmis_cdb_start_fw_download_pl`, `struct cmis_cdb_write_fw_block_lpl_pl`, `struct cmis_cdb_write_fw_block_epl_pl`, `struct cmis_cdb_run_fw_image_pl`, `enum cmis_cdb_fw_write_mechanism`, `function cmis_fw_update_fw_mng_features_get`, `function sizeof_field`, `function cmis_fw_update_start_download`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.