drivers/net/ethernet/intel/fm10k/fm10k_pf.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/fm10k/fm10k_pf.c- Extension
.c- Size
- 54227 bytes
- Lines
- 1705
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hfm10k_pf.hfm10k_vf.h
Detected Declarations
function fm10k_reset_hw_pffunction fm10k_is_ari_hierarchy_pffunction fm10k_init_hw_pffunction fm10k_update_vlan_pffunction fm10k_read_mac_addr_pffunction fm10k_glort_valid_pffunction fm10k_update_xc_addr_pffunction fm10k_update_uc_addr_pffunction fm10k_update_mc_addr_pffunction fm10k_update_xcast_mode_pffunction fm10k_update_int_moderator_pffunction fm10k_update_lport_state_pffunction fm10k_configure_dglort_map_pffunction fm10k_queues_per_poolfunction fm10k_vf_queue_indexfunction fm10k_vectors_per_poolfunction fm10k_vf_vector_indexfunction fm10k_iov_assign_resources_pffunction fm10k_iov_configure_tc_pffunction fm10k_iov_assign_int_moderator_pffunction fm10k_iov_assign_default_mac_vlan_pffunction fm10k_iov_reset_resources_pffunction fm10k_iov_set_lport_pffunction fm10k_iov_reset_lport_pffunction fm10k_iov_update_stats_pffunction fm10k_iov_msg_msix_pffunction fm10k_iov_select_vidfunction fm10k_iov_supported_xcast_mode_pffunction fm10k_iov_msg_lport_state_pffunction fm10k_update_hw_stats_pffunction fm10k_rebind_hw_stats_pffunction fm10k_set_dma_mask_pffunction fm10k_get_fault_pffunction fm10k_request_lport_map_pffunction fm10k_get_host_state_pffunction fm10k_msg_lport_map_pffunction fm10k_msg_update_pvid_pffunction fm10k_record_global_table_datafunction fm10k_msg_err_pffunction fm10k_get_invariants_pf
Annotated Snippet
if (timeout == 10) {
err = FM10K_ERR_DMA_PENDING;
goto err_out;
}
usleep_range(100, 200);
txdctl = fm10k_read_reg(hw, FM10K_TXDCTL(vf_q_idx));
}
/* Update base address registers to contain MAC address */
if (is_valid_ether_addr(vf_info->mac)) {
tdbal = (((u32)vf_info->mac[3]) << 24) |
(((u32)vf_info->mac[4]) << 16) |
(((u32)vf_info->mac[5]) << 8);
tdbah = (((u32)0xFF) << 24) |
(((u32)vf_info->mac[0]) << 16) |
(((u32)vf_info->mac[1]) << 8) |
((u32)vf_info->mac[2]);
}
/* Record the base address into queue 0 */
fm10k_write_reg(hw, FM10K_TDBAL(vf_q_idx), tdbal);
fm10k_write_reg(hw, FM10K_TDBAH(vf_q_idx), tdbah);
/* Provide the VF the ITR scale, using software-defined fields in TDLEN
* to pass the information during VF initialization. See definition of
* FM10K_TDLEN_ITR_SCALE_SHIFT for more details.
*/
fm10k_write_reg(hw, FM10K_TDLEN(vf_q_idx), hw->mac.itr_scale <<
FM10K_TDLEN_ITR_SCALE_SHIFT);
err_out:
/* restore the queue back to VF ownership */
fm10k_write_reg(hw, FM10K_TQMAP(qmap_idx), vf_q_idx);
return err;
}
/**
* fm10k_iov_reset_resources_pf - Reassign queues and interrupts to a VF
* @hw: pointer to the HW structure
* @vf_info: pointer to VF information structure
*
* Reassign the interrupts and queues to a VF following an FLR
**/
static s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
struct fm10k_vf_info *vf_info)
{
u16 qmap_stride, queues_per_pool, vf_q_idx, qmap_idx;
u32 tdbal = 0, tdbah = 0, txqctl, rxqctl;
u16 vf_v_idx, vf_v_limit, vf_vid;
u8 vf_idx = vf_info->vf_idx;
int i;
/* verify vf is in range */
if (vf_idx >= hw->iov.num_vfs)
return FM10K_ERR_PARAM;
/* clear event notification of VF FLR */
fm10k_write_reg(hw, FM10K_PFVFLREC(vf_idx / 32), BIT(vf_idx % 32));
/* force timeout and then disconnect the mailbox */
vf_info->mbx.timeout = 0;
if (vf_info->mbx.ops.disconnect)
vf_info->mbx.ops.disconnect(hw, &vf_info->mbx);
/* determine vector offset and count */
vf_v_idx = fm10k_vf_vector_index(hw, vf_idx);
vf_v_limit = vf_v_idx + fm10k_vectors_per_pool(hw);
/* determine qmap offsets and counts */
qmap_stride = (hw->iov.num_vfs > 8) ? 32 : 256;
queues_per_pool = fm10k_queues_per_pool(hw);
qmap_idx = qmap_stride * vf_idx;
/* make all the queues inaccessible to the VF */
for (i = qmap_idx; i < (qmap_idx + qmap_stride); i++) {
fm10k_write_reg(hw, FM10K_TQMAP(i), 0);
fm10k_write_reg(hw, FM10K_RQMAP(i), 0);
}
/* calculate starting index for queues */
vf_q_idx = fm10k_vf_queue_index(hw, vf_idx);
/* determine correct default VLAN ID */
if (vf_info->pf_vid)
vf_vid = vf_info->pf_vid;
else
vf_vid = vf_info->sw_vid;
Annotation
- Immediate include surface: `linux/bitfield.h`, `fm10k_pf.h`, `fm10k_vf.h`.
- Detected declarations: `function fm10k_reset_hw_pf`, `function fm10k_is_ari_hierarchy_pf`, `function fm10k_init_hw_pf`, `function fm10k_update_vlan_pf`, `function fm10k_read_mac_addr_pf`, `function fm10k_glort_valid_pf`, `function fm10k_update_xc_addr_pf`, `function fm10k_update_uc_addr_pf`, `function fm10k_update_mc_addr_pf`, `function fm10k_update_xcast_mode_pf`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.