drivers/net/ethernet/intel/igb/e1000_mbx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/igb/e1000_mbx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/igb/e1000_mbx.c- Extension
.c- Size
- 11633 bytes
- Lines
- 476
- 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
e1000_mbx.h
Detected Declarations
function igb_read_mbxfunction igb_write_mbxfunction igb_check_for_msgfunction igb_check_for_ackfunction igb_check_for_rstfunction igb_unlock_mbxfunction igb_poll_for_msgfunction igb_poll_for_ackfunction igb_read_posted_mbxfunction igb_write_posted_mbxfunction igb_check_for_bit_pffunction igb_check_for_msg_pffunction igb_check_for_ack_pffunction igb_check_for_rst_pffunction igb_obtain_mbx_lock_pffunction igb_release_mbx_lock_pffunction igb_write_mbx_pffunction igb_read_mbx_pffunction igb_init_mbx_params_pf
Annotated Snippet
if (p2v_mailbox & E1000_P2VMAILBOX_PFU) {
ret_val = 0;
break;
}
udelay(1000);
} while (count-- > 0);
return ret_val;
}
/**
* igb_release_mbx_lock_pf - release mailbox lock
* @hw: pointer to the HW structure
* @vf_number: the VF index
*
* return SUCCESS if we released the mailbox lock
**/
static s32 igb_release_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number)
{
u32 p2v_mailbox;
/* drop PF lock of mailbox, if set */
p2v_mailbox = rd32(E1000_P2VMAILBOX(vf_number));
if (p2v_mailbox & E1000_P2VMAILBOX_PFU)
wr32(E1000_P2VMAILBOX(vf_number),
p2v_mailbox & ~E1000_P2VMAILBOX_PFU);
return 0;
}
/**
* igb_write_mbx_pf - Places a message in the mailbox
* @hw: pointer to the HW structure
* @msg: The message buffer
* @size: Length of buffer
* @vf_number: the VF index
*
* returns SUCCESS if it successfully copied message into the buffer
**/
static s32 igb_write_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size,
u16 vf_number)
{
s32 ret_val;
u16 i;
/* lock the mailbox to prevent pf/vf race condition */
ret_val = igb_obtain_mbx_lock_pf(hw, vf_number);
if (ret_val)
goto out_no_write;
/* flush msg and acks as we are overwriting the message buffer */
igb_check_for_msg_pf(hw, vf_number);
igb_check_for_ack_pf(hw, vf_number);
/* copy the caller specified message to the mailbox memory buffer */
for (i = 0; i < size; i++)
array_wr32(E1000_VMBMEM(vf_number), i, msg[i]);
/* Interrupt VF to tell it a message has been sent and release buffer*/
wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_STS);
/* update stats */
hw->mbx.stats.msgs_tx++;
out_no_write:
return ret_val;
}
/**
* igb_read_mbx_pf - Read a message from the mailbox
* @hw: pointer to the HW structure
* @msg: The message buffer
* @size: Length of buffer
* @vf_number: the VF index
* @unlock: unlock the mailbox when done?
*
* This function copies a message from the mailbox buffer to the caller's
* memory buffer. The presumption is that the caller knows that there was
* a message due to a VF request so no polling for message is needed.
**/
static s32 igb_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size,
u16 vf_number, bool unlock)
{
s32 ret_val;
u16 i;
/* lock the mailbox to prevent pf/vf race condition */
ret_val = igb_obtain_mbx_lock_pf(hw, vf_number);
if (ret_val)
Annotation
- Immediate include surface: `e1000_mbx.h`.
- Detected declarations: `function igb_read_mbx`, `function igb_write_mbx`, `function igb_check_for_msg`, `function igb_check_for_ack`, `function igb_check_for_rst`, `function igb_unlock_mbx`, `function igb_poll_for_msg`, `function igb_poll_for_ack`, `function igb_read_posted_mbx`, `function igb_write_posted_mbx`.
- 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.