drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/fm10k/fm10k_mbx.c- Extension
.c- Size
- 63460 bytes
- Lines
- 2183
- 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
fm10k_common.h
Detected Declarations
function fm10k_fifo_initfunction fm10k_fifo_usedfunction fm10k_fifo_unusedfunction fm10k_fifo_emptyfunction fm10k_fifo_head_offsetfunction fm10k_fifo_tail_offsetfunction fm10k_fifo_head_lenfunction fm10k_fifo_head_dropfunction fm10k_fifo_drop_allfunction fm10k_mbx_index_lenfunction fm10k_mbx_tail_addfunction fm10k_mbx_tail_subfunction fm10k_mbx_head_addfunction fm10k_mbx_head_subfunction fm10k_mbx_pushed_tail_lenfunction fm10k_fifo_write_copyfunction fm10k_fifo_enqueuefunction fm10k_mbx_validate_msg_sizefunction fm10k_mbx_write_copyfunction fm10k_mbx_pull_headfunction fm10k_mbx_read_copyfunction fm10k_mbx_push_tailfunction fm10k_crc_16bfunction fm10k_fifo_crcfunction fm10k_mbx_update_local_crcfunction fm10k_mbx_verify_remote_crcfunction fm10k_mbx_rx_readyfunction fm10k_mbx_tx_readyfunction fm10k_mbx_tx_completefunction fm10k_mbx_dequeue_rxfunction fm10k_mbx_enqueue_txfunction fm10k_mbx_readfunction fm10k_mbx_writefunction fm10k_mbx_create_connect_hdrfunction fm10k_mbx_create_data_hdrfunction fm10k_mbx_create_disconnect_hdrfunction fm10k_mbx_create_fake_disconnect_hdrfunction fm10k_mbx_create_error_msgfunction fm10k_mbx_validate_msg_hdrfunction fm10k_mbx_create_replyfunction fm10k_mbx_reset_workfunction fm10k_mbx_update_max_sizefunction fm10k_mbx_connect_resetfunction fm10k_mbx_process_connectfunction fm10k_mbx_process_datafunction fm10k_mbx_process_disconnectfunction fm10k_mbx_process_errorfunction fm10k_mbx_process
Annotated Snippet
if (size > mbx->rx.size) {
mbx->max_size = mbx->rx.size - 1;
} else {
/* record the remote system requesting connection */
mbx->state = FM10K_STATE_OPEN;
fm10k_mbx_update_max_size(mbx, size);
}
break;
default:
break;
}
/* align our tail index to remote head index */
mbx->tail = head;
return fm10k_mbx_create_reply(hw, mbx, head);
}
/**
* fm10k_mbx_process_data - Process data header
* @hw: pointer to hardware structure
* @mbx: pointer to mailbox
*
* This function will read an incoming data header and reply with the
* appropriate message. It will return a value indicating the number of
* data DWORDs on success, or will return a negative value on failure.
**/
static s32 fm10k_mbx_process_data(struct fm10k_hw *hw,
struct fm10k_mbx_info *mbx)
{
const u32 *hdr = &mbx->mbx_hdr;
u16 head, tail;
s32 err;
/* we will need to pull all of the fields for verification */
head = FM10K_MSG_HDR_FIELD_GET(*hdr, HEAD);
tail = FM10K_MSG_HDR_FIELD_GET(*hdr, TAIL);
/* if we are in connect just update our data and go */
if (mbx->state == FM10K_STATE_CONNECT) {
mbx->tail = head;
mbx->state = FM10K_STATE_OPEN;
}
/* abort on message size errors */
err = fm10k_mbx_push_tail(hw, mbx, tail);
if (err < 0)
return err;
/* verify the checksum on the incoming data */
err = fm10k_mbx_verify_remote_crc(mbx);
if (err)
return err;
/* process messages if we have received any */
fm10k_mbx_dequeue_rx(hw, mbx);
return fm10k_mbx_create_reply(hw, mbx, head);
}
/**
* fm10k_mbx_process_disconnect - Process disconnect header
* @hw: pointer to hardware structure
* @mbx: pointer to mailbox
*
* This function will read an incoming disconnect header and reply with the
* appropriate message. It will return a value indicating the number of
* data DWORDs on success, or will return a negative value on failure.
**/
static s32 fm10k_mbx_process_disconnect(struct fm10k_hw *hw,
struct fm10k_mbx_info *mbx)
{
const enum fm10k_mbx_state state = mbx->state;
const u32 *hdr = &mbx->mbx_hdr;
u16 head;
s32 err;
/* we will need to pull the header field for verification */
head = FM10K_MSG_HDR_FIELD_GET(*hdr, HEAD);
/* We should not be receiving disconnect if Rx is incomplete */
if (mbx->pushed)
return FM10K_MBX_ERR_TAIL;
/* we have already verified mbx->head == tail so we know this is 0 */
mbx->head_len = 0;
/* verify the checksum on the incoming header is correct */
err = fm10k_mbx_verify_remote_crc(mbx);
Annotation
- Immediate include surface: `fm10k_common.h`.
- Detected declarations: `function fm10k_fifo_init`, `function fm10k_fifo_used`, `function fm10k_fifo_unused`, `function fm10k_fifo_empty`, `function fm10k_fifo_head_offset`, `function fm10k_fifo_tail_offset`, `function fm10k_fifo_head_len`, `function fm10k_fifo_head_drop`, `function fm10k_fifo_drop_all`, `function fm10k_mbx_index_len`.
- 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.