drivers/net/ethernet/meta/fbnic/fbnic_devlink.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/meta/fbnic/fbnic_devlink.c- Extension
.c- Size
- 16587 bytes
- Lines
- 670
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/unaligned.hlinux/pci.hlinux/pldmfw.hlinux/types.hnet/devlink.hfbnic.hfbnic_fw.hfbnic_tlv.h
Detected Declarations
function fbnic_version_running_putfunction fbnic_version_stored_putfunction fbnic_devlink_info_getfunction fbnic_pldm_match_recordfunction fbnic_flash_startfunction fbnic_flash_componentfunction fbnic_devlink_flash_updatefunction fbnic_fw_reporter_dumpfunction fbnic_fw_reporter_diagnosefunction __printffunction fbnic_read_otp_statusfunction fbnic_otp_reporter_dumpfunction fbnic_devlink_otp_checkfunction fbnic_devlink_health_createfunction fbnic_devlink_health_destroyfunction fbnic_devlink_freefunction fbnic_devlink_registerfunction fbnic_devlink_unregister
Annotated Snippet
if (!fbnic_mbx_wait_for_cmpl(cmpl)) {
err = -ETIMEDOUT;
break;
}
err = cmpl->result;
if (err)
break;
/* Verify firmware is requesting the next chunk in the seq. */
if (cmpl->u.fw_update.offset != offset + length) {
err = -EFAULT;
break;
}
offset = cmpl->u.fw_update.offset;
length = cmpl->u.fw_update.length;
if (length > TLV_MAX_DATA || offset + length > size) {
err = -EFAULT;
break;
}
devlink_flash_update_status_notify(devlink, "Flashing",
component_name,
offset, size);
/* Mailbox will set length to 0 once it receives the finish
* message.
*/
if (!length)
continue;
reinit_completion(&cmpl->done);
err = fbnic_fw_xmit_fw_write_chunk(fbd, data, offset, length,
0);
if (err)
break;
}
if (err) {
fbnic_fw_xmit_fw_write_chunk(fbd, NULL, 0, 0, err);
err_no_msg:
snprintf(buf, sizeof(buf), "Mailbox encountered error %d!",
err);
devlink_flash_update_status_notify(devlink, buf,
component_name, 0, 0);
}
fbnic_mbx_clear_cmpl(fbd, cmpl);
cmpl_free:
fbnic_fw_put_cmpl(cmpl);
return err;
}
static const struct pldmfw_ops fbnic_pldmfw_ops = {
.match_record = fbnic_pldm_match_record,
.flash_component = fbnic_flash_component,
};
static int
fbnic_devlink_flash_update(struct devlink *devlink,
struct devlink_flash_update_params *params,
struct netlink_ext_ack *extack)
{
struct fbnic_dev *fbd = devlink_priv(devlink);
const struct firmware *fw = params->fw;
struct device *dev = fbd->dev;
struct pldmfw context;
char *err_msg;
int err;
context.ops = &fbnic_pldmfw_ops;
context.dev = dev;
err = pldmfw_flash_image(&context, fw);
if (err) {
switch (err) {
case -EINVAL:
err_msg = "Invalid image";
break;
case -EOPNOTSUPP:
err_msg = "Unsupported image";
break;
case -ENOMEM:
err_msg = "Out of memory";
break;
case -EFAULT:
err_msg = "Invalid header";
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/pci.h`, `linux/pldmfw.h`, `linux/types.h`, `net/devlink.h`, `fbnic.h`, `fbnic_fw.h`, `fbnic_tlv.h`.
- Detected declarations: `function fbnic_version_running_put`, `function fbnic_version_stored_put`, `function fbnic_devlink_info_get`, `function fbnic_pldm_match_record`, `function fbnic_flash_start`, `function fbnic_flash_component`, `function fbnic_devlink_flash_update`, `function fbnic_fw_reporter_dump`, `function fbnic_fw_reporter_diagnose`, `function __printf`.
- Atlas domain: Driver Families / drivers/net.
- 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.