drivers/net/ethernet/intel/ixgbevf/mbx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ixgbevf/mbx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ixgbevf/mbx.c- Extension
.c- Size
- 12688 bytes
- Lines
- 508
- 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
mbx.hixgbevf.h
Detected Declarations
function ixgbevf_poll_for_msgfunction ixgbevf_poll_for_ackfunction ixgbevf_read_mailbox_vffunction ixgbevf_clear_msg_vffunction ixgbevf_clear_ack_vffunction ixgbevf_clear_rst_vffunction ixgbevf_check_for_bit_vffunction ixgbevf_check_for_msg_vffunction ixgbevf_check_for_ack_vffunction ixgbevf_check_for_rst_vffunction ixgbevf_obtain_mbx_lock_vffunction ixgbevf_release_mbx_lock_vffunction ixgbevf_release_mbx_lock_vf_legacyfunction ixgbevf_write_mbx_vf_legacyfunction ixgbevf_read_mbx_vffunction ixgbevf_read_mbx_vf_legacyfunction ixgbevf_init_mbx_params_vffunction ixgbevf_poll_mbxfunction ixgbevf_write_mbx
Annotated Snippet
if (ixgbevf_read_mailbox_vf(hw) & IXGBE_VFMAILBOX_VFU) {
ret_val = 0;
break;
}
/* Wait a bit before trying again */
udelay(mbx->udelay);
}
if (ret_val)
ret_val = IXGBE_ERR_TIMEOUT;
return ret_val;
}
/**
* ixgbevf_release_mbx_lock_vf - release mailbox lock
* @hw: pointer to the HW structure
**/
static void ixgbevf_release_mbx_lock_vf(struct ixgbe_hw *hw)
{
u32 vf_mailbox;
/* Return ownership of the buffer */
vf_mailbox = ixgbevf_read_mailbox_vf(hw);
vf_mailbox &= ~IXGBE_VFMAILBOX_VFU;
IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, vf_mailbox);
}
/**
* ixgbevf_release_mbx_lock_vf_legacy - release mailbox lock
* @hw: pointer to the HW structure
**/
static void ixgbevf_release_mbx_lock_vf_legacy(struct ixgbe_hw *__always_unused hw)
{
}
/**
* ixgbevf_write_mbx_vf - Write a message to the mailbox
* @hw: pointer to the HW structure
* @msg: The message buffer
* @size: Length of buffer
*
* returns 0 if it successfully copied message into the buffer
**/
static s32 ixgbevf_write_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size)
{
u32 vf_mailbox;
s32 ret_val;
u16 i;
/* lock the mailbox to prevent PF/VF race condition */
ret_val = ixgbevf_obtain_mbx_lock_vf(hw);
if (ret_val)
goto out_no_write;
/* flush msg and acks as we are overwriting the message buffer */
ixgbevf_clear_msg_vf(hw);
ixgbevf_clear_ack_vf(hw);
/* copy the caller specified message to the mailbox memory buffer */
for (i = 0; i < size; i++)
IXGBE_WRITE_REG_ARRAY(hw, IXGBE_VFMBMEM, i, msg[i]);
/* update stats */
hw->mbx.stats.msgs_tx++;
/* interrupt the PF to tell it a message has been sent */
vf_mailbox = ixgbevf_read_mailbox_vf(hw);
vf_mailbox |= IXGBE_VFMAILBOX_REQ;
IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, vf_mailbox);
/* if msg sent wait until we receive an ack */
ret_val = ixgbevf_poll_for_ack(hw);
out_no_write:
hw->mbx.ops.release(hw);
return ret_val;
}
/**
* ixgbevf_write_mbx_vf_legacy - Write a message to the mailbox
* @hw: pointer to the HW structure
* @msg: The message buffer
* @size: Length of buffer
*
* returns 0 if it successfully copied message into the buffer
**/
static s32 ixgbevf_write_mbx_vf_legacy(struct ixgbe_hw *hw, u32 *msg, u16 size)
Annotation
- Immediate include surface: `mbx.h`, `ixgbevf.h`.
- Detected declarations: `function ixgbevf_poll_for_msg`, `function ixgbevf_poll_for_ack`, `function ixgbevf_read_mailbox_vf`, `function ixgbevf_clear_msg_vf`, `function ixgbevf_clear_ack_vf`, `function ixgbevf_clear_rst_vf`, `function ixgbevf_check_for_bit_vf`, `function ixgbevf_check_for_msg_vf`, `function ixgbevf_check_for_ack_vf`, `function ixgbevf_check_for_rst_vf`.
- 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.